Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2981013 authored by Robert Shih's avatar Robert Shih
Browse files

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
parent 3423bbdb
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -1230,7 +1230,6 @@ status_t NuPlayer::feedDecoderInputData(bool audio, const sp<AMessage> &msg) {
                mTimeDiscontinuityPending =
                    mTimeDiscontinuityPending || timeChange;

                if (formatChange || timeChange) {
                if (mFlushingAudio == NONE && mFlushingVideo == NONE) {
                    // And we'll resume scanning sources once we're done
                    // flushing.
@@ -1239,6 +1238,8 @@ status_t NuPlayer::feedDecoderInputData(bool audio, const sp<AMessage> &msg) {
                                &NuPlayer::performScanSources));
                }

                if (formatChange || timeChange) {

                    sp<AMessage> newFormat = mSource->getFormat(audio);
                    sp<Decoder> &decoder = audio ? mAudioDecoder : mVideoDecoder;
                    if (formatChange && !decoder->supportsSeamlessFormatChange(newFormat)) {