Bug 1100632 - Remove --disable-opus option and MOZ_OPUS #define macros. r=rillian,ted
authorawake <bugzillafx@gmail.com>
Fri, 28 Nov 2014 01:20:00 -0800
changeset 234871 c2fc9658f6e9775d3bd05126a573f9bbb8a3241a
parent 234870 3a1dcd04ea02fbc580ea00436f2dc49cd7b936fa
child 234872 f50c458f6f69b0724b6b31a5c612730b3846b825
push id7472
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 20:36:27 +0000
treeherdermozilla-aurora@300ca104f8fb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian, ted
bugs1100632
milestone37.0a1
Bug 1100632 - Remove --disable-opus option and MOZ_OPUS #define macros. r=rillian,ted
config/external/moz.build
configure.in
dom/media/MediaDecoder.cpp
dom/media/encoder/MediaEncoder.cpp
dom/media/encoder/moz.build
dom/media/ogg/OggCodecState.cpp
dom/media/ogg/OggCodecState.h
dom/media/ogg/OggReader.cpp
dom/media/ogg/OggReader.h
dom/media/webm/WebMReader.cpp
dom/media/webm/WebMReader.h
layout/media/symbols.def.in
modules/libpref/init/all.js
uriloader/exthandler/nsExternalHelperAppService.cpp
--- a/config/external/moz.build
+++ b/config/external/moz.build
@@ -20,34 +20,32 @@ 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_OPUS']:
-    external_dirs += ['media/libopus']
-
 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']
 
 external_dirs += [
     'media/kiss_fft',
     'media/libcubeb',
     'media/libogg',
+    'media/libopus',
     'media/libtheora',
     'media/libspeex_resampler',
     'media/libstagefright',
     'media/libsoundtouch',
 ]
 
 DIRS += ['../../' + i for i in external_dirs]
--- a/configure.in
+++ b/configure.in
@@ -3847,17 +3847,16 @@ MOZ_FEEDS=1
 MOZ_WEBAPP_RUNTIME=
 MOZ_AUTH_EXTENSION=1
 MOZ_RAW=
 MOZ_VORBIS=
 MOZ_TREMOR=
 MOZ_WAVE=1
 MOZ_SAMPLE_TYPE_FLOAT32=
 MOZ_SAMPLE_TYPE_S16=
-MOZ_OPUS=1
 MOZ_WEBM=1
 MOZ_GSTREAMER=
 MOZ_DIRECTSHOW=
 MOZ_WMF=
 if test -n "$MOZ_FMP4"; then
   MOZ_FMP4=1
 else
   MOZ_FMP4=
@@ -5220,24 +5219,16 @@ AC_CACHE_CHECK([__attribute__ ((aligned 
      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 Opus audio codec support
-dnl ========================================================
-MOZ_ARG_DISABLE_BOOL(opus,
-[  --disable-opus          Disable support for Opus audio],
-    MOZ_OPUS=,
-    MOZ_OPUS=1)
-
-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
@@ -5562,34 +5553,26 @@ fi
 dnl ========================================================
 dnl = Handle dependent MEDIA defines
 dnl ========================================================
 
 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
     AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive!  The build system should not allow them both to be set, but they are.  Please file a bug at https://bugzilla.mozilla.org/])
 fi
 
-if test -n "$MOZ_WEBRTC" -a -z "$MOZ_OPUS"; then
-    AC_MSG_ERROR([MOZ_WEBRTC requires MOZ_OPUS which is disabled.])
-fi
-
 if test -n "$MOZ_VORBIS"; then
     AC_DEFINE(MOZ_VORBIS)
 fi
 
 if test -n "$MOZ_TREMOR"; then
     AC_DEFINE(MOZ_TREMOR)
     # Tremor doesn't have an encoder.
     MOZ_WEBM_ENCODER=
 fi
 
-if test -n "$MOZ_OPUS"; then
-    AC_DEFINE(MOZ_OPUS)
-fi
-
 if test -n "$MOZ_WEBM_ENCODER"; then
     AC_DEFINE(MOZ_WEBM_ENCODER)
 fi
 AC_SUBST(MOZ_WEBM_ENCODER)
 
 dnl ==================================
 dnl = Check alsa availability on Linux
 dnl ==================================
@@ -8872,17 +8855,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_OPUS)
 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)
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -1684,21 +1684,17 @@ MediaDecoder::IsRawEnabled()
 {
   return Preferences::GetBool("media.raw.enabled");
 }
 #endif
 
 bool
 MediaDecoder::IsOpusEnabled()
 {
-#ifdef MOZ_OPUS
   return Preferences::GetBool("media.opus.enabled");
-#else
-  return false;
-#endif
 }
 
 bool
 MediaDecoder::IsOggEnabled()
 {
   return Preferences::GetBool("media.ogg.enabled");
 }
 
--- a/dom/media/encoder/MediaEncoder.cpp
+++ b/dom/media/encoder/MediaEncoder.cpp
@@ -7,21 +7,18 @@
 #include "nsIPrincipal.h"
 #include "nsMimeTypes.h"
 #include "prlog.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/StaticPtr.h"
 
 #include"GeckoProfiler.h"
 #include "OggWriter.h"
-#ifdef MOZ_OPUS
 #include "OpusTrackEncoder.h"
 
-#endif
-
 #ifdef MOZ_VORBIS
 #include "VorbisTrackEncoder.h"
 #endif
 #ifdef MOZ_WEBM_ENCODER
 #include "VorbisTrackEncoder.h"
 #include "VP8TrackEncoder.h"
 #include "WebMWriter.h"
 #endif
--- a/dom/media/encoder/moz.build
+++ b/dom/media/encoder/moz.build
@@ -6,33 +6,31 @@
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     DIRS += ['fmp4_muxer']
 
 EXPORTS += [
     'ContainerWriter.h',
     'EncodedFrameContainer.h',
     'MediaEncoder.h',
+    'OpusTrackEncoder.h',
     'TrackEncoder.h',
     'TrackMetadataBase.h',
 ]
 
 UNIFIED_SOURCES += [
     'MediaEncoder.cpp',
+    'OpusTrackEncoder.cpp',
     'TrackEncoder.cpp',
 ]
 
 if CONFIG['MOZ_OMX_ENCODER']:
     EXPORTS += ['OmxTrackEncoder.h']
     UNIFIED_SOURCES += ['OmxTrackEncoder.cpp']
 
-if CONFIG['MOZ_OPUS']:
-    EXPORTS += ['OpusTrackEncoder.h']
-    UNIFIED_SOURCES += ['OpusTrackEncoder.cpp']
-
 if CONFIG['MOZ_WEBM_ENCODER']:
     EXPORTS += ['VorbisTrackEncoder.h',
                 'VP8TrackEncoder.h',
     ]
     UNIFIED_SOURCES += ['VorbisTrackEncoder.cpp',
                         'VP8TrackEncoder.cpp',
     ]
     LOCAL_INCLUDES += ['/media/libyuv/include']
--- a/dom/media/ogg/OggCodecState.cpp
+++ b/dom/media/ogg/OggCodecState.cpp
@@ -44,20 +44,18 @@ OggCodecState*
 OggCodecState::Create(ogg_page* aPage)
 {
   NS_ASSERTION(ogg_page_bos(aPage), "Only call on BOS page!");
   nsAutoPtr<OggCodecState> codecState;
   if (aPage->body_len > 6 && memcmp(aPage->body+1, "theora", 6) == 0) {
     codecState = new TheoraState(aPage);
   } else if (aPage->body_len > 6 && memcmp(aPage->body+1, "vorbis", 6) == 0) {
     codecState = new VorbisState(aPage);
-#ifdef MOZ_OPUS
   } else if (aPage->body_len > 8 && memcmp(aPage->body, "OpusHead", 8) == 0) {
     codecState = new OpusState(aPage);
-#endif
   } else if (aPage->body_len > 8 && memcmp(aPage->body, "fishead\0", 8) == 0) {
     codecState = new SkeletonState(aPage);
   } else {
     codecState = new OggCodecState(aPage, false);
   }
   return codecState->OggCodecState::Init() ? codecState.forget() : nullptr;
 }
 
@@ -790,17 +788,16 @@ nsresult VorbisState::ReconstructVorbisG
 
   mPrevVorbisBlockSize = vorbis_packet_blocksize(&mInfo, last);
   mPrevVorbisBlockSize = std::max(static_cast<long>(0), mPrevVorbisBlockSize);
   mGranulepos = last->granulepos;
 
   return NS_OK;
 }
 
-#ifdef MOZ_OPUS
 OpusState::OpusState(ogg_page* aBosPage) :
   OggCodecState(aBosPage, true),
   mParser(nullptr),
   mDecoder(nullptr),
   mSkip(0),
   mPrevPacketGranulepos(0),
   mPrevPageGranulepos(0)
 {
@@ -1073,17 +1070,16 @@ bool OpusState::ReconstructOpusGranulepo
   // total number of samples decodable from the first page with completed
   // packets. This requires looking at the duration of the first packet, too.
   // We MUST reject such streams.
   if (!mDoneReadingHeaders && GetOpusDeltaGP(mUnstamped[0]) > gp)
     return false;
   mPrevPageGranulepos = last->granulepos;
   return true;
 }
-#endif /* MOZ_OPUS */
 
 SkeletonState::SkeletonState(ogg_page* aBosPage) :
   OggCodecState(aBosPage, true),
   mVersion(0),
   mPresentationTime(0),
   mLength(0)
 {
   MOZ_COUNT_CTOR(SkeletonState);
--- a/dom/media/ogg/OggCodecState.h
+++ b/dom/media/ogg/OggCodecState.h
@@ -8,24 +8,22 @@
 
 #include <ogg/ogg.h>
 #include <theora/theoradec.h>
 #ifdef MOZ_TREMOR
 #include <tremor/ivorbiscodec.h>
 #else
 #include <vorbis/codec.h>
 #endif
-#ifdef MOZ_OPUS
 #include <opus/opus.h>
 #include "opus/opus_multistream.h"
 // For MOZ_SAMPLE_TYPE_*
 #include "mozilla/dom/HTMLMediaElement.h"
 #include "MediaDecoderStateMachine.h"
 #include "MediaDecoderReader.h"
-#endif
 #include <nsAutoRef.h>
 #include <nsDeque.h>
 #include <nsTArray.h>
 #include <nsClassHashtable.h>
 #include "VideoUtils.h"
 
 #include <stdint.h>
 
@@ -318,17 +316,16 @@ private:
   // the stream, with the last packet having a known granulepos. Using this
   // known granulepos, and the known frame numbers, we recover the granulepos
   // of all frames in the array. This enables us to determine their timestamps.
   void ReconstructTheoraGranulepos();
 
 };
 
 class OpusState : public OggCodecState {
-#ifdef MOZ_OPUS
 public:
   explicit OpusState(ogg_page* aBosPage);
   virtual ~OpusState();
 
   CodecType GetType() { return TYPE_OPUS; }
   bool DecodeHeader(ogg_packet* aPacket);
   int64_t Time(int64_t aGranulepos);
   bool Init();
@@ -370,17 +367,16 @@ private:
   // of all frames in the array. This enables us to determine their timestamps.
   bool ReconstructOpusGranulepos();
 
   // Granule position (end sample) of the last decoded Opus page. This is
   // used to calculate the Opus per-packet granule positions on the last page,
   // where we may need to trim some samples from the end.
   int64_t mPrevPageGranulepos;
 
-#endif /* MOZ_OPUS */
 };
 
 // Constructs a 32bit version number out of two 16 bit major,minor
 // version numbers.
 #define SKELETON_VERSION(major, minor) (((major)<<16)|(minor))
 
 enum EMsgHeaderType {
   eContentType,
--- a/dom/media/ogg/OggReader.cpp
+++ b/dom/media/ogg/OggReader.cpp
@@ -8,22 +8,20 @@
 
 #include "nsError.h"
 #include "MediaDecoderStateMachine.h"
 #include "MediaDecoder.h"
 #include "OggReader.h"
 #include "VideoUtils.h"
 #include "theora/theoradec.h"
 #include <algorithm>
-#ifdef MOZ_OPUS
 #include "opus/opus.h"
 extern "C" {
 #include "opus/opus_multistream.h"
 }
-#endif
 #include "mozilla/dom/TimeRanges.h"
 #include "mozilla/TimeStamp.h"
 #include "VorbisUtils.h"
 #include "MediaMetadataManager.h"
 #include "nsISeekableStream.h"
 #include "gfx2DGlue.h"
 
 using namespace mozilla::gfx;
@@ -57,19 +55,17 @@ extern PRLogModuleInfo* gMediaDecoderLog
 // lands between the seek target and SEEK_FUZZ_USECS microseconds before the
 // seek target.  This is becaue it's usually quicker to just keep downloading
 // from an exisiting connection than to do another bisection inside that
 // small range, which would open a new HTTP connetion.
 static const uint32_t SEEK_FUZZ_USECS = 500000;
 
 // The number of microseconds of "pre-roll" we use for Opus streams.
 // The specification recommends 80 ms.
-#ifdef MOZ_OPUS
 static const int64_t SEEK_OPUS_PREROLL = 80 * USECS_PER_MS;
-#endif /* MOZ_OPUS */
 
 enum PageSyncResult {
   PAGE_SYNC_ERROR = 1,
   PAGE_SYNC_END_OF_RANGE= 2,
   PAGE_SYNC_OK = 3
 };
 
 // Reads a page from the media resource.
@@ -131,20 +127,18 @@ static void InitTrack(MessageField* aMsg
               aEnable);
 }
 
 OggReader::OggReader(AbstractMediaDecoder* aDecoder)
   : MediaDecoderReader(aDecoder),
     mMonitor("OggReader"),
     mTheoraState(nullptr),
     mVorbisState(nullptr),
-#ifdef MOZ_OPUS
     mOpusState(nullptr),
     mOpusEnabled(MediaDecoder::IsOpusEnabled()),
-#endif /* MOZ_OPUS */
     mSkeletonState(nullptr),
     mVorbisSerial(0),
     mOpusSerial(0),
     mTheoraSerial(0),
     mOpusPreSkip(0),
     mIsChained(false),
     mDecodedAudioFrames(0)
 {
@@ -178,21 +172,19 @@ nsresult OggReader::ResetDecode(bool sta
     res = NS_ERROR_FAILURE;
   }
 
   // Discard any previously buffered packets/pages.
   ogg_sync_reset(&mOggState);
   if (mVorbisState && NS_FAILED(mVorbisState->Reset())) {
     res = NS_ERROR_FAILURE;
   }
-#ifdef MOZ_OPUS
   if (mOpusState && NS_FAILED(mOpusState->Reset(start))) {
     res = NS_ERROR_FAILURE;
   }
-#endif /* MOZ_OPUS */
   if (mTheoraState && NS_FAILED(mTheoraState->Reset())) {
     res = NS_ERROR_FAILURE;
   }
 
   return res;
 }
 
 bool OggReader::ReadHeaders(OggCodecState* aState)
@@ -212,20 +204,18 @@ void OggReader::BuildSerialList(nsTArray
 {
   // Obtaining seek index information for currently active bitstreams.
   if (HasVideo()) {
     aTracks.AppendElement(mTheoraState->mSerial);
   }
   if (HasAudio()) {
     if (mVorbisState) {
       aTracks.AppendElement(mVorbisState->mSerial);
-#ifdef MOZ_OPUS
     } else if (mOpusState) {
       aTracks.AppendElement(mOpusState->mSerial);
-#endif /* MOZ_OPUS */
     }
   }
 }
 
 void OggReader::SetupTargetTheora(TheoraState* aTheoraState)
 {
   if (mTheoraState) {
     mTheoraState->Reset();
@@ -354,31 +344,29 @@ void OggReader::SetupMediaTracksInfo(con
 
       if (msgInfo) {
         InitTrack(msgInfo, &mInfo.mAudio.mTrackInfo, mVorbisState == vorbisState);
       }
 
       mInfo.mAudio.mHasAudio = true;
       mInfo.mAudio.mRate = vorbisState->mInfo.rate;
       mInfo.mAudio.mChannels = vorbisState->mInfo.channels;
-#ifdef MOZ_OPUS
     } else if (codecState->GetType() == OggCodecState::TYPE_OPUS) {
       OpusState* opusState = static_cast<OpusState*>(codecState);
       if (!(mOpusState && mOpusState->mSerial == opusState->mSerial)) {
         continue;
       }
 
       if (msgInfo) {
         InitTrack(msgInfo, &mInfo.mAudio.mTrackInfo, mOpusState == opusState);
       }
 
       mInfo.mAudio.mHasAudio = true;
       mInfo.mAudio.mRate = opusState->mRate;
       mInfo.mAudio.mChannels = opusState->mChannels;
-#endif
     }
   }
 }
 
 nsresult OggReader::ReadMetadata(MediaInfo* aInfo,
                                  MetadataTags** aTags)
 {
   NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
@@ -445,31 +433,29 @@ nsresult OggReader::ReadMetadata(MediaIn
       } else if (s->GetType() == OggCodecState::TYPE_VORBIS && ReadHeaders(s)) {
         if (!mVorbisState) {
           VorbisState* vorbisState = static_cast<VorbisState*>(s);
           SetupTargetVorbis(vorbisState);
           *aTags = vorbisState->GetTags();
         } else {
           s->Deactivate();
         }
-#ifdef MOZ_OPUS
       } else if (s->GetType() == OggCodecState::TYPE_OPUS && ReadHeaders(s)) {
         if (mOpusEnabled) {
           if (!mOpusState) {
             OpusState* opusState = static_cast<OpusState*>(s);
             SetupTargetOpus(opusState);
             *aTags = opusState->GetTags();
           } else {
             s->Deactivate();
           }
         } else {
           NS_WARNING("Opus decoding disabled."
                      " See media.opus.enabled in about:config");
         }
-#endif // MOZ_OPUS
       } else if (s->GetType() == OggCodecState::TYPE_SKELETON && !mSkeletonState) {
         mSkeletonState = static_cast<SkeletonState*>(s);
       } else {
         // Deactivate any non-primary bitstreams.
         s->Deactivate();
       }
 
     }
@@ -565,17 +551,17 @@ nsresult OggReader::DecodeVorbis(ogg_pac
 
     endFrame -= frames;
     if (vorbis_synthesis_read(&mVorbisState->mDsp, frames) != 0) {
       return NS_ERROR_FAILURE;
     }
   }
   return NS_OK;
 }
-#ifdef MOZ_OPUS
+
 nsresult OggReader::DecodeOpus(ogg_packet* aPacket) {
   NS_ASSERTION(aPacket->granulepos != -1, "Must know opus granulepos!");
 
   // Maximum value is 63*2880, so there's no chance of overflow.
   int32_t frames_number = opus_packet_get_nb_frames(aPacket->packet,
                                                     aPacket->bytes);
   if (frames_number <= 0)
     return NS_ERROR_FAILURE; // Invalid packet header.
@@ -677,57 +663,49 @@ nsresult OggReader::DecodeOpus(ogg_packe
                                  buffer.forget(),
                                  channels,
                                  mOpusState->mRate));
 
   mDecodedAudioFrames += frames;
 
   return NS_OK;
 }
-#endif /* MOZ_OPUS */
 
 bool OggReader::DecodeAudioData()
 {
   NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
-  DebugOnly<bool> haveCodecState = mVorbisState != nullptr
-#ifdef MOZ_OPUS
-    || mOpusState != nullptr
-#endif /* MOZ_OPUS */
-    ;
+  DebugOnly<bool> haveCodecState = mVorbisState != nullptr ||
+                                   mOpusState != nullptr;
   NS_ASSERTION(haveCodecState, "Need audio codec state to decode audio");
 
   // Read the next data packet. Skip any non-data packets we encounter.
   ogg_packet* packet = 0;
   OggCodecState* codecState;
   if (mVorbisState)
     codecState = static_cast<OggCodecState*>(mVorbisState);
-#ifdef MOZ_OPUS
   else
     codecState = static_cast<OggCodecState*>(mOpusState);
-#endif /* MOZ_OPUS */
   do {
     if (packet) {
       OggCodecState::ReleasePacket(packet);
     }
     packet = NextOggPacket(codecState);
   } while (packet && codecState->IsHeader(packet));
 
   if (!packet) {
     return false;
   }
 
   NS_ASSERTION(packet && packet->granulepos != -1,
     "Must have packet with known granulepos");
   nsAutoRef<ogg_packet> autoRelease(packet);
   if (mVorbisState) {
     DecodeVorbis(packet);
-#ifdef MOZ_OPUS
   } else if (mOpusState) {
     DecodeOpus(packet);
-#endif
   }
 
   if ((packet->e_o_s) && (!ReadOggChain())) {
     // We've encountered an end of bitstream packet, or we've hit the end of
     // file while trying to decode, so inform the audio queue that there'll
     // be no more samples.
     return false;
   }
@@ -744,19 +722,17 @@ void OggReader::SetChained(bool aIsChain
     ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
     mDecoder->SetMediaSeekable(false);
   }
 }
 
 bool OggReader::ReadOggChain()
 {
   bool chained = false;
-#ifdef MOZ_OPUS
   OpusState* newOpusState = nullptr;
-#endif /* MOZ_OPUS */
   VorbisState* newVorbisState = nullptr;
   nsAutoPtr<MetadataTags> tags;
 
   if (HasVideo() || HasSkeleton() || !HasAudio()) {
     return false;
   }
 
   ogg_page page;
@@ -773,21 +749,19 @@ bool OggReader::ReadOggChain()
   codecState = OggCodecState::Create(&page);
   if (!codecState) {
     return false;
   }
 
   if (mVorbisState && (codecState->GetType() == OggCodecState::TYPE_VORBIS)) {
     newVorbisState = static_cast<VorbisState*>(codecState.get());
   }
-#ifdef MOZ_OPUS
   else if (mOpusState && (codecState->GetType() == OggCodecState::TYPE_OPUS)) {
     newOpusState = static_cast<OpusState*>(codecState.get());
   }
-#endif
   else {
     return false;
   }
   OggCodecState* state;
 
   mCodecStore.Add(serial, codecState.forget());
   state = mCodecStore.Get(serial);
 
@@ -814,33 +788,31 @@ bool OggReader::ReadOggChain()
     }
     mInfo.mAudio.mRate = newVorbisState->mInfo.rate;
     mInfo.mAudio.mChannels = newVorbisState->mInfo.channels;
 
     chained = true;
     tags = newVorbisState->GetTags();
   }
 
-#ifdef MOZ_OPUS
   if ((newOpusState && ReadHeaders(newOpusState)) &&
       (mOpusState->mRate == newOpusState->mRate) &&
       (mOpusState->mChannels == newOpusState->mChannels)) {
 
     SetupTargetOpus(newOpusState);
 
     if (msgInfo) {
       InitTrack(msgInfo, &mInfo.mAudio.mTrackInfo, true);
     }
     mInfo.mAudio.mRate = newOpusState->mRate;
     mInfo.mAudio.mChannels = newOpusState->mChannels;
 
     chained = true;
     tags = newOpusState->GetTags();
   }
-#endif
 
   if (chained) {
     SetChained(true);
     {
       mInfo.mAudio.mHasAudio = HasAudio();
       mInfo.mVideo.mHasVideo = HasVideo();
       nsAutoPtr<MediaInfo> info(new MediaInfo());
       *info = mInfo;
@@ -1436,22 +1408,20 @@ nsresult OggReader::SeekInUnbuffered(int
   // don't do this offsetting when seeking in a buffered range,
   // as the extra decoding causes a noticeable speed hit when all the data
   // is buffered (compared to just doing a bisection to exactly find the
   // keyframe).
   int64_t keyframeOffsetMs = 0;
   if (HasVideo() && mTheoraState) {
     keyframeOffsetMs = mTheoraState->MaxKeyframeOffset();
   }
-#ifdef MOZ_OPUS
   // Add in the Opus pre-roll if necessary, as well.
   if (HasAudio() && mOpusState) {
     keyframeOffsetMs = std::max(keyframeOffsetMs, SEEK_OPUS_PREROLL);
   }
-#endif /* MOZ_OPUS */
   int64_t seekTarget = std::max(aStartTime, aTarget - keyframeOffsetMs);
   // Minimize the bisection search space using the known timestamps from the
   // buffered ranges.
   SeekRange k = SelectSeekRange(aRanges, seekTarget, aStartTime, aEndTime, false);
   return SeekBisection(seekTarget, k, SEEK_FUZZ_USECS);
 }
 
 void OggReader::Seek(int64_t aTarget,
@@ -1471,21 +1441,19 @@ nsresult OggReader::SeekInternal(int64_t
   NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
   if (mIsChained)
     return NS_ERROR_FAILURE;
   LOG(PR_LOG_DEBUG, ("%p About to seek to %lld", mDecoder, aTarget));
   nsresult res;
   MediaResource* resource = mDecoder->GetResource();
   NS_ENSURE_TRUE(resource != nullptr, NS_ERROR_FAILURE);
   int64_t adjustedTarget = aTarget;
-#ifdef MOZ_OPUS
   if (HasAudio() && mOpusState){
     adjustedTarget = std::max(aStartTime, aTarget - SEEK_OPUS_PREROLL);
   }
-#endif /* MOZ_OPUS */
 
   if (adjustedTarget == aStartTime) {
     // We've seeked to the media start. Just seek to the offset of the first
     // content page.
     res = resource->Seek(nsISeekableStream::NS_SEEK_SET, 0);
     NS_ENSURE_SUCCESS(res,res);
 
     res = ResetDecode(true);
@@ -1783,20 +1751,18 @@ nsresult OggReader::SeekBisection(int64_
           NS_ENSURE_TRUE(ret == 0, NS_ERROR_FAILURE);
         }
 
         ogg_int64_t granulepos = ogg_page_granulepos(&page);
 
         if (HasAudio() && granulepos > 0 && audioTime == -1) {
           if (mVorbisState && serial == mVorbisState->mSerial) {
             audioTime = mVorbisState->Time(granulepos);
-#ifdef MOZ_OPUS
           } else if (mOpusState && serial == mOpusState->mSerial) {
             audioTime = mOpusState->Time(granulepos);
-#endif
           }
         }
 
         if (HasVideo() &&
             granulepos > 0 &&
             serial == mTheoraState->mSerial &&
             videoTime == -1) {
           videoTime = mTheoraState->Time(granulepos);
@@ -1961,22 +1927,20 @@ nsresult OggReader::GetBuffered(dom::Tim
         continue;
       }
 
       uint32_t serial = ogg_page_serialno(&page);
       if (mVorbisState && serial == mVorbisSerial) {
         startTime = VorbisState::Time(&mVorbisInfo, granulepos);
         NS_ASSERTION(startTime > 0, "Must have positive start time");
       }
-#ifdef MOZ_OPUS
       else if (mOpusState && serial == mOpusSerial) {
         startTime = OpusState::Time(mOpusPreSkip, granulepos);
         NS_ASSERTION(startTime > 0, "Must have positive start time");
       }
-#endif /* MOZ_OPUS */
       else if (mTheoraState && serial == mTheoraSerial) {
         startTime = TheoraState::Time(&mTheoraInfo, granulepos);
         NS_ASSERTION(startTime > 0, "Must have positive start time");
       }
       else if (mCodecStore.Contains(serial)) {
         // Stream is not the theora or vorbis stream we're playing,
         // but is one that we have header data for.
         startOffset += page.header_len + page.body_len;
--- a/dom/media/ogg/OggReader.h
+++ b/dom/media/ogg/OggReader.h
@@ -60,21 +60,18 @@ public:
 
   // If the Theora granulepos has not been captured, it may read several packets
   // until one with a granulepos has been captured, to ensure that all packets
   // read have valid time info.
   virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
                                   int64_t aTimeThreshold);
 
   virtual bool HasAudio() {
-    return (mVorbisState != 0 && mVorbisState->mActive)
-#ifdef MOZ_OPUS
-      || (mOpusState != 0 && mOpusState->mActive)
-#endif /* MOZ_OPUS */
-      ;
+    return (mVorbisState != 0 && mVorbisState->mActive) ||
+           (mOpusState != 0 && mOpusState->mActive);
   }
 
   virtual bool HasVideo() {
     return mTheoraState != 0 && mTheoraState->mActive;
   }
 
   virtual nsresult ReadMetadata(MediaInfo* aInfo,
                                 MetadataTags** aTags);
@@ -280,25 +277,23 @@ private:
   OggCodecStore mCodecStore;
 
   // Decode state of the Theora bitstream we're decoding, if we have video.
   TheoraState* mTheoraState;
 
   // Decode state of the Vorbis bitstream we're decoding, if we have audio.
   VorbisState* mVorbisState;
 
-#ifdef MOZ_OPUS
   // Decode state of the Opus bitstream we're decoding, if we have one.
   OpusState *mOpusState;
 
   // Represents the user pref media.opus.enabled at the time our
   // contructor was called. We can't check it dynamically because
   // we're not on the main thread;
   bool mOpusEnabled;
-#endif /* MOZ_OPUS */
 
   // Decode state of the Skeleton bitstream.
   SkeletonState* mSkeletonState;
 
   // Ogg decoding state.
   ogg_sync_state mOggState;
 
   // Vorbis/Opus/Theora data used to compute timestamps. This is written on the
--- a/dom/media/webm/WebMReader.cpp
+++ b/dom/media/webm/WebMReader.cpp
@@ -164,34 +164,30 @@ ogg_packet InitOggPacket(const unsigned 
 #if defined(MOZ_PDM_VPX)
 static bool sIsIntelDecoderEnabled = false;
 #endif
 
 WebMReader::WebMReader(AbstractMediaDecoder* aDecoder)
   : MediaDecoderReader(aDecoder)
   , mContext(nullptr)
   , mPacketCount(0)
-#ifdef MOZ_OPUS
   , mOpusDecoder(nullptr)
   , mSkip(0)
   , mSeekPreroll(0)
-#endif
   , mVideoTrack(0)
   , mAudioTrack(0)
   , mAudioStartUsec(-1)
   , mAudioFrames(0)
   , mLastVideoFrameTime(0)
   , mAudioCodec(-1)
   , mVideoCodec(-1)
   , mLayersBackendType(layers::LayersBackend::LAYERS_NONE)
   , mHasVideo(false)
   , mHasAudio(false)
-#ifdef MOZ_OPUS
   , mPaddingDiscarded(false)
-#endif
 {
   MOZ_COUNT_CTOR(WebMReader);
 #ifdef PR_LOGGING
   if (!gNesteggLog) {
     gNesteggLog = PR_NewLogModule("Nestegg");
   }
 #endif
   // Zero these member vars to avoid crashes in VP8 destroy and Vorbis clear
@@ -299,25 +295,23 @@ nsresult WebMReader::ResetDecode()
     res = NS_ERROR_FAILURE;
   }
 
   if (mAudioCodec == NESTEGG_CODEC_VORBIS) {
     // Ignore failed results from vorbis_synthesis_restart. They
     // aren't fatal and it fails when ResetDecode is called at a
     // time when no vorbis data has been read.
     vorbis_synthesis_restart(&mVorbisDsp);
-#ifdef MOZ_OPUS
   } else if (mAudioCodec == NESTEGG_CODEC_OPUS) {
     if (mOpusDecoder) {
       // Reset the decoder.
       opus_multistream_decoder_ctl(mOpusDecoder, OPUS_RESET_STATE);
       mSkip = mOpusParser->mPreSkip;
       mPaddingDiscarded = false;
     }
-#endif
   }
 
   mVideoPackets.Reset();
   mAudioPackets.Reset();
 
   return res;
 }
 
@@ -509,17 +503,16 @@ nsresult WebMReader::ReadMetadata(MediaI
         r = vorbis_block_init(&mVorbisDsp, &mVorbisBlock);
         if (r != 0) {
           Cleanup();
           return NS_ERROR_FAILURE;
         }
 
         mInfo.mAudio.mRate = mVorbisDsp.vi->rate;
         mInfo.mAudio.mChannels = mVorbisDsp.vi->channels;
-#ifdef MOZ_OPUS
       } else if (mAudioCodec == NESTEGG_CODEC_OPUS) {
         unsigned char* data = 0;
         size_t length = 0;
         r = nestegg_track_codec_data(mContext, track, 0, &data, &length);
         if (r == -1) {
           Cleanup();
           return NS_ERROR_FAILURE;
         }
@@ -542,17 +535,16 @@ nsresult WebMReader::ReadMetadata(MediaI
           Cleanup();
           return NS_ERROR_FAILURE;
         }
 
         mInfo.mAudio.mRate = mOpusParser->mRate;
 
         mInfo.mAudio.mChannels = mOpusParser->mChannels;
         mSeekPreroll = params.seek_preroll;
-#endif
       } else {
         Cleanup();
         return NS_ERROR_FAILURE;
       }
     }
   }
 
   *aInfo = mInfo;
@@ -563,17 +555,16 @@ nsresult WebMReader::ReadMetadata(MediaI
 }
 
 bool
 WebMReader::IsMediaSeekable()
 {
   return mContext && nestegg_has_cues(mContext);
 }
 
-#ifdef MOZ_OPUS
 bool WebMReader::InitOpusDecoder()
 {
   int r;
 
   NS_ASSERTION(mOpusDecoder == nullptr, "leaking OpusDecoder");
 
   mOpusDecoder = opus_multistream_decoder_create(mOpusParser->mRate,
                                                  mOpusParser->mChannels,
@@ -581,17 +572,16 @@ bool WebMReader::InitOpusDecoder()
                                                  mOpusParser->mCoupledStreams,
                                                  mOpusParser->mMappingTable,
                                                  &r);
   mSkip = mOpusParser->mPreSkip;
   mPaddingDiscarded = false;
 
   return r == OPUS_OK;
 }
-#endif
 
 bool WebMReader::DecodeAudioPacket(nestegg_packet* aPacket, int64_t aOffset)
 {
   NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
 
   int r = 0;
   unsigned int count = 0;
   r = nestegg_packet_count(aPacket, &count);
@@ -648,21 +638,19 @@ bool WebMReader::DecodeAudioPacket(neste
     if (r == -1) {
       return false;
     }
     if (mAudioCodec == NESTEGG_CODEC_VORBIS) {
       if (!DecodeVorbis(data, length, aOffset, tstamp_usecs, &total_frames)) {
         return false;
       }
     } else if (mAudioCodec == NESTEGG_CODEC_OPUS) {
-#ifdef MOZ_OPUS
       if (!DecodeOpus(data, length, aOffset, tstamp_usecs, aPacket)) {
         return false;
       }
-#endif
     }
   }
 
   return true;
 }
 
 bool WebMReader::DecodeVorbis(const unsigned char* aData, size_t aLength,
                               int64_t aOffset, uint64_t aTstampUsecs,
@@ -734,17 +722,16 @@ bool WebMReader::DecodeVorbis(const unsi
     }
 
     frames = vorbis_synthesis_pcmout(&mVorbisDsp, &pcm);
   }
 
   return true;
 }
 
-#ifdef MOZ_OPUS
 bool WebMReader::DecodeOpus(const unsigned char* aData, size_t aLength,
                             int64_t aOffset, uint64_t aTstampUsecs,
                             nestegg_packet* aPacket)
 {
   uint32_t channels = mOpusParser->mChannels;
   // No channel mapping for more than 8 channels.
   if (channels > 8) {
     return false;
@@ -871,17 +858,16 @@ bool WebMReader::DecodeOpus(const unsign
                                   buffer.forget(),
                                   mInfo.mAudio.mChannels,
                                   mInfo.mAudio.mRate));
 
   mAudioFrames += frames;
 
   return true;
 }
-#endif /* MOZ_OPUS */
 
 nsReturnRef<NesteggPacketHolder> WebMReader::NextPacket(TrackType aTrackType)
 {
   // The packet queue that packets will be pushed on if they
   // are not the type we are interested in.
   WebMPacketQueue& otherPackets =
     aTrackType == VIDEO ? mAudioPackets : mVideoPackets;
 
--- a/dom/media/webm/WebMReader.h
+++ b/dom/media/webm/WebMReader.h
@@ -19,19 +19,17 @@
 #include "mozilla/layers/LayersTypes.h"
 
 #ifdef MOZ_TREMOR
 #include "tremor/ivorbiscodec.h"
 #else
 #include "vorbis/codec.h"
 #endif
 
-#ifdef MOZ_OPUS
 #include "OpusParser.h"
-#endif
 
 // Holds a nestegg_packet, and its file offset. This is needed so we
 // know the offset in the file we've played up to, in order to calculate
 // whether it's likely we can play through to the end without needing
 // to stop to buffer, given the current download rate.
 class NesteggPacketHolder {
 public:
   NesteggPacketHolder(nestegg_packet* aPacket, int64_t aOffset)
@@ -185,36 +183,32 @@ public:
   nsIntRect GetPicture();
   nsIntSize GetInitialFrame();
   uint64_t GetLastVideoFrameTime();
   void SetLastVideoFrameTime(uint64_t aFrameTime);
   layers::LayersBackend GetLayersBackendType() { return mLayersBackendType; }
   MediaTaskQueue* GetTaskQueue() { return mTaskQueue; }
 
 protected:
-#ifdef MOZ_OPUS
   // Setup opus decoder
   bool InitOpusDecoder();
-#endif
 
   // Decode a nestegg packet of audio data. Push the audio data on the
   // audio queue. Returns true when there's more audio to decode,
   // false if the audio is finished, end of file has been reached,
   // or an un-recoverable read error has occured. The reader's monitor
   // must be held during this call. The caller is responsible for freeing
   // aPacket.
   bool DecodeAudioPacket(nestegg_packet* aPacket, int64_t aOffset);
   bool DecodeVorbis(const unsigned char* aData, size_t aLength,
                     int64_t aOffset, uint64_t aTstampUsecs,
                     int32_t* aTotalFrames);
-#ifdef MOZ_OPUS
   bool DecodeOpus(const unsigned char* aData, size_t aLength,
                   int64_t aOffset, uint64_t aTstampUsecs,
                   nestegg_packet* aPacket);
-#endif
 
   // Release context and set to null. Called when an error occurs during
   // reading metadata or destruction of the reader itself.
   void Cleanup();
 
   virtual nsresult SeekInternal(int64_t aTime, int64_t aStartTime);
 
   // Initializes mLayersBackendType if possible.
@@ -230,23 +224,21 @@ private:
 
   // Vorbis decoder state
   vorbis_info mVorbisInfo;
   vorbis_comment mVorbisComment;
   vorbis_dsp_state mVorbisDsp;
   vorbis_block mVorbisBlock;
   int64_t mPacketCount;
 
-#ifdef MOZ_OPUS
   // Opus decoder state
   nsAutoPtr<OpusParser> mOpusParser;
   OpusMSDecoder *mOpusDecoder;
   uint16_t mSkip;        // Samples left to trim before playback.
   uint64_t mSeekPreroll; // Nanoseconds to discard after seeking.
-#endif
 
   // Queue of video and audio packets that have been read but not decoded. These
   // must only be accessed from the state machine thread.
   WebMPacketQueue mVideoPackets;
   WebMPacketQueue mAudioPackets;
 
   // Index of video and audio track to play
   uint32_t mVideoTrack;
@@ -283,19 +275,17 @@ private:
 
   layers::LayersBackend mLayersBackendType;
   nsRefPtr<MediaTaskQueue> mTaskQueue;
 
   // Booleans to indicate if we have audio and/or video data
   bool mHasVideo;
   bool mHasAudio;
 
-#ifdef MOZ_OPUS
   // Opus padding should only be discarded on the final packet.  Once this
   // is set to true, if the reader attempts to decode any further packets it
   // will raise an error so we can indicate that the file is invalid.
   bool mPaddingDiscarded;
-#endif
 };
 
 } // namespace mozilla
 
 #endif
--- a/layout/media/symbols.def.in
+++ b/layout/media/symbols.def.in
@@ -148,17 +148,16 @@ th_decode_headerin
 th_decode_packetin
 th_decode_ycbcr_out
 th_granule_frame
 th_info_clear
 th_info_init
 th_packet_isheader
 th_packet_iskeyframe
 th_setup_free
-#ifdef MOZ_OPUS
 opus_decoder_create
 opus_decoder_destroy
 opus_decoder_ctl
 opus_decoder_get_nb_samples
 opus_decode
 opus_decode_float
 opus_multistream_decoder_create
 opus_multistream_decoder_ctl
@@ -167,17 +166,16 @@ opus_multistream_decode_float
 opus_multistream_decode
 opus_packet_get_nb_frames
 opus_packet_get_samples_per_frame
 opus_encoder_create
 opus_encoder_destroy
 opus_encoder_ctl
 opus_encode
 opus_encode_float
-#endif
 #ifndef MOZ_NATIVE_PNG
 MOZ_APNG_get_first_frame_is_hidden
 MOZ_APNG_get_next_frame_blend_op
 MOZ_APNG_get_next_frame_delay_den
 MOZ_APNG_get_next_frame_delay_num
 MOZ_APNG_get_next_frame_dispose_op
 MOZ_APNG_set_prog_frame_fn
 MOZ_APNG_get_next_frame_height
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -271,19 +271,17 @@ pref("media.fragmented-mp4.exposed", fal
 // just outputs blank frames/audio instead of actually decoding. The blank
 // decoder works on all platforms.
 pref("media.fragmented-mp4.use-blank-decoder", false);
 #endif
 #ifdef MOZ_RAW
 pref("media.raw.enabled", true);
 #endif
 pref("media.ogg.enabled", true);
-#ifdef MOZ_OPUS
 pref("media.opus.enabled", true);
-#endif
 #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
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -453,19 +453,17 @@ static nsDefaultMimeTypeEntry defaultMim
   { APPLICATION_XPINSTALL, "xpi" },
   { "application/xhtml+xml", "xhtml" },
   { "application/xhtml+xml", "xht" },
   { TEXT_PLAIN, "txt" },
   { VIDEO_OGG, "ogv" },
   { VIDEO_OGG, "ogg" },
   { APPLICATION_OGG, "ogg" },
   { AUDIO_OGG, "oga" },
-#ifdef MOZ_OPUS
   { AUDIO_OGG, "opus" },
-#endif
 #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" },