Bug 1321076 - PDMFactory defaults to using VPXDecoder when alpha is present. r=jya draft
authorkaro <kkoorts@mozilla.com>
Wed, 21 Dec 2016 15:00:17 +1300
changeset 452674 a2b4bad848c6350041c2cff805803fb5728342d2
parent 452673 a287670aa62949e8811f678810eb3ac5e3acdbe3
child 452675 572dbf59e8a3b41e6c7366d1579a28e365062260
push id39448
push userbmo:kkoorts@mozilla.com
push dateThu, 22 Dec 2016 00:02:10 +0000
reviewersjya
bugs1321076
milestone53.0a1
Bug 1321076 - PDMFactory defaults to using VPXDecoder when alpha is present. r=jya FFmpegDecoderModule and AndroidDecoderModule returns nullptr if alpha is present, then PDMFactory rolls over to using VPXDecoder. MozReview-Commit-ID: H2JaolEfJgR
dom/media/platforms/android/AndroidDecoderModule.cpp
dom/media/platforms/ffmpeg/FFmpegDecoderModule.h
--- a/dom/media/platforms/android/AndroidDecoderModule.cpp
+++ b/dom/media/platforms/android/AndroidDecoderModule.cpp
@@ -169,16 +169,23 @@ AndroidDecoderModule::SupportsMimeType(c
 
   return java::HardwareCodecCapabilityUtils::FindDecoderCodecInfoForMimeType(
       nsCString(TranslateMimeType(aMimeType)));
 }
 
 already_AddRefed<MediaDataDecoder>
 AndroidDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
 {
+  // Temporary - forces use of VPXDecoder when alpha is present.
+  // Bug 1263836 will handle alpha scenario once implemented. It will shift
+  // the check for alpha to PDMFactory but not itself remove the need for a
+  // check.
+  if (aParams.VideoConfig().HasAlpha()) {
+    return nullptr;
+  }
   MediaFormat::LocalRef format;
 
   const VideoInfo& config = aParams.VideoConfig();
   NS_ENSURE_SUCCESS(MediaFormat::CreateVideoFormat(
       TranslateMimeType(config.mMimeType),
       config.mDisplay.width,
       config.mDisplay.height,
       &format), nullptr);
--- a/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h
+++ b/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h
@@ -28,16 +28,23 @@ public:
   }
 
   explicit FFmpegDecoderModule(FFmpegLibWrapper* aLib) : mLib(aLib) {}
   virtual ~FFmpegDecoderModule() {}
 
   already_AddRefed<MediaDataDecoder>
   CreateVideoDecoder(const CreateDecoderParams& aParams) override
   {
+    // Temporary - forces use of VPXDecoder when alpha is present.
+    // Bug 1263836 will handle alpha scenario once implemented. It will shift
+    // the check for alpha to PDMFactory but not itself remove the need for a
+    // check.
+    if (aParams.VideoConfig().HasAlpha()) {
+      return nullptr;
+    }
     RefPtr<MediaDataDecoder> decoder =
       new FFmpegVideoDecoder<V>(mLib,
                                 aParams.mTaskQueue,
                                 aParams.mCallback,
                                 aParams.VideoConfig(),
                                 aParams.mImageContainer);
     return decoder.forget();
   }