Bug 1332622 - Remove MOZILLA_INTERNAL_API macro from webrtc; r=jesup
authorDan Minor <dminor@mozilla.com>
Wed, 22 Feb 2017 09:07:32 -0500
changeset 373762 be46bf0c2fd6c7526a304d96efa2ecfb16ee5676
parent 373761 94dabc6479b22c85b59722f94cebf7371f0de4d0
child 373763 ea22d7caa61894c693987966aa2c2a5c984f3ed9
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1332622
milestone54.0a1
Bug 1332622 - Remove MOZILLA_INTERNAL_API macro from webrtc; r=jesup I've also cleaned up a few leftover references to USE_FAKE_MEDIA_STREAMS, MOZILLA_EXTERNAL_LINKAGE and MOZ_WIDGET_GONK where I noticed them. MozReview-Commit-ID: Cdo1Y4IrFqp
media/webrtc/signaling/signaling.gyp
media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp
media/webrtc/signaling/src/media-conduit/CodecStatistics.cpp
media/webrtc/signaling/src/media-conduit/CodecStatistics.h
media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
media/webrtc/signaling/src/peerconnection/MediaStreamList.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
media/webrtc/trunk/webrtc/modules/audio_device/android/opensles_player.cc
media/webrtc/trunk/webrtc/modules/audio_device/mac/audio_device_mac.cc
--- a/media/webrtc/signaling/signaling.gyp
+++ b/media/webrtc/signaling/signaling.gyp
@@ -253,52 +253,44 @@
             './src/media-conduit/MediaCodecVideoCodec.cpp',
             './src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp',
           ],
           'defines' : [
             'MOZ_WEBRTC_MEDIACODEC',
           ],
         }],
         ['(build_for_test==0) and (build_for_standalone==0)', {
-          'defines' : [
-            'MOZILLA_INTERNAL_API',
-          ],
           'sources': [
             './src/peerconnection/MediaStreamList.cpp',
             './src/peerconnection/MediaStreamList.h',
             './src/peerconnection/WebrtcGlobalInformation.cpp',
             './src/peerconnection/WebrtcGlobalInformation.h',
           ],
         }],
         ['build_for_test!=0', {
           'include_dirs': [
             './test'
           ],
           'defines' : [
             'NO_CHROMIUM_LOGGING',
-            'USE_FAKE_MEDIA_STREAMS',
             'USE_FAKE_PCOBSERVER',
-            'MOZILLA_EXTERNAL_LINKAGE',
           ],
         }],
         ['build_for_standalone==0', {
           'sources': [
             './src/media-conduit/GmpVideoCodec.cpp',
             './src/media-conduit/WebrtcGmpVideoCodec.cpp',
           ],
         }],
         ['build_for_standalone!=0', {
           'include_dirs': [
             './test'
           ],
           'defines' : [
-            'MOZILLA_INTERNAL_API',
-            'MOZILLA_EXTERNAL_LINKAGE',
             'NO_CHROMIUM_LOGGING',
-            'USE_FAKE_MEDIA_STREAMS',
             'USE_FAKE_PCOBSERVER',
           ],
         }],
         ['(OS=="linux") or (OS=="android")', {
           'include_dirs': [
           ],
 
           'defines': [
--- a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp
+++ b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp
@@ -7,23 +7,19 @@
 #include "mozilla/Logging.h"
 #include "mozilla/StaticPtr.h"
 #include "prenv.h"
 #include "webrtc/system_wrappers/include/trace.h"
 #include "webrtc/common_types.h"
 #include "webrtc/base/logging.h"
 
 #include "nscore.h"
-#ifdef MOZILLA_INTERNAL_API
 #include "nsString.h"
 #include "nsXULAppAPI.h"
 #include "mozilla/Preferences.h"
-#else
-#include "nsStringAPI.h"
-#endif
 
 #include "nsIFile.h"
 #include "nsDirectoryServiceUtils.h"
 #include "nsDirectoryServiceDefs.h"
 
 using mozilla::LogLevel;
 
 static int gWebRtcTraceLoggingOn = 0;
@@ -58,26 +54,24 @@ private:
   }
 };
 
 // For WEBRTC_TRACE()
 static WebRtcTraceCallback gWebRtcCallback;
 // For LOG()
 static mozilla::StaticAutoPtr<LogSinkImpl> sSink;
 
-#ifdef MOZILLA_INTERNAL_API
 void GetWebRtcLogPrefs(uint32_t *aTraceMask, nsACString* aLogFile, nsACString *aAECLogDir, bool *aMultiLog)
 {
   *aMultiLog = mozilla::Preferences::GetBool("media.webrtc.debug.multi_log");
   *aTraceMask = mozilla::Preferences::GetUint("media.webrtc.debug.trace_mask");
   mozilla::Preferences::GetCString("media.webrtc.debug.log_file", aLogFile);
   mozilla::Preferences::GetCString("media.webrtc.debug.aec_log_dir", aAECLogDir);
   webrtc::Trace::set_aec_debug_size(mozilla::Preferences::GetUint("media.webrtc.debug.aec_dump_max_size"));
 }
-#endif
 
 mozilla::LogLevel
 CheckOverrides(uint32_t *aTraceMask, nsACString *aLogFile, bool *aMultiLog)
 {
   mozilla::LogModule *log_info = sWebRtcLog;
   mozilla::LogLevel log_level = log_info->Level();
 
   if (!aTraceMask || !aLogFile || !aMultiLog) {
@@ -208,19 +202,17 @@ void StartWebRtcLog(uint32_t log_level)
     return;
   }
 
   uint32_t trace_mask = 0;
   bool multi_log = false;
   nsAutoCString log_file;
   nsAutoCString aec_log_dir;
 
-#ifdef MOZILLA_INTERNAL_API
   GetWebRtcLogPrefs(&trace_mask, &log_file, &aec_log_dir, &multi_log);
-#endif
   mozilla::LogLevel level = CheckOverrides(&trace_mask, &log_file, &multi_log);
 
   if (trace_mask == 0) {
     trace_mask = log_level;
   }
 
   ConfigWebRtcLog(level, trace_mask, log_file, aec_log_dir, multi_log);
   return;
@@ -233,19 +225,17 @@ void EnableWebRtcLog()
     return;
   }
 
   uint32_t trace_mask = 0;
   bool multi_log = false;
   nsAutoCString log_file;
   nsAutoCString aec_log_dir;
 
-#ifdef MOZILLA_INTERNAL_API
   GetWebRtcLogPrefs(&trace_mask, &log_file, &aec_log_dir, &multi_log);
-#endif
   mozilla::LogLevel level = CheckOverrides(&trace_mask, &log_file, &multi_log);
   ConfigWebRtcLog(level, trace_mask, log_file, aec_log_dir, multi_log);
   return;
 }
 
 void StopWebRtcLog()
 {
   // TODO(NG) strip/fix gWebRtcTraceLoggingOn which is never set to true
@@ -290,19 +280,17 @@ void StartAecLog()
   if (webrtc::Trace::aec_debug()) {
     return;
   }
   uint32_t trace_mask = 0;
   bool multi_log = false;
   nsAutoCString log_file;
   nsAutoCString aec_log_dir;
 
-#ifdef MOZILLA_INTERNAL_API
   GetWebRtcLogPrefs(&trace_mask, &log_file, &aec_log_dir, &multi_log);
-#endif
   CheckOverrides(&trace_mask, &log_file, &multi_log);
   ConfigAecLog(aec_log_dir);
 
   webrtc::Trace::set_aec_debug(true);
 }
 
 void StopAecLog()
 {
--- a/media/webrtc/signaling/src/media-conduit/CodecStatistics.cpp
+++ b/media/webrtc/signaling/src/media-conduit/CodecStatistics.cpp
@@ -17,21 +17,19 @@ VideoCodecStatistics::VideoCodecStatisti
                                            ViECodec* codec) :
   mChannel(channel),
   mSentRawFrames(0),
   mPtrViECodec(codec),
   mEncoderDroppedFrames(0),
   mDecoderDiscardedPackets(0),
   mRegisteredEncode(false),
   mRegisteredDecode(false),
-  mReceiveState(kReceiveStateInitial)
-#ifdef MOZILLA_INTERNAL_API
-  , mRecoveredBeforeLoss(0)
-  , mRecoveredLosses(0)
-#endif
+  mReceiveState(kReceiveStateInitial),
+  mRecoveredBeforeLoss(0),
+  mRecoveredLosses(0)
 {
   MOZ_ASSERT(mPtrViECodec);
 }
 
 VideoCodecStatistics::~VideoCodecStatistics()
 {
   if (mRegisteredEncode) {
     mPtrViECodec->DeregisterEncoderObserver(mChannel);
@@ -87,17 +85,16 @@ void VideoCodecStatistics::IncomingRate(
   mDecoderFps.Push(framerate);
   mDecoderDiscardedPackets += discarded;
 }
 
 void VideoCodecStatistics::ReceiveStateChange(const int aChannel,
                                               VideoReceiveState aState)
 {
   CSFLogDebug(logTag,"New state for %d: %d (was %d)", aChannel, aState, mReceiveState);
-#ifdef MOZILLA_INTERNAL_API
   if (mFirstDecodeTime.IsNull()) {
     mFirstDecodeTime = TimeStamp::Now();
   }
   /*
    * Invalid transitions:
    * WaitingKey -> PreemptiveNACK
    * DecodingWithErrors -> PreemptiveNACK
    */
@@ -129,24 +126,21 @@ void VideoCodecStatistics::ReceiveStateC
 
           mRecoveredLosses++; // to calculate losses per minute
           mTotalLossTime += timeDelta;  // To calculate % time in recovery
         }
       } // else non-Normal to different non-normal transition
       break;
   }
 
-#endif
-
   mReceiveState = aState;
 }
 
 void VideoCodecStatistics::EndOfCallStats()
 {
-#ifdef MOZILLA_INTERNAL_API
   if (!mFirstDecodeTime.IsNull()) {
     TimeDuration callDelta = TimeStamp::Now() - mFirstDecodeTime;
     if (callDelta.ToSeconds() != 0) {
       uint32_t recovered_per_min = mRecoveredBeforeLoss/(callDelta.ToSeconds()/60);
       CSFLogError(logTag, "Video recovery before error per min %u", recovered_per_min);
       Telemetry::Accumulate(Telemetry::WEBRTC_VIDEO_RECOVERY_BEFORE_ERROR_PER_MIN,
                             recovered_per_min);
       uint32_t err_per_min = mRecoveredLosses/(callDelta.ToSeconds()/60);
@@ -154,17 +148,16 @@ void VideoCodecStatistics::EndOfCallStat
       Telemetry::Accumulate(Telemetry::WEBRTC_VIDEO_RECOVERY_AFTER_ERROR_PER_MIN,
                             err_per_min);
       float percent = (mTotalLossTime.ToSeconds()*100)/callDelta.ToSeconds();
       CSFLogError(logTag, "Video error time percentage %f%%", percent);
       Telemetry::Accumulate(Telemetry::WEBRTC_VIDEO_DECODE_ERROR_TIME_PERMILLE,
                             static_cast<uint32_t>(percent*10));
     }
   }
-#endif
 }
 
 void VideoCodecStatistics::SentFrame()
 {
   mSentRawFrames++;
 }
 
 void VideoCodecStatistics::Dump()
--- a/media/webrtc/signaling/src/media-conduit/CodecStatistics.h
+++ b/media/webrtc/signaling/src/media-conduit/CodecStatistics.h
@@ -92,20 +92,18 @@ private:
   uint32_t mEncoderDroppedFrames;
   RunningStat mDecoderBitRate;
   RunningStat mDecoderFps;
   uint32_t mDecoderDiscardedPackets;
   bool mRegisteredEncode;
   bool mRegisteredDecode;
 
   webrtc::VideoReceiveState mReceiveState;
-#ifdef MOZILLA_INTERNAL_API
   TimeStamp mFirstDecodeTime;
   TimeStamp mReceiveFailureTime;
   TimeDuration mTotalLossTime;
   uint32_t mRecoveredBeforeLoss;
   uint32_t mRecoveredLosses;
-#endif
 };
 
 }
 
 #endif //CODEC_STATISTICS_H_
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
@@ -23,17 +23,17 @@
 #include "pk11pub.h"
 
 #include "webrtc/common_types.h"
 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
 
 #include "mozilla/Unused.h"
 
-#if defined(MOZ_WIDGET_ANDROID) && defined(MOZILLA_INTERNAL_API)
+#if defined(MOZ_WIDGET_ANDROID)
 #include "AndroidJNIWrapper.h"
 #include "VideoEngine.h"
 #endif
 
 #include "GmpVideoCodec.h"
 #ifdef MOZ_WEBRTC_OMX
 #include "OMXCodecWrapper.h"
 #include "OMXVideoCodec.h"
@@ -841,17 +841,16 @@ WebrtcVideoConduit::GetRTCPSenderReport(
   // was received (remote) or sent (local)
   *timestamp = webrtc::Clock::GetRealTimeClock()->TimeInMilliseconds();
   return true;
 }
 
 MediaConduitErrorCode
 WebrtcVideoConduit::InitMain()
 {
-#if defined(MOZILLA_INTERNAL_API)
   // already know we must be on MainThread barring unit test weirdness
   MOZ_ASSERT(NS_IsMainThread());
 
   nsresult rv;
   nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
   if (!NS_WARN_IF(NS_FAILED(rv))) {
     nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(prefs);
 
@@ -911,18 +910,17 @@ WebrtcVideoConduit::InitMain()
 #ifdef MOZ_WIDGET_ANDROID
   // get the JVM
   JavaVM *jvm = jsjni_GetVM();
 
   if (mozilla::camera::VideoEngine::SetAndroidObjects(jvm) != 0) {
     CSFLogError(logTag,  "%s: could not set Android objects", __FUNCTION__);
     return kMediaConduitSessionNotInited;
   }
-#endif
-#endif
+#endif  //MOZ_WIDGET_ANDROID
   return kMediaConduitNoError;
 }
 
 /**
  * Performs initialization of the MANDATORY components of the Video Engine
  */
 MediaConduitErrorCode
 WebrtcVideoConduit::Init()
@@ -1186,20 +1184,18 @@ WebrtcVideoConduit::CreateDecoder(webrtc
 #endif
     if (decoder) {
       mRecvCodecPlugin = static_cast<WebrtcVideoDecoder*>(decoder);
     }
 #ifdef MOZ_WEBRTC_MEDIACODEC
   } else if (aType == webrtc::VideoDecoder::kVp8) {
     bool enabled = false;
     // attempt to get a decoder
-#ifdef MOZILLA_INTERNAL_API
     enabled = mozilla::Preferences::GetBool(
                   "media.navigator.hardware.vp8_decode.acceleration_enabled", false);
-#endif
     if (enabled) {
       nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
       if (gfxInfo) {
         int32_t status;
         nsCString discardFailureId;
 
         if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(
                              nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_DECODE,
@@ -1241,20 +1237,18 @@ WebrtcVideoConduit::CreateEncoder(webrtc
 #endif
     if (encoder) {
       mSendCodecPlugin = static_cast<WebrtcVideoEncoder*>(encoder);
     }
 #ifdef MOZ_WEBRTC_MEDIACODEC
   } else if (aType == webrtc::VideoEncoder::kVp8) {
     bool enabled = false;
     // attempt to get a encoder
-#ifdef MOZILLA_INTERNAL_API
     enabled = mozilla::Preferences::GetBool(
                   "media.navigator.hardware.vp8_encode.acceleration_enabled", false);
-#endif
     if (enabled) {
       nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
       if (gfxInfo) {
         int32_t status;
         nsCString discardFailureId;
 
         if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(
                          nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_ENCODE,
--- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
+++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
@@ -26,29 +26,18 @@
 #include "gmp-video-frame-encoded.h"
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
-#ifdef MOZILLA_INTERNAL_API
 extern mozilla::LogModule* GetGMPLog();
-#else
-// For CPP unit tests
-PRLogModuleInfo*
-GetGMPLog()
-{
-  static PRLogModuleInfo *sLog;
-  if (!sLog)
-    sLog = PR_NewLogModule("GMP");
-  return sLog;
-}
-#endif
+
 #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
 #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
 
 WebrtcGmpPCHandleSetter::WebrtcGmpPCHandleSetter(const std::string& aPCHandle)
 {
   if (!NS_IsMainThread()) {
     MOZ_ASSERT(false, "WebrtcGmpPCHandleSetter can only be used on main");
     return;
@@ -85,22 +74,20 @@ WebrtcGmpVideoEncoder::WebrtcGmpVideoEnc
   : mGMP(nullptr)
   , mInitting(false)
   , mHost(nullptr)
   , mMaxPayloadSize(0)
   , mCallbackMutex("WebrtcGmpVideoEncoder encoded callback mutex")
   , mCallback(nullptr)
   , mCachedPluginId(0)
 {
-#ifdef MOZILLA_INTERNAL_API
   if (mPCHandle.empty()) {
     mPCHandle = WebrtcGmpPCHandleSetter::GetCurrentHandle();
   }
   MOZ_ASSERT(!mPCHandle.empty());
-#endif
 }
 
 WebrtcGmpVideoEncoder::~WebrtcGmpVideoEncoder()
 {
   // We should not have been destroyed if we never closed our GMP
   MOZ_ASSERT(!mGMP);
 }
 
@@ -652,22 +639,20 @@ WebrtcGmpVideoDecoder::WebrtcGmpVideoDec
   mGMP(nullptr),
   mInitting(false),
   mHost(nullptr),
   mCallbackMutex("WebrtcGmpVideoDecoder decoded callback mutex"),
   mCallback(nullptr),
   mCachedPluginId(0),
   mDecoderStatus(GMPNoErr)
 {
-#ifdef MOZILLA_INTERNAL_API
   if (mPCHandle.empty()) {
     mPCHandle = WebrtcGmpPCHandleSetter::GetCurrentHandle();
   }
   MOZ_ASSERT(!mPCHandle.empty());
-#endif
 }
 
 WebrtcGmpVideoDecoder::~WebrtcGmpVideoDecoder()
 {
   // We should not have been destroyed if we never closed our GMP
   MOZ_ASSERT(!mGMP);
 }
 
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -1449,21 +1449,16 @@ void MediaPipelineTransmit::AttachToTrac
       domtrack_->AddDirectListener(listener_);
     }
     domtrack_->AddListener(listener_);
   } else if (VideoStreamTrack* video = domtrack_->AsVideoStreamTrack()) {
     video->AddVideoOutput(listener_);
   } else {
     MOZ_ASSERT(false, "Unknown track type");
   }
-
-#ifndef MOZILLA_INTERNAL_API
-  // this enables the unit tests that can't fiddle with principals and the like
-  listener_->SetEnabled(true);
-#endif
 }
 
 bool
 MediaPipelineTransmit::IsVideo() const
 {
   return !!domtrack_->AsVideoStreamTrack();
 }
 
@@ -2084,20 +2079,18 @@ void MediaPipelineReceiveAudio::SetPrinc
 
 class MediaPipelineReceiveVideo::PipelineListener
   : public GenericReceiveListener {
 public:
   PipelineListener(SourceMediaStream * source, TrackID track_id)
     : GenericReceiveListener(source, track_id),
       width_(0),
       height_(0),
-#if defined(MOZILLA_INTERNAL_API)
       image_container_(),
       image_(),
-#endif
       monitor_("Video PipelineListener")
   {
     image_container_ =
       LayerManager::CreateImageContainer(ImageContainer::ASYNCHRONOUS);
   }
 
   // Implement MediaStreamListener
   void NotifyPull(MediaStreamGraph* graph, StreamTime desired_time) override
@@ -2147,26 +2140,21 @@ public:
   void RenderVideoFrame(const unsigned char* buffer,
                         size_t buffer_size,
                         uint32_t y_stride,
                         uint32_t cbcr_stride,
                         uint32_t time_stamp,
                         int64_t render_time,
                         const RefPtr<layers::Image>& video_image)
   {
-#ifdef MOZILLA_INTERNAL_API
     ReentrantMonitorAutoEnter enter(monitor_);
 
     if (buffer) {
       // Create a video frame using |buffer|.
-#ifdef MOZ_WIDGET_GONK
-      RefPtr<PlanarYCbCrImage> yuvImage = new GrallocImage();
-#else
       RefPtr<PlanarYCbCrImage> yuvImage = image_container_->CreatePlanarYCbCrImage();
-#endif // MOZ_WIDGET_GONK
       uint8_t* frame = const_cast<uint8_t*>(static_cast<const uint8_t*> (buffer));
 
       PlanarYCbCrData yuvData;
       yuvData.mYChannel = frame;
       yuvData.mYSize = IntSize(y_stride, height_);
       yuvData.mYStride = y_stride;
       yuvData.mCbCrStride = cbcr_stride;
       yuvData.mCbChannel = frame + height_ * yuvData.mYStride;
@@ -2179,33 +2167,23 @@ public:
 
       if (!yuvImage->CopyData(yuvData)) {
         MOZ_ASSERT(false);
         return;
       }
 
       image_ = yuvImage;
     }
-#ifdef WEBRTC_GONK
-    else {
-      // Decoder produced video frame that can be appended to the track directly.
-      MOZ_ASSERT(video_image);
-      image_ = video_image;
-    }
-#endif // WEBRTC_GONK
-#endif // MOZILLA_INTERNAL_API
   }
 
 private:
   int width_;
   int height_;
-#if defined(MOZILLA_INTERNAL_API)
   RefPtr<layers::ImageContainer> image_container_;
   RefPtr<layers::Image> image_;
-#endif
   mozilla::ReentrantMonitor monitor_; // Monitor for processing WebRTC frames.
                                       // Protects image_ against:
                                       // - Writing from the GIPS thread
                                       // - Reading from the MSG thread
 };
 
 class MediaPipelineReceiveVideo::PipelineRenderer : public VideoRenderer
 {
@@ -2291,19 +2269,17 @@ void MediaPipelineReceiveVideo::DetachMe
 nsresult MediaPipelineReceiveVideo::Init() {
   ASSERT_ON_THREAD(main_thread_);
   MOZ_MTLOG(ML_DEBUG, __FUNCTION__);
 
   description_ = pc_ + "| Receive video[";
   description_ += track_id_;
   description_ += "]";
 
-#if defined(MOZILLA_INTERNAL_API)
   listener_->AddSelf();
-#endif
 
   // Always happens before we can DetachMedia()
   static_cast<VideoSessionConduit *>(conduit_.get())->
       AttachRenderer(renderer_);
 
   return MediaPipelineReceive::Init();
 }
 
--- a/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
+++ b/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
@@ -20,19 +20,17 @@
 #include "signaling/src/common/PtrVector.h"
 
 #include "MediaStreamTrack.h"
 #include "nsIPrincipal.h"
 #include "nsIDocument.h"
 #include "mozilla/Preferences.h"
 #include "MediaEngine.h"
 
-#ifdef MOZILLA_INTERNAL_API
 #include "mozilla/Preferences.h"
-#endif
 
 #include "WebrtcGmpVideoCodec.h"
 
 #include <stdlib.h>
 
 namespace mozilla {
 
 MOZ_MTLOG_MODULE("MediaPipelineFactory")
--- a/media/webrtc/signaling/src/peerconnection/MediaStreamList.cpp
+++ b/media/webrtc/signaling/src/peerconnection/MediaStreamList.cpp
@@ -1,18 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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 "CSFLog.h"
 #include "base/basictypes.h"
 #include "MediaStreamList.h"
-#ifdef MOZILLA_INTERNAL_API
 #include "mozilla/dom/MediaStreamListBinding.h"
-#endif
 #include "nsIScriptGlobalObject.h"
 #include "PeerConnectionImpl.h"
 #include "PeerConnectionMedia.h"
 
 namespace mozilla {
 namespace dom {
 
 MediaStreamList::MediaStreamList(PeerConnectionImpl* peerConnection,
@@ -21,43 +19,29 @@ MediaStreamList::MediaStreamList(PeerCon
     mType(type)
 {
 }
 
 MediaStreamList::~MediaStreamList()
 {
 }
 
-#ifdef MOZILLA_INTERNAL_API
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(MediaStreamList)
-#else
-NS_IMPL_CYCLE_COLLECTION_CLASS(MediaStreamList)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(MediaStreamList)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(MediaStreamList)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(MediaStreamList)
-NS_IMPL_CYCLE_COLLECTION_TRACE_END
-#endif
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(MediaStreamList)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(MediaStreamList)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MediaStreamList)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 JSObject*
 MediaStreamList::WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto)
 {
-#ifdef MOZILLA_INTERNAL_API
   return MediaStreamListBinding::Wrap(cx, this, aGivenProto);
-#else
-  return nullptr;
-#endif
 }
 
 nsISupports*
 MediaStreamList::GetParentObject()
 {
   return mPeerConnection->GetWindow();
 }
 
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
@@ -39,55 +39,51 @@ class PeerConnectionCtxObserver : public
 {
 public:
   NS_DECL_ISUPPORTS
 
   PeerConnectionCtxObserver() {}
 
   void Init()
     {
-#ifdef MOZILLA_INTERNAL_API
       nsCOMPtr<nsIObserverService> observerService =
         services::GetObserverService();
       if (!observerService)
         return;
 
       nsresult rv = NS_OK;
 
       rv = observerService->AddObserver(this,
                                         NS_XPCOM_SHUTDOWN_OBSERVER_ID,
                                         false);
       MOZ_ALWAYS_SUCCEEDS(rv);
       rv = observerService->AddObserver(this,
                                         NS_IOSERVICE_OFFLINE_STATUS_TOPIC,
                                         false);
       MOZ_ALWAYS_SUCCEEDS(rv);
       (void) rv;
-#endif
     }
 
   NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
                      const char16_t* aData) override {
     if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {
       CSFLogDebug(logTag, "Shutting down PeerConnectionCtx");
       PeerConnectionCtx::Destroy();
 
-#ifdef MOZILLA_INTERNAL_API
       nsCOMPtr<nsIObserverService> observerService =
         services::GetObserverService();
       if (!observerService)
         return NS_ERROR_FAILURE;
 
       nsresult rv = observerService->RemoveObserver(this,
                                            NS_IOSERVICE_OFFLINE_STATUS_TOPIC);
       MOZ_ALWAYS_SUCCEEDS(rv);
       rv = observerService->RemoveObserver(this,
                                            NS_XPCOM_SHUTDOWN_OBSERVER_ID);
       MOZ_ALWAYS_SUCCEEDS(rv);
-#endif
 
       // Make sure we're not deleted while still inside ::Observe()
       RefPtr<PeerConnectionCtxObserver> kungFuDeathGrip(this);
       PeerConnectionCtx::gPeerConnectionCtxObserver = nullptr;
     }
     if (strcmp(aTopic, NS_IOSERVICE_OFFLINE_STATUS_TOPIC) == 0) {
       const nsLiteralString onlineString(u"" NS_IOSERVICE_ONLINE);
       const nsLiteralString offlineString(u"" NS_IOSERVICE_OFFLINE);
@@ -103,24 +99,22 @@ public:
       }
     }
     return NS_OK;
   }
 
 private:
   virtual ~PeerConnectionCtxObserver()
     {
-#ifdef MOZILLA_INTERNAL_API
       nsCOMPtr<nsIObserverService> observerService =
         services::GetObserverService();
       if (observerService) {
         observerService->RemoveObserver(this, NS_IOSERVICE_OFFLINE_STATUS_TOPIC);
         observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
       }
-#endif
     }
 };
 
 NS_IMPL_ISUPPORTS(PeerConnectionCtxObserver, nsIObserver);
 }
 
 namespace mozilla {
 
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
@@ -19,19 +19,17 @@
 #include "VideoConduit.h"
 #include "runnable_utils.h"
 #include "transportlayerice.h"
 #include "transportlayerdtls.h"
 #include "signaling/src/jsep/JsepSession.h"
 #include "signaling/src/jsep/JsepTransport.h"
 
 #include "MediaSegment.h"
-#ifdef MOZILLA_INTERNAL_API
 #include "MediaStreamGraph.h"
-#endif
 
 #include "MediaStreamGraphImpl.h"
 
 #include "nsNetCID.h"
 #include "nsNetUtil.h"
 #include "nsIURI.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsICancelable.h"
--- a/media/webrtc/trunk/webrtc/modules/audio_device/android/opensles_player.cc
+++ b/media/webrtc/trunk/webrtc/modules/audio_device/android/opensles_player.cc
@@ -8,19 +8,17 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
 #include "webrtc/modules/audio_device/android/opensles_player.h"
 
 #include <android/log.h>
 #include <dlfcn.h>
 
-#ifdef MOZILLA_INTERNAL_API
 #include "OpenSLESProvider.h"
-#endif
 
 #include "webrtc/base/arraysize.h"
 #include "webrtc/base/checks.h"
 #include "webrtc/base/format_macros.h"
 #include "webrtc/base/timeutils.h"
 #include "webrtc/modules/audio_device/android/audio_manager.h"
 #include "webrtc/modules/audio_device/fine_audio_buffer.h"
 
@@ -300,43 +298,33 @@ bool OpenSLESPlayer::CreateEngine() {
   RTC_DCHECK(thread_checker_.CalledOnValidThread());
   if (engine_object_) {
     return true;
   }
   RTC_DCHECK(!engine_);
   const SLEngineOption option[] = {
     {SL_ENGINEOPTION_THREADSAFE, static_cast<SLuint32>(SL_BOOLEAN_TRUE)}};
 
-#ifndef MOZILLA_INTERNAL_API
-  RETURN_ON_ERROR(slCreateEngine_(&engine_object_, 1, option, 0, NULL, NULL),
-                  false);
-  RETURN_ON_ERROR((*engine_object_)->Realize(engine_object_, SL_BOOLEAN_FALSE), false);
-#else
   RETURN_ON_ERROR(mozilla_get_sles_engine(&engine_object_, 1, option),
                   false);
   RETURN_ON_ERROR(mozilla_realize_sles_engine(engine_object_), false);
-#endif
   RETURN_ON_ERROR(
     (*engine_object_)->GetInterface(engine_object_, SL_IID_ENGINE_, &engine_),
     false);
 
   return true;
 }
 
 void OpenSLESPlayer::DestroyEngine() {
   ALOGD("DestroyEngine");
   RTC_DCHECK(thread_checker_.CalledOnValidThread());
   if (!engine_object_)
     return;
   engine_ = nullptr;
-#ifndef MOZILLA_INTERNAL_API
-  (*engine_object_)->Destroy(engine_object_);
-#else
   mozilla_destroy_sles_engine(&engine_object_);
-#endif
 }
 
 bool OpenSLESPlayer::CreateMix() {
   ALOGD("CreateMix");
   RTC_DCHECK(thread_checker_.CalledOnValidThread());
   RTC_DCHECK(engine_);
   if (output_mix_.Get())
     return true;
--- a/media/webrtc/trunk/webrtc/modules/audio_device/mac/audio_device_mac.cc
+++ b/media/webrtc/trunk/webrtc/modules/audio_device/mac/audio_device_mac.cc
@@ -16,19 +16,17 @@
 #include "webrtc/modules/audio_device/mac/portaudio/pa_ringbuffer.h"
 #include "webrtc/system_wrappers/include/event_wrapper.h"
 #include "webrtc/system_wrappers/include/trace.h"
 
 #include <ApplicationServices/ApplicationServices.h>
 #include <libkern/OSAtomic.h>  // OSAtomicCompareAndSwap()
 #include <mach/mach.h>         // mach_task_self()
 #include <sys/sysctl.h>        // sysctlbyname()
-#ifdef MOZILLA_INTERNAL_API
 #include <OSXRunLoopSingleton.h>
-#endif
 
 namespace webrtc {
 
 #define WEBRTC_CA_RETURN_ON_ERR(expr)                                  \
   do {                                                                 \
     err = expr;                                                        \
     if (err != noErr) {                                                \
       logCAMsg(kTraceError, kTraceAudioDevice, _id, "Error in " #expr, \
@@ -298,29 +296,17 @@ int32_t AudioDeviceMac::Init() {
 
   // Setting RunLoop to NULL here instructs HAL to manage its own thread for
   // notifications. This was the default behaviour on OS X 10.5 and earlier,
   // but now must be explicitly specified. HAL would otherwise try to use the
   // main thread to issue notifications.
   AudioObjectPropertyAddress propertyAddress = {
       kAudioHardwarePropertyRunLoop, kAudioObjectPropertyScopeGlobal,
       kAudioObjectPropertyElementMaster};
-#ifdef MOZILLA_INTERNAL_API
   mozilla_set_coreaudio_notification_runloop_if_needed();
-#else
-  CFRunLoopRef runLoop = NULL;
-  UInt32 size = sizeof(CFRunLoopRef);
-  WEBRTC_CA_RETURN_ON_ERR(AudioObjectSetPropertyData(
-      kAudioObjectSystemObject, &propertyAddress, 0, NULL, size, &runLoop));
-
-  // Listen for any device changes.
-  propertyAddress.mSelector = kAudioHardwarePropertyDevices;
-  WEBRTC_CA_LOG_ERR(AudioObjectAddPropertyListener(
-      kAudioObjectSystemObject, &propertyAddress, &objectListenerProc, this));
-#endif
 
   // Determine if this is a MacBook Pro
   _macBookPro = false;
   _macBookProPanRight = false;
   char buf[128];
   size_t length = sizeof(buf);
   memset(buf, 0, length);