Bug 1521370 - Always assume we can decode vp8/vp9. r=mattwoodrow
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 05 Mar 2019 15:01:38 +0000
changeset 520264 ae274634278fa08c629d11b98d1c14bf2baf70ee
parent 520263 ad6491a3248159b88e915c13de7e70af8babd568
child 520265 307b8e123debf65f7cbe58dcee28ef871747fbae
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1521370
milestone67.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 1521370 - Always assume we can decode vp8/vp9. r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D21478
dom/media/platforms/PDMFactory.cpp
--- a/dom/media/platforms/PDMFactory.cpp
+++ b/dom/media/platforms/PDMFactory.cpp
@@ -314,16 +314,24 @@ bool PDMFactory::SupportsMimeType(
   return Supports(*trackInfo, aDiagnostics);
 }
 
 bool PDMFactory::Supports(const TrackInfo& aTrackInfo,
                           DecoderDoctorDiagnostics* aDiagnostics) const {
   if (mEMEPDM) {
     return mEMEPDM->Supports(aTrackInfo, aDiagnostics);
   }
+  if (VPXDecoder::IsVPX(aTrackInfo.mMimeType,
+                        VPXDecoder::VP8 | VPXDecoder::VP9)) {
+    // Work around bug 1521370, where trying to instantiate an external decoder
+    // could cause a crash.
+    // We always ship a VP8/VP9 decoder (libvpx) and optionally we have ffvpx.
+    // So we can speed up the test by assuming that this codec is supported.
+    return true;
+  }
   RefPtr<PlatformDecoderModule> current = GetDecoder(aTrackInfo, aDiagnostics);
   return !!current;
 }
 
 void PDMFactory::CreatePDMs() {
   RefPtr<PlatformDecoderModule> m;
 
   if (StaticPrefs::MediaUseBlankDecoder()) {