From f507668c63c98a669b2887855a809dc19a542d98 Mon Sep 17 00:00:00 2001 From: JW Wang Date: Tue, 25 Jul 2017 14:34:59 +0800 Subject: [PATCH] Bug 1382557 - the duration should be finite when we can get one from the metadata. r=cpearce This fixes the case where ChannelMediaResource::OnStartRequest() calls mCallback->SetInfinite(true) to report an infinite duration, yet later we get another duratoin from the metadata. http://searchfox.org/mozilla-central/rev/8a61c71153a79cda2e1ae7d477564347c607cc5f/dom/media/MediaDecoder.cpp#1179-1185 Note IsInfinite() is checked before other duration sources. We need to call SetInfinite(false) on the MediaDecoder so we can get the correct duration. MozReview-Commit-ID: 3BlFNJzlgXo --HG-- extra : rebase_source : 073b65cbc21f280638054b80f0cc9913a9128a18 --- dom/media/MediaDecoder.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index b9d0fd99c04a..bf41cf94b551 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -763,6 +763,11 @@ MediaDecoder::MetadataLoaded(UniquePtr aInfo, Invalidate(); EnsureTelemetryReported(); + + // The duration is no longer infinite when we get one from the metadata. + if (mInfo->mMetadataDuration && IsInfinite()) { + SetInfinite(false); + } } void