Bug 1382557 - the duration should be finite when we can get one from the metadata.
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
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -758,16 +758,21 @@ MediaDecoder::MetadataLoaded(UniquePtr<M
// Invalidate() will end up calling GetOwner()->UpdateMediaSize with the last
// dimensions retrieved from the video frame container. The video frame
// container contains more up to date dimensions than aInfo.
// So we call Invalidate() after calling GetOwner()->MetadataLoaded to ensure
// the media element has the latest dimensions.
Invalidate();
EnsureTelemetryReported();
+
+ // The duration is no longer infinite when we get one from the metadata.
+ if (mInfo->mMetadataDuration && IsInfinite()) {
+ SetInfinite(false);
+ }
}
void
MediaDecoder::EnsureTelemetryReported()
{
MOZ_ASSERT(NS_IsMainThread());
if (mTelemetryReported || !mInfo) {