Bug 1205083 - Don't enable low latency WMF video decoding as it crashes sometimes. r=jya
authorChris Pearce <cpearce@mozilla.com>
Wed, 21 Oct 2015 21:17:56 +1300
changeset 268761 e5963ad16857693557118108bd3e0d0beddf9c01
parent 268760 d1e0b2e1b8ea2e241eebc747c9f2ca85858642f3
child 268762 01cdd3e5bd7153dfdc47d865538e15e4754dc0cf
push id29562
push userkwierso@gmail.com
push dateWed, 21 Oct 2015 23:29:46 +0000
treeherdermozilla-central@4879f22ef96a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1205083
milestone44.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 1205083 - Don't enable low latency WMF video decoding as it crashes sometimes. r=jya
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
@@ -213,17 +213,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
@@ -23,16 +23,17 @@
 #include "prsystem.h"
 #include "mozilla/Maybe.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()
 {
@@ -63,26 +64,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
@@ -36,15 +36,16 @@ public:
   ConversionRequired
   DecoderNeedsConversion(const TrackInfo& aConfig) const override;
 
   // Called on main thread.
   static void Init();
 
   // Called from any thread, must call init first
   static int GetNumDecoderThreads();
+  static bool LowLatencyMFTEnabled();
 private:
   bool mWMFInitialized;
 };
 
 } // namespace mozilla
 
 #endif
--- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
+++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
@@ -211,22 +211,23 @@ WMFVideoMFTManager::InitInternal(bool aF
   NS_ENSURE_TRUE(SUCCEEDED(hr), false);
 
   RefPtr<IMFAttributes> attr(decoder->GetAttributes());
   UINT32 aware = 0;
   if (attr) {
     attr->GetUINT32(MF_SA_D3D_AWARE, &aware);
     attr->SetUINT32(CODECAPI_AVDecNumWorkerThreads,
       WMFDecoderModule::GetNumDecoderThreads());
-    hr = attr->SetUINT32(CODECAPI_AVLowLatencyMode, TRUE);
-    if (SUCCEEDED(hr)) {
-      LOG("Enabling Low Latency Mode");
-    }
-    else {
-      LOG("Couldn't enable Low Latency Mode");
+    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);
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -318,16 +318,17 @@ pref("media.mp4.enabled", true);
 // Specifies whether the PDMFactory can create a test decoder that
 #endif
 // just outputs blank frames/audio instead of actually decoding. The blank
 // decoder works on all platforms.
 pref("media.use-blank-decoder", false);
 #ifdef MOZ_WMF
 pref("media.wmf.enabled", true);
 pref("media.wmf.decoder.thread-count", -1);
+pref("media.wmf.low-latency.enabled", false);
 #endif
 #if defined(MOZ_FFMPEG)
 pref("media.ffmpeg.enabled", true);
 #endif
 pref("media.gmp.decoder.enabled", false);
 pref("media.gmp.decoder.aac", 0);
 pref("media.gmp.decoder.h264", 0);
 #ifdef MOZ_RAW
--- 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 == "linux") or ((os == "win") and (version == "6.1.7601")): https://bugzilla.mozilla.org/show_bug.cgi?id=1191138
+    if (os == "linux") or (os == "win"): https://bugzilla.mozilla.org/show_bug.cgi?id=1191138