Bug 1163814 - Only check if we can create decoder in MP4Decoder::CanCreate*Decoder() on Windows. r=mattwoodrow, a=lmandel
authorChris Pearce <cpearce@mozilla.com>
Fri, 15 May 2015 03:27:00 +0200
changeset 267524 b7ddc9e56c29303a9d0a27b41b54aea3b0995c21
parent 267523 a2e16743fb0b99cca889aaf4c7e355f4436f8985
child 267525 ea16f4f58db4680d047ac2d4323191cb30ac7dd4
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, lmandel
bugs1163814
milestone39.0
Bug 1163814 - Only check if we can create decoder in MP4Decoder::CanCreate*Decoder() on Windows. r=mattwoodrow, a=lmandel
dom/media/fmp4/MP4Decoder.cpp
--- a/dom/media/fmp4/MP4Decoder.cpp
+++ b/dom/media/fmp4/MP4Decoder.cpp
@@ -236,16 +236,17 @@ HavePlatformMPEGDecoders()
 /* static */
 bool
 MP4Decoder::IsEnabled()
 {
   return Preferences::GetBool("media.fragmented-mp4.enabled") &&
          HavePlatformMPEGDecoders();
 }
 
+#ifdef XP_WIN
 static const uint8_t sTestH264ExtraData[] = {
   0x01, 0x64, 0x00, 0x0a, 0xff, 0xe1, 0x00, 0x17, 0x67, 0x64,
   0x00, 0x0a, 0xac, 0xd9, 0x44, 0x26, 0x84, 0x00, 0x00, 0x03,
   0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0xc8, 0x3c, 0x48, 0x96,
   0x58, 0x01, 0x00, 0x06, 0x68, 0xeb, 0xe3, 0xcb, 0x22, 0xc0
 };
 
 static already_AddRefed<MediaDataDecoder>
@@ -268,36 +269,42 @@ CreateTestH264Decoder(layers::LayersBack
   if (!decoder) {
     return nullptr;
   }
   nsresult rv = decoder->Init();
   NS_ENSURE_SUCCESS(rv, nullptr);
 
   return decoder.forget();
 }
+#endif
 
 /* static */ bool
 MP4Decoder::CanCreateH264Decoder()
 {
+#ifdef XP_WIN
   static bool haveCachedResult = false;
   static bool result = false;
   if (haveCachedResult) {
     return result;
   }
   mp4_demuxer::VideoDecoderConfig config;
   nsRefPtr<MediaDataDecoder> decoder(
     CreateTestH264Decoder(layers::LayersBackend::LAYERS_BASIC, config));
   if (decoder) {
     decoder->Shutdown();
     result = true;
   }
   haveCachedResult = true;
   return result;
+#else
+  return IsEnabled();
+#endif
 }
 
+#ifdef XP_WIN
 static already_AddRefed<MediaDataDecoder>
 CreateTestAACDecoder(mp4_demuxer::AudioDecoderConfig& aConfig)
 {
   PlatformDecoderModule::Init();
 
   nsRefPtr<PlatformDecoderModule> platform = PlatformDecoderModule::Create();
   if (!platform) {
     return nullptr;
@@ -319,19 +326,22 @@ static const uint8_t sTestAACExtraData[]
   0x03, 0x80, 0x80, 0x80, 0x22, 0x00, 0x02, 0x00, 0x04, 0x80,
   0x80, 0x80, 0x14, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x11, 0x51, 0x00, 0x00, 0x11, 0x51, 0x05, 0x80, 0x80, 0x80,
   0x02, 0x13, 0x90, 0x06, 0x80, 0x80, 0x80, 0x01, 0x02
 };
 
 static const uint8_t sTestAACConfig[] = { 0x13, 0x90 };
 
+#endif // XP_WIN
+
 /* static */ bool
 MP4Decoder::CanCreateAACDecoder()
 {
+#ifdef XP_WIN
   static bool haveCachedResult = false;
   static bool result = false;
   if (haveCachedResult) {
     return result;
   }
   mp4_demuxer::AudioDecoderConfig config;
   config.mime_type = "audio/mp4a-latm";
   config.samples_per_second = 22050;
@@ -345,11 +355,14 @@ MP4Decoder::CanCreateAACDecoder()
                                     MOZ_ARRAY_LENGTH(sTestAACExtraData));
   nsRefPtr<MediaDataDecoder> decoder(CreateTestAACDecoder(config));
   if (decoder) {
     decoder->Shutdown();
     result = true;
   }
   haveCachedResult = true;
   return result;
+#else
+  return IsEnabled();
+#endif
 }
 
 } // namespace mozilla