diff options
Diffstat (limited to 'cmds/screenrecord')
-rw-r--r-- | cmds/screenrecord/FrameOutput.cpp | 8 | ||||
-rw-r--r-- | cmds/screenrecord/FrameOutput.h | 12 | ||||
-rw-r--r-- | cmds/screenrecord/Overlay.cpp | 9 | ||||
-rw-r--r-- | cmds/screenrecord/Overlay.h | 10 |
4 files changed, 21 insertions, 18 deletions
diff --git a/cmds/screenrecord/FrameOutput.cpp b/cmds/screenrecord/FrameOutput.cpp index 6c37501..4da16bc 100644 --- a/cmds/screenrecord/FrameOutput.cpp +++ b/cmds/screenrecord/FrameOutput.cpp @@ -67,8 +67,10 @@ status_t FrameOutput::createInputSurface(int width, int height, return UNKNOWN_ERROR; } - mBufferQueue = new BufferQueue(/*new GraphicBufferAlloc()*/); - mGlConsumer = new GLConsumer(mBufferQueue, mExtTextureName, + sp<IGraphicBufferProducer> producer; + sp<IGraphicBufferConsumer> consumer; + BufferQueue::createBufferQueue(&producer, &consumer); + mGlConsumer = new GLConsumer(consumer, mExtTextureName, GL_TEXTURE_EXTERNAL_OES); mGlConsumer->setName(String8("virtual display")); mGlConsumer->setDefaultBufferSize(width, height); @@ -79,7 +81,7 @@ status_t FrameOutput::createInputSurface(int width, int height, mPixelBuf = new uint8_t[width * height * kGlBytesPerPixel]; - *pBufferProducer = mBufferQueue; + *pBufferProducer = producer; ALOGD("FrameOutput::createInputSurface OK"); return NO_ERROR; diff --git a/cmds/screenrecord/FrameOutput.h b/cmds/screenrecord/FrameOutput.h index 4ac3e8a..c49ec3b 100644 --- a/cmds/screenrecord/FrameOutput.h +++ b/cmds/screenrecord/FrameOutput.h @@ -34,9 +34,6 @@ public: mExtTextureName(0), mPixelBuf(NULL) {} - virtual ~FrameOutput() { - delete[] mPixelBuf; - } // Create an "input surface", similar in purpose to a MediaCodec input // surface, that the virtual display can send buffers to. Also configures @@ -59,6 +56,11 @@ private: FrameOutput(const FrameOutput&); FrameOutput& operator=(const FrameOutput&); + // Destruction via RefBase. + virtual ~FrameOutput() { + delete[] mPixelBuf; + } + // (overrides GLConsumer::FrameAvailableListener method) virtual void onFrameAvailable(); @@ -75,10 +77,6 @@ private: // Set by the FrameAvailableListener callback. bool mFrameAvailable; - // Our queue. The producer side is passed to the virtual display, the - // consumer side feeds into our GLConsumer. - sp<BufferQueue> mBufferQueue; - // This receives frames from the virtual display and makes them available // as an external texture. sp<GLConsumer> mGlConsumer; diff --git a/cmds/screenrecord/Overlay.cpp b/cmds/screenrecord/Overlay.cpp index 2e98874..94f560d 100644 --- a/cmds/screenrecord/Overlay.cpp +++ b/cmds/screenrecord/Overlay.cpp @@ -84,7 +84,7 @@ status_t Overlay::start(const sp<IGraphicBufferProducer>& outputSurface, assert(mState == RUNNING); ALOGV("Overlay::start successful"); - *pBufferProducer = mBufferQueue; + *pBufferProducer = mProducer; return NO_ERROR; } @@ -169,8 +169,9 @@ status_t Overlay::setup_l() { return UNKNOWN_ERROR; } - mBufferQueue = new BufferQueue(/*new GraphicBufferAlloc()*/); - mGlConsumer = new GLConsumer(mBufferQueue, mExtTextureName, + sp<IGraphicBufferConsumer> consumer; + BufferQueue::createBufferQueue(&mProducer, &consumer); + mGlConsumer = new GLConsumer(consumer, mExtTextureName, GL_TEXTURE_EXTERNAL_OES); mGlConsumer->setName(String8("virtual display")); mGlConsumer->setDefaultBufferSize(width, height); @@ -187,7 +188,7 @@ void Overlay::release_l() { ALOGV("Overlay::release_l"); mOutputSurface.clear(); mGlConsumer.clear(); - mBufferQueue.clear(); + mProducer.clear(); mTexProgram.release(); mExtTexProgram.release(); diff --git a/cmds/screenrecord/Overlay.h b/cmds/screenrecord/Overlay.h index b8473b4..b1b5c29 100644 --- a/cmds/screenrecord/Overlay.h +++ b/cmds/screenrecord/Overlay.h @@ -47,7 +47,6 @@ public: mLastFrameNumber(-1), mTotalDroppedFrames(0) {} - virtual ~Overlay() { assert(mState == UNINITIALIZED || mState == STOPPED); } // Creates a thread that performs the overlay. Pass in the surface that // output will be sent to. @@ -71,6 +70,9 @@ private: Overlay(const Overlay&); Overlay& operator=(const Overlay&); + // Destruction via RefBase. + virtual ~Overlay() { assert(mState == UNINITIALIZED || mState == STOPPED); } + // Draw the initial info screen. static void doDrawInfoPage(const EglWindow& window, const Program& texRender, TextRenderer& textRenderer); @@ -120,9 +122,9 @@ private: // surface. sp<IGraphicBufferProducer> mOutputSurface; - // Our queue. The producer side is passed to the virtual display, the - // consumer side feeds into our GLConsumer. - sp<BufferQueue> mBufferQueue; + // Producer side of queue, passed into the virtual display. + // The consumer end feeds into our GLConsumer. + sp<IGraphicBufferProducer> mProducer; // This receives frames from the virtual display and makes them available // as an external texture. |