Hi Nikko,

The color conversion needs to be done before passing the frames through the
callback(CAMERA_MSG_PREVIEW_FRAME) as the yuv420sp is the default color
format supported by android application while accessing preview frames from
application layer.

Have a look at lines from 209-215 in

http://android.git.linaro.org/gitweb?p=hardware/linaro/common.git;a=blob;f=libcamera/CameraHardware.cpp;h=8c90fa4a591b2c0a43d0cbe42f656937785708ee;hb=1ad0e928edf6f046572b3f32eb5ee23d8d7f3f79

here is  the camera hal which I have tested with skype,linphone,google
hangouts kind of applications,you can look at it as reference.
http://android.git.linaro.org/gitweb?p=hardware/linaro/common.git;a=summary

Regards,
Vishal

On 2 May 2012 08:25, Nikko Torcita <nikkotorc...@gmail.com> wrote:

> Hi all,
>
> I've been trying to support generic UVC cameras on android and have been
> successful so far with getting the native camera app to display preview
> images until I tested my code with skype video call and got stuck with a
> buffer memory problem. To break it down,
>
> 1. I'm using the yuv422i-yuyv format since it's the only pixel format
> supported by the uvc camera (Vimicro chipset) that i'm testing. I have also
> set CameraService::Client::registerPreviewBuffers() to support
> HAL_PIXEL_FORMAT_YCbCr_422_I in CameraService.cpp.
>
> 2. I set the size of my preview heap to 'PreviewHeap = width x height x 2'
> since YUV422 takes up 4 bytes per 2 pixels.
>
> From logcat, I get this:
>
> D/CameraHardware(28343): PREVIEW SIZE: w=320 h=240 framerate=30
> E/CameraHardware(28343): virtual android::status_t
> android::CameraHardware::startPreview() :
> D/V4L2Camera(28343): USB Camera now streaming...
> D/libEGL  (28734): loaded /system/lib/egl/libGLES_android.so
> D/libEGL  (28734): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
> D/libEGL  (28734): loaded
> /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
> D/libEGL  (28734): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
> *E/Camera-JNI(28734): Manually set buffer was too small! Expected 153600
> bytes, but got 115201!*
> *E/Camera-JNI(28734): Manually set buffer was too small! Expected 153600
> bytes, but got 115201!*
> *E/Camera-JNI(28734): Manually set buffer was too small! Expected 153600
> bytes, but got 115201!*
> W/com.skype.je(28734): not showing
>
> I traced it down to the camera jni and it seems like somewhere above the
> HAL, a buffer was set to accommodate only up to 'width x height x 1.5'.
> Hence, 320x240x1.5 = 115200 instead of 320x240x2 = 153600. Could it be that
> the skype application only provided support for NV21 (YUV420) which takes
> up 'width x height x 1.5' bytes of data?
>
> Thank you in advance.
>
> Nikko Torcita
>
> --
> unsubscribe: android-porting+unsubscr...@googlegroups.com
> website: http://groups.google.com/group/android-porting
>

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

Reply via email to