From f15a29610dd897d24c56e789f6651010ba39fb8b Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Wed, 27 Apr 2016 17:35:58 +1000 Subject: [PATCH] Bug 1267637: P2. Ignore outright audio track considered invalid. r=gerald MozReview-Commit-ID: 6rMz8cjgLiY --HG-- extra : rebase_source : 9e006f0125d9d3c786d64aae5f521f8239bbae8b --- dom/media/MediaFormatReader.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index bde842f7e581..9ce80a7afb3a 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -303,14 +303,21 @@ MediaFormatReader::OnDemuxerInitDone(nsresult) mMetadataPromise.Reject(ReadMetadataFailureReason::METADATA_ERROR, __func__); return; } - mInfo.mAudio = *mAudio.mTrackDemuxer->GetInfo()->GetAsAudioInfo(); - UniquePtr info(mAudio.mTrackDemuxer->GetInfo()); - for (const MetadataTag& tag : info->mTags) { - tags->Put(tag.mKey, tag.mValue); + UniquePtr audioInfo = mAudio.mTrackDemuxer->GetInfo(); + // We actively ignore audio tracks that we know we can't play. + audioActive = audioInfo && audioInfo->IsValid(); + if (audioActive) { + mInfo.mAudio = *audioInfo->GetAsAudioInfo(); + for (const MetadataTag& tag : audioInfo->mTags) { + tags->Put(tag.mKey, tag.mValue); + } + mAudio.mCallback = new DecoderCallback(this, TrackInfo::kAudioTrack); + mAudio.mTimeRanges = mAudio.mTrackDemuxer->GetBuffered(); + mTrackDemuxersMayBlock |= mAudio.mTrackDemuxer->GetSamplesMayBlock(); + } else { + mAudio.mTrackDemuxer->BreakCycles(); + mAudio.mTrackDemuxer = nullptr; } - mAudio.mCallback = new DecoderCallback(this, TrackInfo::kAudioTrack); - mAudio.mTimeRanges = mAudio.mTrackDemuxer->GetBuffered(); - mTrackDemuxersMayBlock |= mAudio.mTrackDemuxer->GetSamplesMayBlock(); } UniquePtr crypto = mDemuxer->GetCrypto();