Camera的代码有问题, The problem occurs when the system process following code// Notify the client of a new frame. if (mMsgEnabled & CAMERA_MSG_PREVIEW_FRAME) mDataCb(CAMERA_MSG_PREVIEW_FRAME, buffer, mCallbackCookie);In donut it uses mPreviewCallback(buffer, mPreviewCallbackCookie) and has no problem.
The problem occurs when the system process following code// Notify the client of a new frame.
if (mMsgEnabled & CAMERA_MSG_PREVIEW_FRAME)
mDataCb(CAMERA_MSG_PREVIEW_FRAME, buffer,
mCallbackCookie);In donut it uses mPreviewCallback(buffer, mPreviewCallbackCookie) and
has no problem.
如果要把Android2.0 Camera的接口改回donut中的mPreviewCallback接口,要做比较大的工作,而且还不一定有效....
1. 在frameworks/base/camera/libcameraservice/CameraService.cpp中的
handlePreviewData函数里你注释上mSurface->postBuffer(offset);
看是否还出现这种情况?
2. 将1中的注释放开, 在FakeCamera.cpp中的
FakeCamera::getNextFrameAsYuv422函数里将buffer内容全部清为0,看是否还有
这现象
3. 将1中的注释放开, 在CameraHardwareStub.cpp中的previewThread函数调用
getNextFrameAsRgb565,这还需要需要修改CameraService.cpp中surface的注册
buffer类型为RGB565,看上传RGB565数据是否还有这问题