Bug 1496529 - P8. Add media.navigator.mediadatadecoder_h264_enabled preference. r=drno
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 09 Oct 2018 20:36:18 +0000
changeset 496092 357d4762fa8fda3470020886958c300aae51cb22
parent 496091 970b4aaccd355a7512297b26c198441937fc9328
child 496093 ea2cd3e66c564ab1f64c33b3ea8ce5924b3b6a79
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno
bugs1496529
milestone64.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 1496529 - P8. Add media.navigator.mediadatadecoder_h264_enabled preference. r=drno For now, the H264 decoding support is rather sturdy. It handles change of resolution and content smoothly thanks to the H264Converter. The VP8/VP9 one however, not so much. So we make a preference to only enable H264 for now. Depends on D7895 Differential Revision: https://phabricator.services.mozilla.com/D7908
media/webrtc/signaling/src/media-conduit/MediaDataDecoderCodec.cpp
modules/libpref/init/StaticPrefList.h
modules/libpref/init/all.js
--- a/media/webrtc/signaling/src/media-conduit/MediaDataDecoderCodec.cpp
+++ b/media/webrtc/signaling/src/media-conduit/MediaDataDecoderCodec.cpp
@@ -14,23 +14,28 @@ MediaDataDecoderCodec::CreateEncoder(
 {
   return nullptr;
 }
 
 /* static */ WebrtcVideoDecoder*
 MediaDataDecoderCodec::CreateDecoder(
   webrtc::VideoCodecType aCodecType)
 {
-  if (!StaticPrefs::MediaNavigatorMediadatadecoderEnabled()) {
+  if (!StaticPrefs::MediaNavigatorMediadatadecoderEnabled() &&
+      !StaticPrefs::MediaNavigatorMediadatadecoderH264Enabled()) {
     return nullptr;
   }
 
   switch (aCodecType) {
     case webrtc::VideoCodecType::kVideoCodecVP8:
     case webrtc::VideoCodecType::kVideoCodecVP9:
+      if (!StaticPrefs::MediaNavigatorMediadatadecoderEnabled()) {
+        return nullptr;
+      }
+      MOZ_FALLTHROUGH;
     case webrtc::VideoCodecType::kVideoCodecH264:
       break;
     default:
       return nullptr;
   }
   return new WebrtcMediaDataDecoder();
 }
 
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -1061,16 +1061,23 @@ PREF("media.navigator.hardware.vp8_decod
 
 // Use MediaDataDecoder API for WebRTC. This includes hardware acceleration for
 // decoding.
 VARCACHE_PREF(
   "media.navigator.mediadatadecoder_enabled",
    MediaNavigatorMediadatadecoderEnabled,
   bool, false
 )
+// Use MediaDataDecoder API for WebRTC. This includes hardware acceleration for
+// decoding.
+VARCACHE_PREF(
+  "media.navigator.mediadatadecoder_h264_enabled",
+   MediaNavigatorMediadatadecoderH264Enabled,
+  bool, false
+)
 #endif // MOZ_WEBRTC
 
 #ifdef MOZ_OMX
 VARCACHE_PREF(
   "media.omx.enabled",
    MediaOmxEnabled,
   bool, false
 )
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -442,16 +442,18 @@ pref("media.navigator.video.default_widt
 pref("media.navigator.video.default_height",0); // adaptive default
 pref("media.peerconnection.enabled", true);
 pref("media.peerconnection.video.enabled", true);
 pref("media.navigator.video.max_fs", 12288); // Enough for 2048x1536
 pref("media.navigator.video.max_fr", 60);
 pref("media.navigator.video.h264.level", 31); // 0x42E01f - level 3.1
 pref("media.navigator.video.h264.max_br", 0);
 pref("media.navigator.video.h264.max_mbps", 0);
+pref("media.navigator.mediadatadecoder_enabled", false);
+pref("media.navigator.mediadatadecoder_h264_enabled", false);
 pref("media.peerconnection.video.vp9_enabled", true);
 pref("media.peerconnection.video.vp9_preferred", false);
 pref("media.getusermedia.aec", 1);
 pref("media.getusermedia.browser.enabled", false);
 pref("media.getusermedia.channels", 0);
 #if defined(ANDROID)
 pref("media.getusermedia.camera.off_while_disabled.enabled", false);
 pref("media.getusermedia.microphone.off_while_disabled.enabled", false);