Bug 1237809: P3. Ensure element dimensions are up to date. r=jwwang a=sylvestre
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 12 Jan 2016 21:09:37 +1100
changeset 310829 5fc729fa21d127794c39fe1e076e8661407319be
parent 310828 b5e456f2848e21ac1aa56a9f348415844795d857
child 310830 5f72d47564e39c1f5334d8bed60c149891a040dd
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang, sylvestre
bugs1237809
milestone45.0a2
Bug 1237809: P3. Ensure element dimensions are up to date. r=jwwang a=sylvestre The VideoContainer contains more up to date video size information than the MediaInfo received by MediaDecoder::MetadataLoaded
dom/media/MediaDecoder.cpp
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -867,21 +867,26 @@ MediaDecoder::MetadataLoaded(nsAutoPtr<M
               aInfo->HasAudio(), aInfo->HasVideo());
 
   SetMediaSeekable(aInfo->mMediaSeekable);
   mInfo = aInfo.forget();
   ConstructMediaTracks();
 
   // 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<const MetadataTags>(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();
 }
 
 void
 MediaDecoder::EnsureTelemetryReported()
 {
   MOZ_ASSERT(NS_IsMainThread());