Bug 1540581 - P10. Pass colorspace data with first VP9 frame seen. r=bryce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 11 Apr 2019 12:37:38 +0000
changeset 469155 cf9c8ae660ddbc7711844d943097b7ad53edc2d6
parent 469154 89bd3aee893e45ed10f08bf1d558d4dd03a13d06
child 469156 bfef6e9e74d53eaa3ef44f27498f31c2b5aee34f
push id82995
push userjyavenard@mozilla.com
push dateThu, 11 Apr 2019 23:28:35 +0000
treeherderautoland@ee00c85b09c5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbryce
bugs1540581
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1540581 - P10. Pass colorspace data with first VP9 frame seen. r=bryce The info would only be passed after the 2nd keyframe Differential Revision: https://phabricator.services.mozilla.com/D26465
dom/media/platforms/wrappers/MediaChangeMonitor.cpp
--- a/dom/media/platforms/wrappers/MediaChangeMonitor.cpp
+++ b/dom/media/platforms/wrappers/MediaChangeMonitor.cpp
@@ -169,34 +169,37 @@ class VPXChangeMonitor : public MediaCha
 
     auto dataSpan = MakeSpan<const uint8_t>(aSample->Data(), aSample->Size());
 
     VPXDecoder::VPXStreamInfo info;
     if (!VPXDecoder::GetStreamInfo(dataSpan, info, mCodec)) {
       return NS_ERROR_DOM_MEDIA_DECODE_ERR;
     }
 
-    if (!mInfo) {
-      mInfo = Some(info);
-      return NS_OK;
-    }
-    if (mInfo.ref().IsCompatible(info)) {
-      return NS_OK;
+    nsresult rv = NS_OK;
+    if (mInfo) {
+      if (mInfo.ref().IsCompatible(info)) {
+        return rv;
+      }
+      mCurrentConfig.mImage = info.mImage;
+      mCurrentConfig.mDisplay = info.mDisplay;
+      mCurrentConfig.SetImageRect(
+          gfx::IntRect(0, 0, info.mImage.width, info.mImage.height));
+      rv = NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER;
     }
     mInfo = Some(info);
-    mCurrentConfig.mImage = info.mImage;
-    mCurrentConfig.mDisplay = info.mDisplay;
-    mCurrentConfig.SetImageRect(
-        gfx::IntRect(0, 0, info.mImage.width, info.mImage.height));
+    // For the first frame, we leave the mDisplay/mImage untouched as they
+    // contain aspect ratio (AR) information set by the demuxer.
+    // The AR data isn't found in the VP8/VP9 bytestream.
     mCurrentConfig.mColorDepth = gfx::ColorDepthForBitDepth(info.mBitDepth);
     mCurrentConfig.mColorSpace = info.ColorSpace();
     mCurrentConfig.mFullRange = info.mFullRange;
     mTrackInfo = new TrackInfoSharedPtr(mCurrentConfig, mStreamID++);
 
-    return NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER;
+    return rv;
   }
 
   const TrackInfo& Config() const override { return mCurrentConfig; }
 
   MediaResult PrepareSample(MediaDataDecoder::ConversionRequired aConversion,
                             MediaRawData* aSample,
                             bool aNeedKeyFrame) override {
     aSample->mTrackInfo = mTrackInfo;