Bug 1497951 - P7. Check for in-band profile VP9 change, r=bryce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 07 Nov 2018 13:50:15 +0000
changeset 444871 f91c9161f99367afdcbca161f0274aa892cd2bbc
parent 444870 4e832384a4643c4c0fd39148a9ec6374c4f2092b
child 444872 9d9cc09cded03874e66ea6bb2133394810452274
push id72528
push userjyavenard@mozilla.com
push dateWed, 07 Nov 2018 15:10:53 +0000
treeherderautoland@f91c9161f993 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbryce
bugs1497951
milestone65.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 1497951 - P7. Check for in-band profile VP9 change, r=bryce Because why not... Depends on D10913 Differential Revision: https://phabricator.services.mozilla.com/D10914
dom/media/platforms/wrappers/MediaChangeMonitor.cpp
--- a/dom/media/platforms/wrappers/MediaChangeMonitor.cpp
+++ b/dom/media/platforms/wrappers/MediaChangeMonitor.cpp
@@ -161,27 +161,32 @@ public:
       return NS_OK;
     }
     // For both VP8 and VP9, we only look for resolution changes
     // on keyframes. Other resolution changes are invalid.
     if (!aSample->mKeyframe) {
       return NS_OK;
     }
 
-    auto dimensions = VPXDecoder::GetFrameSize(
-      MakeSpan<const uint8_t>(aSample->Data(), aSample->Size()), mCodec);
+    auto dataSpan = MakeSpan<const uint8_t>(aSample->Data(), aSample->Size());
+    auto dimensions = VPXDecoder::GetFrameSize(dataSpan, mCodec);
+    int profile = mCodec == VPXDecoder::Codec::VP9
+                    ? VPXDecoder::GetVP9Profile(dataSpan)
+                    : 0;
 
     if (!mSize) {
       mSize = Some(dimensions);
+      mProfile = Some(profile);
       return NS_OK;
     }
-    if (mSize.ref() == dimensions) {
+    if (mSize.ref() == dimensions && mProfile.ref() == profile) {
       return NS_OK;
     }
     mSize = Some(dimensions);
+    mProfile = Some(profile);
     mCurrentConfig.mDisplay = dimensions;
 
     return NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER;
   }
 
   const TrackInfo& Config() const override
   {
     return mCurrentConfig;
@@ -192,16 +197,17 @@ public:
   {
     return NS_OK;
   }
 
   private:
     VideoInfo mCurrentConfig;
     const VPXDecoder::Codec mCodec;
     Maybe<gfx::IntSize> mSize;
+    Maybe<int> mProfile;
 };
 
 MediaChangeMonitor::MediaChangeMonitor(PlatformDecoderModule* aPDM,
                                        const CreateDecoderParams& aParams)
   : mPDM(aPDM)
   , mCurrentConfig(aParams.VideoConfig())
   , mKnowsCompositor(aParams.mKnowsCompositor)
   , mImageContainer(aParams.mImageContainer)