diff options
author | Robert Shih <robertshih@google.com> | 2014-07-30 17:41:24 -0700 |
---|---|---|
committer | Robert Shih <robertshih@google.com> | 2014-07-31 11:04:54 -0700 |
commit | a298101317e5472f6b6a12e6ddeafdc4064bd5b2 (patch) | |
tree | ca05f65d99b30b045799216ded4502d04a3b765e | |
parent | 3423bbdb05f843a64356fa24e8657f03ecbb7d65 (diff) | |
download | frameworks_av-a298101317e5472f6b6a12e6ddeafdc4064bd5b2.zip frameworks_av-a298101317e5472f6b6a12e6ddeafdc4064bd5b2.tar.gz frameworks_av-a298101317e5472f6b6a12e6ddeafdc4064bd5b2.tar.bz2 |
NuPlayer: fix av discontinuity race
Assumption:
NuPlayer must see both (a/v) discontinuities before resuming.
Example issue:
Suppose we're changing the video track, so the video source queues a
DISCONTINUITY_FORMATCHANGE, and the audio source queues a DISCONTINUITY_NONE.
Consider this sequence of events without this change:
1. audio discontinuity seen by player
2. mFlushingAudio = FLUSHED
3. video discontinuity seen by player
4. mFlushingAudio != NONE so no performScanSources is queued
5. video decoding shuts down without being restarted
Bug: 15153976
Change-Id: I659550d9c0f883828103142abead857f576f25b1
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayer.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp index adc5f33..58d0138 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp @@ -1230,14 +1230,15 @@ status_t NuPlayer::feedDecoderInputData(bool audio, const sp<AMessage> &msg) { mTimeDiscontinuityPending = mTimeDiscontinuityPending || timeChange; + if (mFlushingAudio == NONE && mFlushingVideo == NONE) { + // And we'll resume scanning sources once we're done + // flushing. + mDeferredActions.push_front( + new SimpleAction( + &NuPlayer::performScanSources)); + } + if (formatChange || timeChange) { - if (mFlushingAudio == NONE && mFlushingVideo == NONE) { - // And we'll resume scanning sources once we're done - // flushing. - mDeferredActions.push_front( - new SimpleAction( - &NuPlayer::performScanSources)); - } sp<AMessage> newFormat = mSource->getFormat(audio); sp<Decoder> &decoder = audio ? mAudioDecoder : mVideoDecoder; |