From 8d764bfc74c40641f018a0aa87d6f484aec92eae Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 12 Jul 2013 22:06:20 -0700 Subject: always pass the BufferQueue explicitely to consumers Change-Id: Ic2d9a9cf184a482b3c78a481ed693ee32df5ca13 --- camera/ProCamera.cpp | 3 ++- cmds/stagefright/stagefright.cpp | 3 ++- libvideoeditor/lvpp/NativeWindowRenderer.cpp | 3 ++- services/camera/libcameraservice/camera2/CallbackProcessor.cpp | 3 ++- services/camera/libcameraservice/camera2/JpegProcessor.cpp | 3 ++- services/camera/libcameraservice/camera2/StreamingProcessor.cpp | 3 ++- services/camera/libcameraservice/camera2/ZslProcessor.cpp | 3 ++- services/camera/libcameraservice/camera3/Camera3InputStream.cpp | 3 ++- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/camera/ProCamera.cpp b/camera/ProCamera.cpp index fec5461..190402e 100644 --- a/camera/ProCamera.cpp +++ b/camera/ProCamera.cpp @@ -247,7 +247,8 @@ status_t ProCamera::createStreamCpu(int width, int height, int format, sp c = mCamera; if (c == 0) return NO_INIT; - sp cc = new CpuConsumer(heapCount, synchronousMode); + sp bq = new BufferQueue(); + sp cc = new CpuConsumer(bq, heapCount, synchronousMode); cc->setName(String8("ProCamera::mCpuConsumer")); sp stc = new Surface( diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp index f8fc8ed..529b96c 100644 --- a/cmds/stagefright/stagefright.cpp +++ b/cmds/stagefright/stagefright.cpp @@ -937,7 +937,8 @@ int main(int argc, char **argv) { } else { CHECK(useSurfaceTexAlloc); - sp texture = new GLConsumer(0 /* tex */); + sp bq = new BufferQueue(); + sp texture = new GLConsumer(bq, 0 /* tex */); gSurface = new Surface(texture->getBufferQueue()); } diff --git a/libvideoeditor/lvpp/NativeWindowRenderer.cpp b/libvideoeditor/lvpp/NativeWindowRenderer.cpp index 702900b..84a8e15 100755 --- a/libvideoeditor/lvpp/NativeWindowRenderer.cpp +++ b/libvideoeditor/lvpp/NativeWindowRenderer.cpp @@ -568,7 +568,8 @@ void NativeWindowRenderer::destroyRenderInput(RenderInput* input) { RenderInput::RenderInput(NativeWindowRenderer* renderer, GLuint textureId) : mRenderer(renderer) , mTextureId(textureId) { - mST = new GLConsumer(mTextureId); + sp bq = new BufferQueue(); + mST = new GLConsumer(bq, mTextureId); mSTC = new Surface(mST->getBufferQueue()); native_window_connect(mSTC.get(), NATIVE_WINDOW_API_MEDIA); } diff --git a/services/camera/libcameraservice/camera2/CallbackProcessor.cpp b/services/camera/libcameraservice/camera2/CallbackProcessor.cpp index aae2504..efbbe57 100644 --- a/services/camera/libcameraservice/camera2/CallbackProcessor.cpp +++ b/services/camera/libcameraservice/camera2/CallbackProcessor.cpp @@ -110,7 +110,8 @@ status_t CallbackProcessor::updateStream(const Parameters ¶ms) { if (!mCallbackToApp && mCallbackConsumer == 0) { // Create CPU buffer queue endpoint, since app hasn't given us one // Make it async to avoid disconnect deadlocks - mCallbackConsumer = new CpuConsumer(kCallbackHeapCount, + sp bq = new BufferQueue(); + mCallbackConsumer = new CpuConsumer(bq, kCallbackHeapCount, /*synchronized*/ false); mCallbackConsumer->setFrameAvailableListener(this); mCallbackConsumer->setName(String8("Camera2Client::CallbackConsumer")); diff --git a/services/camera/libcameraservice/camera2/JpegProcessor.cpp b/services/camera/libcameraservice/camera2/JpegProcessor.cpp index f0a13ca..1d739cd 100644 --- a/services/camera/libcameraservice/camera2/JpegProcessor.cpp +++ b/services/camera/libcameraservice/camera2/JpegProcessor.cpp @@ -82,7 +82,8 @@ status_t JpegProcessor::updateStream(const Parameters ¶ms) { if (mCaptureConsumer == 0) { // Create CPU buffer queue endpoint - mCaptureConsumer = new CpuConsumer(1); + sp bq = new BufferQueue(); + mCaptureConsumer = new CpuConsumer(bq, 1); mCaptureConsumer->setFrameAvailableListener(this); mCaptureConsumer->setName(String8("Camera2Client::CaptureConsumer")); mCaptureWindow = new Surface( diff --git a/services/camera/libcameraservice/camera2/StreamingProcessor.cpp b/services/camera/libcameraservice/camera2/StreamingProcessor.cpp index 35eb433..76fa46c 100644 --- a/services/camera/libcameraservice/camera2/StreamingProcessor.cpp +++ b/services/camera/libcameraservice/camera2/StreamingProcessor.cpp @@ -319,7 +319,8 @@ status_t StreamingProcessor::updateRecordingStream(const Parameters ¶ms) { // Create CPU buffer queue endpoint. We need one more buffer here so that we can // always acquire and free a buffer when the heap is full; otherwise the consumer // will have buffers in flight we'll never clear out. - mRecordingConsumer = new BufferItemConsumer( + sp bq = new BufferQueue(); + mRecordingConsumer = new BufferItemConsumer(bq, GRALLOC_USAGE_HW_VIDEO_ENCODER, mRecordingHeapCount + 1, true); diff --git a/services/camera/libcameraservice/camera2/ZslProcessor.cpp b/services/camera/libcameraservice/camera2/ZslProcessor.cpp index 8af8276..3c575f6 100644 --- a/services/camera/libcameraservice/camera2/ZslProcessor.cpp +++ b/services/camera/libcameraservice/camera2/ZslProcessor.cpp @@ -128,7 +128,8 @@ status_t ZslProcessor::updateStream(const Parameters ¶ms) { if (mZslConsumer == 0) { // Create CPU buffer queue endpoint - mZslConsumer = new BufferItemConsumer( + sp bq = new BufferQueue(); + mZslConsumer = new BufferItemConsumer(bq, GRALLOC_USAGE_HW_CAMERA_ZSL, kZslBufferDepth, true); diff --git a/services/camera/libcameraservice/camera3/Camera3InputStream.cpp b/services/camera/libcameraservice/camera3/Camera3InputStream.cpp index 13e9c83..6d9acc3 100644 --- a/services/camera/libcameraservice/camera3/Camera3InputStream.cpp +++ b/services/camera/libcameraservice/camera3/Camera3InputStream.cpp @@ -211,7 +211,8 @@ status_t Camera3InputStream::configureQueueLocked() { mFrameCount = 0; if (mConsumer.get() == 0) { - mConsumer = new BufferItemConsumer(camera3_stream::usage, + sp bq = new BufferQueue(); + mConsumer = new BufferItemConsumer(bq, camera3_stream::usage, mTotalBufferCount, /*synchronousMode*/true); mConsumer->setName(String8::format("Camera3-InputStream-%d", mId)); -- cgit v1.1