首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在Camera2上使用captureBurst接口时JPEG回调超时

在Camera2上使用captureBurst接口时JPEG回调超时
EN

Stack Overflow用户
提问于 2015-08-12 00:09:22
回答 1查看 1.5K关注 0票数 0

我正在使用camera2应用程序接口从captureBurst中获取大量图像。这款应用程序是camera2basic的一个略微改动的版本。

图像读取器声明为:

代码语言:javascript
运行
复制
ImageReader multiReader = ImageReader.NewInstance(width, height, ImageFormatType.Jpeg, 10);

我使用的是这个cameraCaptureCallback:

代码语言:javascript
运行
复制
private class CameraCaptureStateListener: CameraCaptureSession.StateCallback
{

    public Action<CameraCaptureSession> OnConfigureFailedAction;
    public override void OnConfigureFailed (CameraCaptureSession session)
    {
        if (OnConfigureFailedAction != null) 
        {
            OnConfigureFailedAction (session);
        }
    }
    public Action<CameraCaptureSession> OnConfiguredAction;
    public override void OnConfigured(CameraCaptureSession session)
    {
        if(OnConfiguredAction != null)
        {
            OnConfiguredAction(session);
        }
    }
}

这是captureSession:

代码语言:javascript
运行
复制
mCameraDevice.CreateCaptureSession(outputSurfaces, new CameraCaptureStateListener()
{
    OnConfiguredAction = (CameraCaptureSession session) => {
        try 
        {
            List<CaptureRequest> requests = new List<CaptureRequest>();
            for(int i = 0; i < 10; i++)
            {
                requests.Add(crBuilder.Build());
                Log.Debug("CaptureRequest", "Added new captureRequst");
            }
                session.CaptureBurst(requests, captureListener, backgroundHandler);
                Toast.MakeText (activity, "BurstCapture Complete", ToastLength.Long).Show ();
        }
        catch (CameraAccessException ex)
        {
            Log.WriteLine(LogPriority.Info, "Capture Session error: ", ex.ToString());
        }
    }
}, backgroundHandler );

这是我的错误日志:

代码语言:javascript
运行
复制
[Adreno-EGL] <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.BF.1.1.1_RB1.05.00.02.042.016_msm8974_LA.BF.1.1.1_RB1__release_AU ()
[Adreno-EGL] OpenGL ES Shader Compiler Version: E031.25.03.00
[Adreno-EGL] Build Date: 02/11/15 Wed
[Adreno-EGL] Local Branch: mybranch7539026
[Adreno-EGL] Remote Branch: quic/LA.BF.1.1.1_rb1.10
[Adreno-EGL] Local Patches: NONE
[Adreno-EGL] Reconstruct Branch: AU_LINUX_ANDROID_LA.BF.1.1.1_RB1.05.00.02.042.016 + 62ca4eb + acd831d + 9f8b442 + e027a02 + cba30ba + 53c303a + a649d79 + 23e16f8 + 5e97da7 + cbd2a44 + 33d072a + 7aacf06 + 72b33e7 + 28f6f60 + b4c13d8 +  NOTHING
[OpenGLRenderer] Initialized EGL, version 1.4
[OpenGLRenderer] Enabling debug mode 0
[CameraDeviceState] Legacy camera service transitioning to state CONFIGURING
[RequestThread-0] Configure outputs: 1 surfaces configured.
[Camera] app passed NULL surface
[CameraDeviceState] Legacy camera service transitioning to state IDLE
[CameraFragment: CameraCharacteristics] lensFocusDistanceCalibration = 
[RequestQueue] Repeating capture request set.
[LegacyRequestMapper] convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[CameraDeviceState] Legacy camera service transitioning to state CAPTURING
[BufferQueueConsumer] [unnamed-24394-2] setMaxAcquiredBufferCount: invalid count 1000
[RequestQueue] Repeating capture request cancelled.
[CameraDeviceState] Legacy camera service transitioning to state IDLE
[CameraDeviceState] Legacy camera service transitioning to state CONFIGURING
[RequestThread-0] Configure outputs: 2 surfaces configured.
[Camera] app passed NULL surface
[RequestThread-0] configureOutputs - set take picture size to 4160x3120
[CameraDeviceState] Legacy camera service transitioning to state IDLE
[Choreographer] Skipped 1381 frames!  The application may be doing too much work on its main thread.
Thread started:  #3
[Mono] DllImport attempting to load: '/system/lib/libc.so'.
[Mono] DllImport loaded library '/system/lib/libc.so'.
[Mono] DllImport searching in: '/system/lib/libc.so' ('/system/lib/libc.so').
[Mono] Searching for 'gettid'.
[Mono] Probing 'gettid'.
[Mono] Found as 'gettid'.
[CaptureRequest] Added new captureRequst
[CaptureRequest] Added new captureRequst
[CaptureRequest] Added new captureRequst
[CaptureRequest] Added new captureRequst
[CaptureRequest] Added new captureRequst
[CaptureRequest] Added new captureRequst
[CaptureRequest] Added new captureRequst
[CaptureRequest] Added new captureRequst
[CaptureRequest] Added new captureRequst
[CaptureRequest] Added new captureRequst
[LegacyRequestMapper] convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[RenderScript] Application requested CPU execution
[RenderScript] 0xb8382058 Launching thread(s), CPUs 4
[CameraDeviceState] Legacy camera service transitioning to state CAPTURING
[RequestThread-0] Received jpeg.
[RequestThread-0] Producing jpeg buffer...
[ImageReader_JNI] ImageReader_imageSetup: Receiving JPEG in HAL_PIXEL_FORMAT_RGBA_8888 buffer.
[LegacyRequestMapper] convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[RequestThread-0] Received jpeg.
[RequestThread-0] Producing jpeg buffer...
[LegacyRequestMapper] convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[RequestThread-0] Received jpeg.
[RequestThread-0] Producing jpeg buffer...
[LegacyRequestMapper] convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[RequestThread-0] Received jpeg.
[RequestThread-0] Producing jpeg buffer...
[RequestThread-0] Hit timeout for jpeg callback!
[LegacyRequestMapper] convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[RequestThread-0] Hit timeout for jpeg callback!
[RequestHolder] Capture failed for request: 1
[LegacyRequestMapper] convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[RequestThread-0] Hit timeout for jpeg callback!
[RequestHolder] Capture failed for request: 1
[LegacyRequestMapper] convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[RequestThread-0] Hit timeout for jpeg callback!
[RequestHolder] Capture failed for request: 1
[LegacyRequestMapper] convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[RequestThread-0] Hit timeout for jpeg callback!
[RequestHolder] Capture failed for request: 1
[LegacyRequestMapper] convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[RequestThread-0] Hit timeout for jpeg callback!
[RequestHolder] Capture failed for request: 1
[LegacyRequestMapper] convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[LegacyRequestMapper] Only received metering rectangles with weight 0.
[RequestThread-0] Hit timeout for jpeg callback!
[RequestHolder] Capture failed for request: 1
[CameraDeviceState] Legacy camera service transitioning to state IDLE
[CameraDeviceState] Legacy camera service transitioning to state CONFIGURING
[RequestThread-0] Configure outputs: 1 surfaces configured.
[Camera] app passed NULL surface
[CameraDeviceState] Legacy camera service transitioning to state IDLE
[ImageReader_JNI] ImageReader_imageSetup: Receiving JPEG in HAL_PIXEL_FORMAT_RGBA_8888 buffer.
[ImageReader_JNI] ImageReader_imageSetup: Receiving JPEG in HAL_PIXEL_FORMAT_RGBA_8888 buffer.
[Legacy-CameraDevice-JNI] produceFrame: Pixel buffer needs size 1529528, cannot fit in gralloc buffer of size 1248
[Legacy-CameraDevice-JNI] LegacyCameraDevice_nativeProduceFrame: Error while producing frame Invalid argument (-22).
Thread started:  #4

仅供参考,这是来自Xamarin Studio的,这就是为什么它是用c#而不是java编写的

似乎是因为我使用xamarin单步执行代码,所以它没有停止所有线程,这导致了活动线程(已停止)和jpeg缓冲区之间出现争用条件,这导致了jpeg回调错误。

EN

回答 1

Stack Overflow用户

发布于 2016-02-15 13:50:23

在Camera 2 API视图中修改此行

代码语言:javascript
运行
复制
imageReader = ImageReader.newInstance(largest.getWidth(), largest.getHeight(),ImageFormat.JPEG, 2);
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31946796

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档