Bug 1368662: Better fix for
bug 1345898. r?gerald
In
bug 1345898, we flushed the decoder rather than draining it when we are waiting for data.
However, more accurately we are in the middle of an internal seek.
There are more occasions during which we could be performing an internal seek during which we don't care about the frames being decoded. So flushing is better.
MozReview-Commit-ID: ATpTFdp8mRL
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -2014,19 +2014,19 @@ MediaFormatReader::HandleDemuxedSamples(
while (decoder.mQueuedSamples.Length()) {
RefPtr<MediaRawData> sample = decoder.mQueuedSamples[0];
RefPtr<TrackInfoSharedPtr> info = sample->mTrackInfo;
if (info && decoder.mLastStreamSourceID != info->GetID()) {
bool recyclable = MediaPrefs::MediaDecoderCheckRecycling()
&& decoder.mDecoder->SupportDecoderRecycling();
if (!recyclable
+ && decoder.mTimeThreshold.isNothing()
&& (decoder.mNextStreamSourceID.isNothing()
- || decoder.mNextStreamSourceID.ref() != info->GetID())
- && !decoder.HasWaitingPromise()) {
+ || decoder.mNextStreamSourceID.ref() != info->GetID())) {
LOG("%s stream id has changed from:%d to:%d, draining decoder.",
TrackTypeToStr(aTrack), decoder.mLastStreamSourceID,
info->GetID());
decoder.RequestDrain();
decoder.mNextStreamSourceID = Some(info->GetID());
ScheduleUpdate(aTrack);
return;
}