[raspberrypi/libcamera] Android preview streaming and image capture does not work (Issue #144)

jan at radicalsystems.co.za jan at radicalsystems.co.za
Mon Jun 17 10:12:12 CEST 2024


Thank you for reply!

 

This has been an ongoing discussion on libcamera email dev list.

 

I have created a fork from the main libcamera repo and will start merging my changes and tests as I go.

https://github.com/RadicalES/libcamera

As I feel this is the master repo and there are plenty of other floating versions, but merely sub repos.

 

Main issue is I don’t know how to compile and replace a running copy of the relevant libcamera .so’s, since system/vendor files get signed in Android OS during a build.

Change, rebuild, reflash and test takes like 5-10mins.

 

Some smaller code issues caused problems, but main problem was this: https://github.com/RadicalES/libcamera/blob/master/src/android/mm/generic_frame_buffer_allocator.cpp

Since I know nothing about libcamera, it was really tedious debugging to figure that out.

I could not get hw_get_module to work under AOS 14.

The hardwareModule pointer was always invalid.

GRALLOC is not really the way to allocate graphics buffers under Android as I found out.

And I moved to LibUI, which adds extra layers ontop of GRALLOC.

This was really the main issue and fixed the problem right away.

I had to update and add a few more header files to satisfy working with LibUI.

Next up was to get it to work properly, it kept calling into the stub function.

And the trick was to add a Linker Flag to libui in the meson.build.

The are other smaller problems, like contiguous buffers testing on different FDs and different planes, but these I simply hacked for now, as others did as well.

 

My code merge started at: https://github.com/raspberry-vanilla/android_external_libcamera

Which gave a good working copy of the OS.

Then got some code from main libcamera repo.

And more from https://gitlab.baylibre.com/baylibre/ti/android/aosp/external/libcamera

And from yours https://github.com/raspberrypi/libcamera

And a lot of debugging output.

 

I have added a few relevant debug traces to https://github.com/RadicalES/libcamera/tree/master/reports for documentational purposes.

Currently I’m on the last issue, https://github.com/RadicalES/libcamera/blob/master/reports/debug5_thread_issue.txt

Which I have narrowed down to PostProcessorJpeg::process, and that is where I ended yesterday.

So, the last hurdle seems to be a problem converting the buffer to a JPEG if I understand it correctly.

 

I must still test and verify the code from my repo, as I did not really expect to get pulled in this deep into the code and changed were done in place.

And working my way back to see what changes are really needed to fix the various problems.

 

Cheers

Jan

 

 

 

From: naushir <notifications at github.com> 
Sent: Friday, June 14, 2024 10:12 AM
To: raspberrypi/libcamera <libcamera at noreply.github.com>
Cc: Jan Zwiegers <jan at radicalsystems.co.za>; Author <author at noreply.github.com>
Subject: Re: [raspberrypi/libcamera] Android preview streaming and image capture does not work (Issue #144)

 

Looking at the logs, it feels like there's possibly a permissions issue, maybe the user does not have access to /dev/media* or the gralloc allocator device nodes? I'm afraid I really can't help more as I know next to nothing about the Android system environment you are running under :(

—
Reply to this email directly, view it on GitHub <https://github.com/raspberrypi/libcamera/issues/144#issuecomment-2167492122> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABQHOUBD6UB5EZ7OK75ICX3ZHKQTNAVCNFSM6AAAAABJD5QRBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRXGQ4TEMJSGI> .
You are receiving this because you authored the thread.Message ID: <raspberrypi/libcamera/issues/144/2167492122 at github.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20240617/7a065bca/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ~WRD0005.jpg
Type: image/jpeg
Size: 823 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20240617/7a065bca/attachment.jpg>


More information about the libcamera-devel mailing list