Bug 1583986 - add pref to control ffvpx mp3 decoding so we can turn it off if needed. r=bwc,jya
authorMichael Froman <mfroman@mozilla.com>
Mon, 30 Sep 2019 14:29:08 +0000
changeset 495696 a3afb69b01cf0a296927d39c8b04146bdc9fa8b7
parent 495695 a0ba467e5d7a10d9afbbe98a7577cf1091cd21d1
child 495697 ab8923caa59404dd5b2a67204281584ee6d858b2
push id114140
push userdvarga@mozilla.com
push dateWed, 02 Oct 2019 18:04:51 +0000
treeherdermozilla-inbound@32eb0ea893f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc, jya
bugs1583986
milestone71.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 1583986 - add pref to control ffvpx mp3 decoding so we can turn it off if needed. r=bwc,jya Differential Revision: https://phabricator.services.mozilla.com/D47499
dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp
modules/libpref/init/StaticPrefList.yaml
--- a/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/TaskQueue.h"
 
 #include "FFmpegAudioDecoder.h"
 #include "TimeUnits.h"
 #include "VideoUtils.h"
+#include "mozilla/StaticPrefs_media.h"
 
 namespace mozilla {
 
 FFmpegAudioDecoder<LIBAV_VER>::FFmpegAudioDecoder(FFmpegLibWrapper* aLib,
                                                   TaskQueue* aTaskQueue,
                                                   const AudioInfo& aConfig)
     : FFmpegDataDecoder(aLib, aTaskQueue, GetCodecId(aConfig.mMimeType)) {
   MOZ_COUNT_CTOR(FFmpegAudioDecoder);
@@ -259,16 +260,21 @@ MediaResult FFmpegAudioDecoder<LIBAV_VER
     samplePosition += bytesConsumed;
   }
   return NS_OK;
 }
 
 AVCodecID FFmpegAudioDecoder<LIBAV_VER>::GetCodecId(
     const nsACString& aMimeType) {
   if (aMimeType.EqualsLiteral("audio/mpeg")) {
+#ifdef FFVPX_VERSION
+    if (!StaticPrefs::media_ffvpx_mp3_enabled()) {
+      return AV_CODEC_ID_NONE;
+    }
+#endif
     return AV_CODEC_ID_MP3;
   } else if (aMimeType.EqualsLiteral("audio/flac")) {
     return AV_CODEC_ID_FLAC;
   } else if (aMimeType.EqualsLiteral("audio/mp4a-latm")) {
     return AV_CODEC_ID_AAC;
   }
 
   return AV_CODEC_ID_NONE;
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -5640,16 +5640,21 @@
     mirror: always
 #endif  # MOZ_FFMPEG
 
 #ifdef MOZ_FFVPX
 -   name: media.ffvpx.enabled
     type: RelaxedAtomicBool
     value: true
     mirror: always
+
+-   name: media.ffvpx.mp3.enabled
+    type: RelaxedAtomicBool
+    value: true
+    mirror: always
 #endif
 
 #if defined(MOZ_FFMPEG) || defined(MOZ_FFVPX)
 -   name: media.ffmpeg.low-latency.enabled
     type: RelaxedAtomicBool
     value: false
     mirror: always
 #endif