From b6ea1292f8adae45d95c6f37d50c96534219b6d2 Mon Sep 17 00:00:00 2001 From: Wei Jia Date: Thu, 7 May 2015 18:08:27 -0700 Subject: MediaSync: support changing surface on the fly. Bug: 19666434 Change-Id: I5809df2d3bb0dd6b4a982f11d62c4b7a452ed6fb --- include/media/stagefright/MediaSync.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/media/stagefright/MediaSync.h b/include/media/stagefright/MediaSync.h index d1d634d..1eef211 100644 --- a/include/media/stagefright/MediaSync.h +++ b/include/media/stagefright/MediaSync.h @@ -169,7 +169,7 @@ private: class OutputListener : public BnProducerListener, public IBinder::DeathRecipient { public: - OutputListener(const sp &sync); + OutputListener(const sp &sync, const sp &output); virtual ~OutputListener(); // From IProducerListener @@ -180,6 +180,7 @@ private: private: sp mSync; + sp mOutput; }; // mIsAbandoned is set to true when the input or output dies. @@ -192,6 +193,7 @@ private: size_t mNumOutstandingBuffers; sp mInput; sp mOutput; + int mUsageFlagsFromOutput; sp mAudioTrack; uint32_t mNativeSampleRateInHz; @@ -207,6 +209,12 @@ private: // and that could cause problem if the producer of |mInput| only // supports pre-registered buffers. KeyedVector > mBuffersFromInput; + + // Keep track of buffers sent to |mOutput|. When a new output surface comes + // in, those buffers will be returned to input and old output surface will + // be disconnected immediately. + KeyedVector > mBuffersSentToOutput; + sp mLooper; float mPlaybackRate; @@ -241,7 +249,7 @@ private: // It gets called from an OutputListener. // During this callback, we detach the buffer from the output, and release // it to the input. A blocked onFrameAvailable call will be allowed to proceed. - void onBufferReleasedByOutput(); + void onBufferReleasedByOutput(sp &output); // Return |buffer| back to the input. void returnBufferToInput_l(const sp &buffer, const sp &fence); -- cgit v1.1