diff --git a/dom/media/mediasource/MediaSourceReader.cpp b/dom/media/mediasource/MediaSourceReader.cpp index 59229c9539ff..0ac95ae8dd0e 100644 --- a/dom/media/mediasource/MediaSourceReader.cpp +++ b/dom/media/mediasource/MediaSourceReader.cpp @@ -508,6 +508,7 @@ MediaSourceReader::SwitchAudioSource(int64_t* aTarget) return SOURCE_EXISTING; } mAudioSourceDecoder = newDecoder; + GetAudioReader()->ResetDecode(); if (usedFuzz) { // A decoder buffered range is continuous. We would have failed the exact // search but succeeded the fuzzy one if our target was shortly before @@ -554,6 +555,7 @@ MediaSourceReader::SwitchVideoSource(int64_t* aTarget) return SOURCE_EXISTING; } mVideoSourceDecoder = newDecoder; + GetVideoReader()->ResetDecode(); if (usedFuzz) { // A decoder buffered range is continuous. We would have failed the exact // search but succeeded the fuzzy one if our target was shortly before @@ -810,6 +812,7 @@ MediaSourceReader::OnVideoSeekFailed(nsresult aResult) void MediaSourceReader::DoAudioSeek() { + GetAudioReader()->ResetDecode(); if (SwitchAudioSource(&mPendingSeekTime) == SOURCE_NONE) { // Data we need got evicted since the last time we checked for data // availability. Abort current seek attempt. @@ -860,9 +863,6 @@ MediaSourceReader::AttemptSeek() } ResetDecode(); - for (uint32_t i = 0; i < mTrackBuffers.Length(); ++i) { - mTrackBuffers[i]->ResetDecode(); - } // Decoding discontinuity upon seek, reset last times to seek target. mLastAudioTime = mPendingSeekTime; @@ -880,6 +880,7 @@ MediaSourceReader::AttemptSeek() void MediaSourceReader::DoVideoSeek() { + GetVideoReader()->ResetDecode(); if (SwitchVideoSource(&mPendingSeekTime) == SOURCE_NONE) { // Data we need got evicted since the last time we checked for data // availability. Abort current seek attempt. diff --git a/dom/media/mediasource/TrackBuffer.cpp b/dom/media/mediasource/TrackBuffer.cpp index 976846732911..1ac8328790e7 100644 --- a/dom/media/mediasource/TrackBuffer.cpp +++ b/dom/media/mediasource/TrackBuffer.cpp @@ -839,14 +839,6 @@ TrackBuffer::BreakCycles() MOZ_ASSERT(!mParentDecoder); } -void -TrackBuffer::ResetDecode() -{ - for (uint32_t i = 0; i < mDecoders.Length(); ++i) { - mDecoders[i]->GetReader()->ResetDecode(); - } -} - void TrackBuffer::ResetParserState() { diff --git a/dom/media/mediasource/TrackBuffer.h b/dom/media/mediasource/TrackBuffer.h index 45d0ebcd8d3b..8d778e616822 100644 --- a/dom/media/mediasource/TrackBuffer.h +++ b/dom/media/mediasource/TrackBuffer.h @@ -81,9 +81,6 @@ public: void BreakCycles(); - // Call ResetDecode() on each decoder in mDecoders. - void ResetDecode(); - // Run MSE Reset Parser State Algorithm. // 3.5.2 Reset Parser State // http://w3c.github.io/media-source/#sourcebuffer-reset-parser-state