Bug 1205083 - Don't enable low latency WMF video decoding as it crashes sometimes. r=jya, a=sylvestre
authorChris Pearce <cpearce@mozilla.com>
Wed, 21 Oct 2015 21:17:56 +1300
changeset 291327 4661413507b3
parent 291326 68048d187998
child 291328 e2f9a0ed50bc
child 291330 a420b49d3b37
push id945
push userryanvm@gmail.com
push date2015-10-29 15:01 +0000
treeherdermozilla-release@4661413507b3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya, sylvestre
bugs1205083
milestone42.0
Bug 1205083 - Don't enable low latency WMF video decoding as it crashes sometimes. r=jya, a=sylvestre
dom/media/platforms/wmf/MFTDecoder.cpp
dom/media/platforms/wmf/WMFDecoderModule.cpp
dom/media/platforms/wmf/WMFDecoderModule.h
dom/media/platforms/wmf/WMFVideoMFTManager.cpp
modules/libpref/init/all.js
testing/web-platform/meta/media-source/mediasource-append-buffer.html.ini
--- a/dom/media/platforms/wmf/MFTDecoder.cpp
+++ b/dom/media/platforms/wmf/MFTDecoder.cpp
@@ -217,17 +217,17 @@ MFTDecoder::Output(RefPtr<IMFSample>* aO
   if (output.pEvents) {
     // We must release this, as per the IMFTransform::ProcessOutput()
     // MSDN documentation.
     output.pEvents->Release();
     output.pEvents = nullptr;
   }
 
   if (hr == MF_E_TRANSFORM_STREAM_CHANGE) {
-    // Type change, probably geometric aperature change.
+    // Type change, probably geometric aperture change.
     // Reconfigure decoder output type, so that GetOutputMediaType()
     // returns the new type, and return the error code to caller.
     // This is an expected failure, so don't warn on encountering it.
     hr = SetDecoderOutputType(nullptr, nullptr);
     NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
     // Return the error, so that the caller knows to retry.
     return MF_E_TRANSFORM_STREAM_CHANGE;
   }
--- a/dom/media/platforms/wmf/WMFDecoderModule.cpp
+++ b/dom/media/platforms/wmf/WMFDecoderModule.cpp
@@ -21,16 +21,17 @@
 #include "MediaInfo.h"
 #include "prsystem.h"
 
 namespace mozilla {
 
 static bool sDXVAEnabled = false;
 static int  sNumDecoderThreads = -1;
 static bool sIsIntelDecoderEnabled = false;
+static bool sLowLatencyMFTEnabled = false;
 
 WMFDecoderModule::WMFDecoderModule()
   : mWMFInitialized(false)
 {
 }
 
 WMFDecoderModule::~WMFDecoderModule()
 {
@@ -68,26 +69,34 @@ SetNumOfDecoderThreads()
 
 /* static */
 void
 WMFDecoderModule::Init()
 {
   MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread.");
   sDXVAEnabled = gfxPlatform::GetPlatform()->CanUseHardwareVideoDecoding();
   sIsIntelDecoderEnabled = Preferences::GetBool("media.webm.intel_decoder.enabled", false);
+  sLowLatencyMFTEnabled = Preferences::GetBool("media.wmf.low-latency.enabled", false);
   SetNumOfDecoderThreads();
 }
 
 /* static */
 int
 WMFDecoderModule::GetNumDecoderThreads()
 {
   return sNumDecoderThreads;
 }
 
+/* static */
+bool
+WMFDecoderModule::LowLatencyMFTEnabled()
+{
+  return sLowLatencyMFTEnabled;
+}
+
 nsresult
 WMFDecoderModule::Startup()
 {
   mWMFInitialized = SUCCEEDED(wmf::MFStartup());
   return mWMFInitialized ? NS_OK : NS_ERROR_FAILURE;
 }
 
 already_AddRefed<MediaDataDecoder>
--- a/dom/media/platforms/wmf/WMFDecoderModule.h
+++ b/dom/media/platforms/wmf/WMFDecoderModule.h
@@ -46,16 +46,17 @@ public:
   static bool HasAAC();
   static bool HasH264();
 
   // Called on main thread.
   static void Init();
 
   // Called from any thread, must call init first
   static int GetNumDecoderThreads();
+  static bool LowLatencyMFTEnabled();
 private:
   bool ShouldUseDXVA(const VideoInfo& aConfig) const;
   bool mWMFInitialized;
 };
 
 } // namespace mozilla
 
 #endif
--- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
+++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
@@ -199,25 +199,27 @@ WMFVideoMFTManager::InitInternal(bool aF
   RefPtr<MFTDecoder> decoder(new MFTDecoder());
 
   HRESULT hr = decoder->Create(GetMFTGUID());
   NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
 
   RefPtr<IMFAttributes> attr(decoder->GetAttributes());
   UINT32 aware = 0;
   if (attr) {
-      attr->GetUINT32(MF_SA_D3D_AWARE, &aware);
-      attr->SetUINT32(CODECAPI_AVDecNumWorkerThreads,
-                      WMFDecoderModule::GetNumDecoderThreads());
+    attr->GetUINT32(MF_SA_D3D_AWARE, &aware);
+    attr->SetUINT32(CODECAPI_AVDecNumWorkerThreads,
+      WMFDecoderModule::GetNumDecoderThreads());
+    if (WMFDecoderModule::LowLatencyMFTEnabled()) {
       hr = attr->SetUINT32(CODECAPI_AVLowLatencyMode, TRUE);
       if (SUCCEEDED(hr)) {
         LOG("Enabling Low Latency Mode");
       } else {
         LOG("Couldn't enable Low Latency Mode");
       }
+    }
   }
 
   if (useDxva) {
     if (aware) {
       // TODO: Test if I need this anywhere... Maybe on Vista?
       //hr = attr->SetUINT32(CODECAPI_AVDecVideoAcceleration_H264, TRUE);
       //NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
       MOZ_ASSERT(mDXVA2Manager);
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -294,16 +294,17 @@ pref("media.block-play-until-visible", f
 
 pref("media.hardware-video-decoding.enabled", true);
 
 pref("media.decoder.heuristic.dormant.enabled", true);
 pref("media.decoder.heuristic.dormant.timeout", 60000);
 
 #ifdef MOZ_WMF
 pref("media.wmf.decoder.thread-count", -1);
+pref("media.wmf.low-latency.enabled", false);
 #endif
 #ifdef MOZ_DIRECTSHOW
 pref("media.directshow.enabled", true);
 #endif
 #ifdef MOZ_FMP4
 pref("media.fragmented-mp4.enabled", true);
 pref("media.fragmented-mp4.ffmpeg.enabled", false);
 pref("media.fragmented-mp4.gmp.enabled", false);
--- a/testing/web-platform/meta/media-source/mediasource-append-buffer.html.ini
+++ b/testing/web-platform/meta/media-source/mediasource-append-buffer.html.ini
@@ -1,5 +1,5 @@
 [mediasource-append-buffer.html]
   type: testharness
   prefs: [media.mediasource.enabled:true]
   disabled:
-    if (os == "win") and (version == "6.1.7601"): https://bugzilla.mozilla.org/show_bug.cgi?id=1191138
+    if (os == "win"): https://bugzilla.mozilla.org/show_bug.cgi?id=1191138