Bug 1232223 - Part 1: Remove MOZ_WEBM #ifdefs because WebM is always supported, though not necessarily enabled. r=jya r=glandium
authorChris Peterson <cpeterson@mozilla.com>
Sat, 12 Dec 2015 13:49:07 -0500
changeset 277031 0ff5677bec68e518bce3273a27b73ad761bc4359
parent 277030 3a206e2652fc66e9ddea0228c120fa9986ef62b6
child 277032 eafee43d5833ea2880c78c90090ebe35cfabf24b
push id69370
push usercpeterson@mozilla.com
push dateMon, 21 Dec 2015 08:09:50 +0000
treeherdermozilla-inbound@a1edc39d37a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya, glandium
bugs1232223
milestone46.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 1232223 - Part 1: Remove MOZ_WEBM #ifdefs because WebM is always supported, though not necessarily enabled. r=jya r=glandium
config/external/moz.build
configure.in
dom/html/HTMLAudioElement.cpp
dom/html/HTMLVideoElement.cpp
dom/media/DecoderTraits.cpp
dom/media/MediaDecoder.cpp
dom/media/MediaDecoder.h
dom/media/mediasource/TrackBuffersManager.cpp
dom/media/moz.build
modules/libpref/init/all.js
python/mozbuild/mozbuild/mozinfo.py
toolkit/components/mediasniffer/nsMediaSniffer.cpp
uriloader/exthandler/nsExternalHelperAppService.cpp
--- a/config/external/moz.build
+++ b/config/external/moz.build
@@ -21,19 +21,16 @@ if CONFIG['MOZ_UPDATER']:
 external_dirs += ['modules/brotli']
 
 if CONFIG['MOZ_VORBIS']:
     external_dirs += ['media/libvorbis']
 
 if CONFIG['MOZ_TREMOR']:
     external_dirs += ['media/libtremor']
 
-if CONFIG['MOZ_WEBM']:
-    external_dirs += ['media/libnestegg']
-
 if CONFIG['MOZ_WEBM_ENCODER']:
     external_dirs += ['media/libmkv']
 
 if CONFIG['MOZ_VPX'] and not CONFIG['MOZ_NATIVE_LIBVPX']:
     external_dirs += ['media/libvpx']
 
 if not CONFIG['MOZ_NATIVE_PNG']:
     external_dirs += ['media/libpng']
@@ -45,16 +42,17 @@ if CONFIG['MOZ_WEBSPEECH_POCKETSPHINX']:
     external_dirs += [
         'media/sphinxbase',
         'media/pocketsphinx',
     ]
 
 external_dirs += [
     'media/kiss_fft',
     'media/libcubeb',
+    'media/libnestegg',
     'media/libogg',
     'media/libopus',
     'media/libtheora',
     'media/libspeex_resampler',
     'media/libstagefright',
     'media/libsoundtouch',
 ]
 
--- a/configure.in
+++ b/configure.in
@@ -3690,17 +3690,16 @@ if test "$MOZ_IOS"; then
    MOZ_AUTH_EXTENSION=
 fi
 MOZ_RAW=
 MOZ_VORBIS=
 MOZ_TREMOR=
 MOZ_WAVE=1
 MOZ_SAMPLE_TYPE_FLOAT32=
 MOZ_SAMPLE_TYPE_S16=
-MOZ_WEBM=1
 MOZ_GSTREAMER=
 MOZ_DIRECTSHOW=
 MOZ_WMF=
 if test -n "$MOZ_FMP4"; then
   MOZ_FMP4=1
 else
   MOZ_FMP4=
 fi
@@ -5138,28 +5137,17 @@ AC_CACHE_CHECK([__attribute__ ((aligned 
        fi
      done
        CFLAGS="${CFLAGS_save}"])
 if test "${ac_cv_c_attribute_aligned}" != "0"; then
   AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
                      [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
 fi
 
-dnl ========================================================
-dnl = Disable VP8 decoder support
-dnl ========================================================
-MOZ_ARG_DISABLE_BOOL(webm,
-[  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
-    MOZ_WEBM=,
-    MOZ_WEBM=1)
-
-if test -n "$MOZ_WEBM"; then
-    AC_DEFINE(MOZ_WEBM)
-    MOZ_VPX=1
-fi;
+MOZ_VPX=1
 
 dnl ========================================================
 dnl = Apple platform decoder support
 dnl ========================================================
 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa" || test "$MOZ_WIDGET_TOOLKIT" = "uikit"; then
   MOZ_APPLEMEDIA=1
 fi
 
@@ -5395,22 +5383,20 @@ if test -n "$MOZ_VPX"; then
     CFLAGS=$_SAVE_CFLAGS
     LIBS=$_SAVE_LIBS
 fi
 
 AC_SUBST(MOZ_NATIVE_LIBVPX)
 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
 
-if test "$MOZ_WEBM"; then
-    if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
-        MOZ_VORBIS=1
-    else
-        MOZ_TREMOR=1
-    fi
+if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
+    MOZ_VORBIS=1
+else
+    MOZ_TREMOR=1
 fi
 
 if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then
 
     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
     dnl We currently require gcc on all arm platforms.
     VPX_AS=$YASM
@@ -8924,17 +8910,16 @@ AC_SUBST(CXX_VERSION)
 AC_SUBST(MSMANIFEST_TOOL)
 AC_SUBST(NS_ENABLE_TSF)
 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
 
 AC_SUBST(MOZ_WAVE)
 AC_SUBST(MOZ_VORBIS)
 AC_SUBST(MOZ_TREMOR)
-AC_SUBST(MOZ_WEBM)
 AC_SUBST(MOZ_WMF)
 AC_SUBST(MOZ_FFMPEG)
 AC_SUBST(MOZ_FMP4)
 AC_SUBST(MOZ_EME)
 AC_SUBST(MOZ_DIRECTSHOW)
 AC_SUBST(MOZ_ANDROID_OMX)
 AC_SUBST(MOZ_APPLEMEDIA)
 AC_SUBST(MOZ_OMX_PLUGIN)
--- a/dom/html/HTMLAudioElement.cpp
+++ b/dom/html/HTMLAudioElement.cpp
@@ -74,23 +74,19 @@ HTMLAudioElement::Audio(const GlobalObje
   }
 
   return audio.forget();
 }
 
 nsresult HTMLAudioElement::SetAcceptHeader(nsIHttpChannel* aChannel)
 {
     nsAutoCString value(
-#ifdef MOZ_WEBM
       "audio/webm,"
-#endif
       "audio/ogg,"
-#ifdef MOZ_WAVE
       "audio/wav,"
-#endif
       "audio/*;q=0.9,"
       "application/ogg;q=0.7,"
       "video/*;q=0.6,*/*;q=0.5");
 
     return aChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
                                       value,
                                       false);
 }
--- a/dom/html/HTMLVideoElement.cpp
+++ b/dom/html/HTMLVideoElement.cpp
@@ -108,19 +108,17 @@ nsMapRuleToAttributesFunc
 HTMLVideoElement::GetAttributeMappingFunction() const
 {
   return &MapAttributesIntoRule;
 }
 
 nsresult HTMLVideoElement::SetAcceptHeader(nsIHttpChannel* aChannel)
 {
   nsAutoCString value(
-#ifdef MOZ_WEBM
       "video/webm,"
-#endif
       "video/ogg,"
       "video/*;q=0.9,"
       "application/ogg;q=0.7,"
       "audio/*;q=0.6,*/*;q=0.5");
 
   return aChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
                                     value,
                                     false);
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -11,21 +11,21 @@
 #include "mozilla/Preferences.h"
 
 #include "OggDecoder.h"
 #include "OggReader.h"
 #ifdef MOZ_WAVE
 #include "WaveDecoder.h"
 #include "WaveReader.h"
 #endif
-#ifdef MOZ_WEBM
+
 #include "WebMDecoder.h"
 #include "WebMReader.h"
 #include "WebMDemuxer.h"
-#endif
+
 #ifdef MOZ_RAW
 #include "RawDecoder.h"
 #include "RawReader.h"
 #endif
 #ifdef MOZ_GSTREAMER
 #include "GStreamerDecoder.h"
 #include "GStreamerReader.h"
 #endif
@@ -151,41 +151,33 @@ IsWaveType(const nsACString& aType)
   if (!MediaDecoder::IsWaveEnabled()) {
     return false;
   }
 
   return CodecListContains(gWaveTypes, aType);
 }
 #endif
 
-#ifdef MOZ_WEBM
 static bool
 IsWebMSupportedType(const nsACString& aType,
                     const nsAString& aCodecs = EmptyString())
 {
   return WebMDecoder::CanHandleMediaType(aType, aCodecs);
 }
-#endif
 
 /* static */ bool
 DecoderTraits::IsWebMTypeAndEnabled(const nsACString& aType)
 {
-#ifdef MOZ_WEBM
   return IsWebMSupportedType(aType);
-#endif
-  return false;
 }
 
 /* static */ bool
 DecoderTraits::IsWebMAudioType(const nsACString& aType)
 {
-#ifdef MOZ_WEBM
   return aType.EqualsASCII("audio/webm");
-#endif
-  return false;
 }
 
 #ifdef MOZ_GSTREAMER
 static bool
 IsGStreamerSupportedType(const nsACString& aMimeType)
 {
   if (DecoderTraits::IsWebMTypeAndEnabled(aMimeType))
     return false;
@@ -618,22 +610,22 @@ InstantiateDecoder(const nsACString& aTy
 #endif
 #ifdef MOZ_ANDROID_OMX
   if (MediaDecoder::IsAndroidMediaEnabled() &&
       EnsureAndroidMediaPluginHost()->FindDecoder(aType, nullptr)) {
     decoder = new AndroidMediaDecoder(aOwner, aType);
     return decoder.forget();
   }
 #endif
-#ifdef MOZ_WEBM
+
   if (IsWebMSupportedType(aType)) {
     decoder = new WebMDecoder(aOwner);
     return decoder.forget();
   }
-#endif
+
 #ifdef MOZ_DIRECTSHOW
   // Note: DirectShow should come before WMF, so that we prefer DirectShow's
   // MP3 support over WMF's.
   if (IsDirectShowSupportedType(aType)) {
     decoder = new DirectShowDecoder(aOwner);
     return decoder.forget();
   }
 #endif
@@ -693,23 +685,23 @@ MediaDecoderReader* DecoderTraits::Creat
   } else
 #endif
 #ifdef MOZ_ANDROID_OMX
   if (MediaDecoder::IsAndroidMediaEnabled() &&
       EnsureAndroidMediaPluginHost()->FindDecoder(aType, nullptr)) {
     decoderReader = new AndroidMediaReader(aDecoder, aType);
   } else
 #endif
-#ifdef MOZ_WEBM
+
   if (IsWebMSupportedType(aType)) {
     decoderReader = Preferences::GetBool("media.format-reader.webm", true) ?
       static_cast<MediaDecoderReader*>(new MediaFormatReader(aDecoder, new WebMDemuxer(aDecoder->GetResource()))) :
       new WebMReader(aDecoder);
   } else
-#endif
+
 #ifdef MOZ_DIRECTSHOW
   if (IsDirectShowSupportedType(aType)) {
     decoderReader = new DirectShowReader(aDecoder);
   } else
 #endif
   if (false) {} // dummy if to take care of the dangling else
 
   return decoderReader;
@@ -730,19 +722,17 @@ bool DecoderTraits::IsSupportedInVideoDo
     IsOggType(aType) ||
 #ifdef MOZ_OMX_DECODER
     // We support the formats in gB2GOnlyTypes only inside WebApps on firefoxOS
     // but not in general web content. Ensure we dont create a VideoDocument
     // when accessing those format URLs directly.
     (IsOmxSupportedType(aType) &&
      !IsB2GSupportOnlyType(aType)) ||
 #endif
-#ifdef MOZ_WEBM
     IsWebMSupportedType(aType) ||
-#endif
 #ifdef MOZ_GSTREAMER
     IsGStreamerSupportedType(aType) ||
 #endif
 #ifdef MOZ_ANDROID_OMX
     (MediaDecoder::IsAndroidMediaEnabled() && IsAndroidMediaType(aType)) ||
 #endif
 #ifdef MOZ_FMP4
     IsMP4SupportedType(aType) ||
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -34,17 +34,17 @@ using namespace mozilla::dom;
 using namespace mozilla::layers;
 using namespace mozilla::media;
 
 // Default timeout msecs until try to enter dormant state by heuristic.
 static const int DEFAULT_HEURISTIC_DORMANT_TIMEOUT_MSECS = 60000;
 
 namespace mozilla {
 
-// The amount of instability we tollerate in calls to
+// The amount of instability we tolerate in calls to
 // MediaDecoder::UpdateEstimatedMediaDuration(); changes of duration
 // less than this are ignored, as they're assumed to be the result of
 // instability in the duration estimation.
 static const uint64_t ESTIMATED_DURATION_FUZZ_FACTOR_USECS = USECS_PER_S / 2;
 
 // avoid redefined macro in unified build
 #undef DECODER_LOG
 
@@ -1644,23 +1644,21 @@ MediaDecoder::IsOggEnabled()
 #ifdef MOZ_WAVE
 bool
 MediaDecoder::IsWaveEnabled()
 {
   return Preferences::GetBool("media.wave.enabled");
 }
 #endif
 
-#ifdef MOZ_WEBM
 bool
 MediaDecoder::IsWebMEnabled()
 {
   return Preferences::GetBool("media.webm.enabled");
 }
-#endif
 
 #ifdef NECKO_PROTOCOL_rtsp
 bool
 MediaDecoder::IsRtspEnabled()
 {
   //Currently the Rtsp decoded by omx.
   return (Preferences::GetBool("media.rtsp.enabled", false) && IsOmxEnabled());
 }
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -662,19 +662,18 @@ private:
 
   static bool IsOggEnabled();
   static bool IsOpusEnabled();
 
 #ifdef MOZ_WAVE
   static bool IsWaveEnabled();
 #endif
 
-#ifdef MOZ_WEBM
   static bool IsWebMEnabled();
-#endif
+
 #ifdef NECKO_PROTOCOL_rtsp
   static bool IsRtspEnabled();
 #endif
 
 #ifdef MOZ_GSTREAMER
   static bool IsGStreamerEnabled();
 #endif
 
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -7,20 +7,17 @@
 #include "TrackBuffersManager.h"
 #include "ContainerParser.h"
 #include "MediaSourceDemuxer.h"
 #include "MediaSourceUtils.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/StateMirroring.h"
 #include "SourceBufferResource.h"
 #include "SourceBuffer.h"
-
-#ifdef MOZ_WEBM
 #include "WebMDemuxer.h"
-#endif
 
 #ifdef MOZ_FMP4
 #include "MP4Demuxer.h"
 #endif
 
 #include <limits>
 
 extern mozilla::LogModule* GetMediaSourceLog();
@@ -793,22 +790,20 @@ TrackBuffersManager::ShutdownDemuxers()
   mLastParsedEndTime.reset();
 }
 
 void
 TrackBuffersManager::CreateDemuxerforMIMEType()
 {
   ShutdownDemuxers();
 
-#ifdef MOZ_WEBM
   if (mType.LowerCaseEqualsLiteral("video/webm") || mType.LowerCaseEqualsLiteral("audio/webm")) {
     mInputDemuxer = new WebMDemuxer(mCurrentInputBuffer, true /* IsMediaSource*/ );
     return;
   }
-#endif
 
 #ifdef MOZ_FMP4
   if (mType.LowerCaseEqualsLiteral("video/mp4") || mType.LowerCaseEqualsLiteral("audio/mp4")) {
     mInputDemuxer = new MP4Demuxer(mCurrentInputBuffer);
     return;
   }
 #endif
   NS_WARNING("Not supported (yet)");
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -26,31 +26,29 @@ DIRS += [
     'gmp-plugin-openh264',
     'imagecapture',
     'mediasink',
     'mediasource',
     'ogg',
     'platforms',
     'systemservices',
     'webaudio',
+    'webm',
     'webrtc',
     'webspeech',
     'webvtt',
     'standalone',
 ]
 
 if CONFIG['MOZ_RAW']:
     DIRS += ['raw']
 
 if CONFIG['MOZ_WAVE']:
     DIRS += ['wave']
 
-if CONFIG['MOZ_WEBM']:
-    DIRS += ['webm']
-
 if CONFIG['MOZ_GSTREAMER']:
     DIRS += ['gstreamer']
 
 if CONFIG['MOZ_DIRECTSHOW']:
     DIRS += ['directshow']
 
 if CONFIG['MOZ_ANDROID_OMX']:
     DIRS += ['android']
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -333,22 +333,22 @@ pref("media.gmp.decoder.h264", 0);
 #ifdef MOZ_RAW
 pref("media.raw.enabled", true);
 #endif
 pref("media.ogg.enabled", true);
 pref("media.opus.enabled", true);
 #ifdef MOZ_WAVE
 pref("media.wave.enabled", true);
 #endif
-#ifdef MOZ_WEBM
+
 pref("media.webm.enabled", true);
 #if defined(MOZ_FMP4) && defined(MOZ_WMF)
 pref("media.webm.intel_decoder.enabled", false);
 #endif
-#endif
+
 #ifdef MOZ_GSTREAMER
 pref("media.gstreamer.enabled", true);
 pref("media.gstreamer.enable-blacklist", true);
 #endif
 #ifdef MOZ_APPLEMEDIA
 #ifdef MOZ_WIDGET_UIKIT
 pref("media.mp3.enabled", true);
 #endif
--- a/python/mozbuild/mozbuild/mozinfo.py
+++ b/python/mozbuild/mozbuild/mozinfo.py
@@ -87,18 +87,16 @@ def build_dict(config, env=os.environ):
     d['healthreport'] = substs.get('MOZ_SERVICES_HEALTHREPORT') == '1'
     d['sync'] = substs.get('MOZ_SERVICES_SYNC') == '1'
     d['asan'] = substs.get('MOZ_ASAN') == '1'
     d['tsan'] = substs.get('MOZ_TSAN') == '1'
     d['telemetry'] = substs.get('MOZ_TELEMETRY_REPORTING') == '1'
     d['tests_enabled'] = substs.get('ENABLE_TESTS') == "1"
     d['bin_suffix'] = substs.get('BIN_SUFFIX', '')
     d['addon_signing'] = substs.get('MOZ_ADDON_SIGNING') == '1'
-
-    d['webm'] = bool(substs.get('MOZ_WEBM'))
     d['wave'] = bool(substs.get('MOZ_WAVE'))
 
     d['official'] = bool(substs.get('MOZILLA_OFFICIAL'))
 
     def guess_platform():
         if d['buildapp'] in ('browser', 'mulet'):
             p = d['os']
             if p == 'mac':
--- a/toolkit/components/mediasniffer/nsMediaSniffer.cpp
+++ b/toolkit/components/mediasniffer/nsMediaSniffer.cpp
@@ -6,19 +6,17 @@
 
 #include "nsMediaSniffer.h"
 #include "nsIHttpChannel.h"
 #include "nsString.h"
 #include "nsMimeTypes.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/ModuleUtils.h"
 #include "mp3sniff.h"
-#ifdef MOZ_WEBM
 #include "nestegg/nestegg.h"
-#endif
 
 #include "nsIClassInfoImpl.h"
 #include <algorithm>
 
 // The minimum number of bytes that are needed to attempt to sniff an mp4 file.
 static const unsigned MP4_MIN_BYTES_COUNT = 12;
 // The maximum number of bytes to consider when attempting to sniff a file.
 static const uint32_t MAX_BYTES_SNIFFED = 512;
@@ -102,21 +100,17 @@ static bool MatchesMP4(const uint8_t* aD
     bytesRead += 4;
   }
 
   return false;
 }
 
 static bool MatchesWebM(const uint8_t* aData, const uint32_t aLength)
 {
-#ifdef MOZ_WEBM
   return nestegg_sniff((uint8_t*)aData, aLength) ? true : false;
-#else
-  return false;
-#endif
 }
 
 // This function implements mp3 sniffing based on parsing
 // packet headers and looking for expected boundaries.
 static bool MatchesMP3(const uint8_t* aData, const uint32_t aLength)
 {
   return mp3_sniff(aData, (long)aLength);
 }
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -508,20 +508,18 @@ static nsDefaultMimeTypeEntry defaultMim
   { "application/xhtml+xml", "xhtml" },
   { "application/xhtml+xml", "xht" },
   { TEXT_PLAIN, "txt" },
   { VIDEO_OGG, "ogv" },
   { VIDEO_OGG, "ogg" },
   { APPLICATION_OGG, "ogg" },
   { AUDIO_OGG, "oga" },
   { AUDIO_OGG, "opus" },
-#ifdef MOZ_WEBM
   { VIDEO_WEBM, "webm" },
   { AUDIO_WEBM, "webm" },
-#endif
 #if defined(MOZ_GSTREAMER) || defined(MOZ_WMF)
   { VIDEO_MP4, "mp4" },
   { AUDIO_MP4, "m4a" },
   { AUDIO_MP3, "mp3" },
 #endif
 #ifdef MOZ_RAW
   { VIDEO_RAW, "yuv" }
 #endif