diff options
author | Li Sun <sunli@codeaurora.org> | 2015-12-09 18:28:10 +0530 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-03-08 22:37:17 -0800 |
commit | 1aedff94c6f52223f8720edbce16c80ad1b57b00 (patch) | |
tree | f8ef8bb21b485c1d33d28b715dc325874a356906 /media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp | |
parent | 97fc248733b43731e1e2d98de5dad47a490dbbc2 (diff) | |
download | frameworks_av-1aedff94c6f52223f8720edbce16c80ad1b57b00.zip frameworks_av-1aedff94c6f52223f8720edbce16c80ad1b57b00.tar.gz frameworks_av-1aedff94c6f52223f8720edbce16c80ad1b57b00.tar.bz2 |
Nuplayer: Flush the decoder if seamless format change is supported
In smooth streaming enabled case, flush the decoder
if seamless format change is supported.
Otherwise,ramdomly video frames with old resolution
are queued to the new surface and results in green frames.
Calling flush ensures that all the old video frames
are cleared.
Change-Id: Ia020a01fd0eaa8af8e48b6edb526a3f53875b068
Diffstat (limited to 'media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp index c505096..a18e1da 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp @@ -73,6 +73,7 @@ NuPlayer::Decoder::Decoder( mIsSecure(false), mFormatChangePending(false), mTimeChangePending(false), + mVideoFormatChangeDoFlushOnly(false), mResumePending(false), mComponentName("decoder") { mCodecLooper = new ALooper; @@ -243,6 +244,7 @@ void NuPlayer::Decoder::onConfigure(const sp<AMessage> &format) { mFormatChangePending = false; mTimeChangePending = false; + mVideoFormatChangeDoFlushOnly = false; ++mBufferGeneration; @@ -759,9 +761,20 @@ status_t NuPlayer::Decoder::fetchInputData(sp<AMessage> &reply) { mTimeChangePending = true; err = ERROR_END_OF_STREAM; } else if (seamlessFormatChange) { - // reuse existing decoder and don't flush - rememberCodecSpecificData(newFormat); - continue; + if (!mIsAudio && + newFormat != NULL && + newFormat->contains("prefer-adaptive-playback")) { + ALOGV("in smooth streaming mode, " + "do video flush in video seamless format change"); + mFormatChangePending = true; + mVideoFormatChangeDoFlushOnly = true; + err = ERROR_END_OF_STREAM; + } else { + // reuse existing decoder and don't flush + rememberCodecSpecificData(newFormat); + continue; + } + } else { // This stream is unaffected by the discontinuity return -EWOULDBLOCK; @@ -989,10 +1002,14 @@ void NuPlayer::Decoder::finishHandleDiscontinuity(bool flushOnTimeChange) { sp<AMessage> msg = mNotify->dup(); msg->setInt32("what", kWhatInputDiscontinuity); msg->setInt32("formatChange", mFormatChangePending); + if (mVideoFormatChangeDoFlushOnly) { + msg->setInt32("video-seamlessChange", mVideoFormatChangeDoFlushOnly); + } msg->post(); mFormatChangePending = false; mTimeChangePending = false; + mVideoFormatChangeDoFlushOnly = false; } bool NuPlayer::Decoder::supportsSeamlessAudioFormatChange( |