diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index b63a79a430be..d79c9e1c7fc4 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -872,11 +872,16 @@ MediaDecoder::MetadataLoaded(nsAutoPtr aInfo, // Make sure the element and the frame (if any) are told about // our new size. - Invalidate(); if (aEventVisibility != MediaDecoderEventVisibility::Suppressed) { mFiredMetadataLoaded = true; mOwner->MetadataLoaded(mInfo, nsAutoPtr(aTags.forget())); } + // Invalidate() will end up calling mOwner->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 mOwner->MetadataLoaded to ensure + // the media element has the latest dimensions. + Invalidate(); EnsureTelemetryReported(); }