Bug 1319489 - Remove MOZILLA_EXTERNAL_LINKAGE; r=jesup

MozReview-Commit-ID: G98qrMnJ0lK

--HG--
extra : rebase_source : f6f9e7bee64c6863c6aab951221c259800782e27
This commit is contained in:
Dan Minor 2017-01-02 08:09:03 -05:00
parent 68972c13d0
commit 3c06acab52
15 changed files with 4 additions and 366 deletions

View File

@ -6,8 +6,6 @@
# TODO: bug 1172551 - get these tests working on iOS
if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'uikit':
DEFINES['MOZILLA_EXTERNAL_LINKAGE'] = True
LOCAL_INCLUDES += [
'/ipc/chromium/src',
'/media/mtransport',

View File

@ -17,8 +17,6 @@
#include "ssl.h"
#include "nsThreadUtils.h"
#include "PeerConnectionImpl.h"
#include "PeerConnectionCtx.h"
#include "signaling/src/sdp/SipccSdpParser.h"
#include "signaling/src/sdp/SdpMediaSection.h"
@ -58,7 +56,6 @@ class SdpTest : public ::testing::Test {
}
static void TearDownTestCase() {
PeerConnectionCtx::Destroy();
}
void ResetSdp() {

View File

@ -187,12 +187,10 @@ void ConfigWebRtcLog(mozilla::LogLevel level, uint32_t trace_mask,
}
#endif
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (XRE_IsParentProcess()) {
// Capture the final choice for the trace setting.
mozilla::Preferences::SetCString("media.webrtc.debug.log_file", aLogFile);
}
#endif
return;
}
@ -281,12 +279,10 @@ void ConfigAecLog(nsCString &aAECLogDir) {
}
#endif
webrtc::Trace::set_aec_debug_filename(aAECLogDir.get());
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (XRE_IsParentProcess()) {
// Capture the final choice for the aec_log_dir setting.
mozilla::Preferences::SetCString("media.webrtc.debug.aec_log_dir", aAECLogDir);
}
#endif
}
void StartAecLog()

View File

@ -18,10 +18,8 @@
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsThreadUtils.h"
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "Latency.h"
#include "mozilla/Telemetry.h"
#endif
#include "webrtc/common.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
@ -458,7 +456,6 @@ WebrtcAudioConduit::ConfigureSendMediaCodec(const AudioCodecConfig* codecConfig)
}
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// TEMPORARY - see bug 694814 comment 2
nsresult rv;
nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
@ -469,7 +466,6 @@ WebrtcAudioConduit::ConfigureSendMediaCodec(const AudioCodecConfig* codecConfig)
branch->GetIntPref("media.peerconnection.capture_delay", &mCaptureDelay);
}
}
#endif
condError = StartTransmitting();
if (condError != kMediaConduitNoError) {
@ -618,12 +614,10 @@ WebrtcAudioConduit::SendAudioFrame(const int16_t audio_data[],
return kMediaConduitSessionNotInited;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (MOZ_LOG_TEST(GetLatencyLog(), LogLevel::Debug)) {
struct Processing insert = { TimeStamp::Now(), 0 };
mProcessing.AppendElement(insert);
}
#endif
if (MOZ_LOG_TEST(GetLatencyLog(), LogLevel::Debug)) {
struct Processing insert = { TimeStamp::Now(), 0 };
mProcessing.AppendElement(insert);
}
capture_delay = mCaptureDelay;
//Insert the samples
@ -712,7 +706,6 @@ WebrtcAudioConduit::GetAudioFrame(int16_t speechData[],
if (GetAVStats(&jitter_buffer_delay_ms,
&playout_buffer_delay_ms,
&avsync_offset_ms)) {
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (avsync_offset_ms < 0) {
Telemetry::Accumulate(Telemetry::WEBRTC_AVSYNC_WHEN_VIDEO_LAGS_AUDIO_MS,
-avsync_offset_ms);
@ -720,7 +713,6 @@ WebrtcAudioConduit::GetAudioFrame(int16_t speechData[],
Telemetry::Accumulate(Telemetry::WEBRTC_AVSYNC_WHEN_AUDIO_LAGS_VIDEO_MS,
avsync_offset_ms);
}
#endif
CSFLogError(logTag,
"A/V sync: sync delta: %dms, audio jitter delay %dms, playout delay %dms",
avsync_offset_ms, jitter_buffer_delay_ms, playout_buffer_delay_ms);
@ -730,7 +722,6 @@ WebrtcAudioConduit::GetAudioFrame(int16_t speechData[],
mLastSyncLog = mSamples;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (MOZ_LOG_TEST(GetLatencyLog(), LogLevel::Debug)) {
if (mProcessing.Length() > 0) {
unsigned int now;
@ -753,7 +744,6 @@ WebrtcAudioConduit::GetAudioFrame(int16_t speechData[],
}
}
}
#endif
CSFLogDebug(logTag,"%s GetAudioFrame:Got samples: length %d ",__FUNCTION__,
lengthSamples);
return kMediaConduitNoError;
@ -767,14 +757,12 @@ WebrtcAudioConduit::ReceivedRTPPacket(const void *data, int len)
if(mEngineReceiving)
{
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (MOZ_LOG_TEST(GetLatencyLog(), LogLevel::Debug)) {
// timestamp is at 32 bits in ([1])
struct Processing insert = { TimeStamp::Now(),
ntohl(static_cast<const uint32_t *>(data)[1]) };
mProcessing.AppendElement(insert);
}
#endif
// XXX we need to get passed the time the packet was received
if(mPtrVoENetwork->ReceivedRTPPacket(mChannel, data, len) == -1)
@ -907,7 +895,6 @@ WebrtcAudioConduit::SendRtp(const uint8_t* data,
{
CSFLogDebug(logTag, "%s: len %lu", __FUNCTION__, (unsigned long)len);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (MOZ_LOG_TEST(GetLatencyLog(), LogLevel::Debug)) {
if (mProcessing.Length() > 0) {
TimeStamp started = mProcessing[0].mTimeStamp;
@ -918,7 +905,6 @@ WebrtcAudioConduit::SendRtp(const uint8_t* data,
LogTime(AsyncLatencyLogger::AudioSendRTP, ((uint64_t) this), delta);
}
}
#endif
ReentrantMonitorAutoEnter enter(mTransportMonitor);
// XXX(pkerr) - the PacketOptions are being ignored. This parameter was added along
// with the Call API update in the webrtc.org codebase.

View File

@ -175,9 +175,7 @@ public:
mDtmfEnabled(false),
mCodecMutex("AudioConduit codec db"),
mCaptureDelay(150),
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
mLastTimestamp(0),
#endif // MOZILLA_INTERNAL_API
mSamples(0),
mLastSyncLog(0)
{
@ -303,9 +301,7 @@ private:
// Current "capture" delay (really output plus input delay)
int32_t mCaptureDelay;
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
uint32_t mLastTimestamp;
#endif // MOZILLA_INTERNAL_API
uint32_t mSamples;
uint32_t mLastSyncLog;

View File

@ -42,9 +42,7 @@
#ifdef MOZ_WEBRTC_MEDIACODEC
#include "MediaCodecVideoCodec.h"
#endif
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "WebrtcGmpVideoCodec.h"
#endif
// for ntohs
#ifdef _MSC_VER

View File

@ -14,7 +14,6 @@
#include "nspr.h"
#include "srtp.h"
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "VideoSegment.h"
#include "Layers.h"
#include "LayersLogging.h"
@ -30,7 +29,6 @@
#include "GrallocImages.h"
#include "mozilla/layers/GrallocTextureClient.h"
#endif
#endif
#include "nsError.h"
#include "AudioSegment.h"
@ -44,11 +42,9 @@
#include "runnable_utils.h"
#include "libyuv/convert.h"
#include "mozilla/SharedThreadPool.h"
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "mozilla/PeerIdentity.h"
#include "mozilla/Preferences.h"
#include "mozilla/TaskQueue.h"
#endif
#include "mozilla/gfx/Point.h"
#include "mozilla/gfx/Types.h"
#include "mozilla/UniquePtr.h"
@ -77,7 +73,6 @@ MOZ_MTLOG_MODULE("mediapipeline")
namespace mozilla {
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
class VideoConverterListener
{
public:
@ -465,7 +460,6 @@ protected:
Mutex mMutex;
nsTArray<RefPtr<VideoConverterListener>> mListeners;
};
#endif
// An async inserter for audio data, to avoid running audio codec encoders
// on the MSG/input audio thread. Basically just bounces all the audio
@ -482,7 +476,6 @@ public:
MOZ_ASSERT(mConduit);
MOZ_COUNT_CTOR(AudioProxyThread);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Use only 1 thread; also forces FIFO operation
// We could use multiple threads, but that may be dicier with the webrtc.org
// code. If so we'd need to use TaskQueues like the videoframe converter
@ -490,12 +483,6 @@ public:
SharedThreadPool::Get(NS_LITERAL_CSTRING("AudioProxy"), 1);
mThread = pool.get();
#else
nsCOMPtr<nsIThread> thread;
if (!NS_WARN_IF(NS_FAILED(NS_NewNamedThread("AudioProxy", getter_AddRefs(thread))))) {
mThread = thread;
}
#endif
}
// called on mThread
@ -1233,11 +1220,9 @@ public:
} else {
conduit_ = nullptr;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (converter_) {
converter_->Shutdown();
}
#endif
}
// Dispatches setting the internal TrackID to TRACK_INVALID to the media
@ -1256,7 +1241,6 @@ public:
audio_processing_ = proxy;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
void SetVideoFrameConverter(const RefPtr<VideoFrameConverter>& converter)
{
converter_ = converter;
@ -1279,7 +1263,6 @@ public:
MOZ_ASSERT(conduit_->type() == MediaSessionConduit::VIDEO);
static_cast<VideoSessionConduit*>(conduit_.get())->SendVideoFrame(aVideoFrame);
}
#endif
// Implement MediaStreamTrackListener
void NotifyQueuedChanges(MediaStreamGraph* aGraph,
@ -1307,9 +1290,7 @@ private:
RefPtr<MediaSessionConduit> conduit_;
RefPtr<AudioProxyThread> audio_processing_;
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
RefPtr<VideoFrameConverter> converter_;
#endif
// May be TRACK_INVALID until we see data from the track
TrackID track_id_; // this is the current TrackID this listener is attached to
@ -1328,7 +1309,6 @@ private:
bool direct_connect_;
};
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Implements VideoConverterListener for MediaPipeline.
//
// We pass converted frames on to MediaPipelineTransmit::PipelineListener
@ -1390,7 +1370,6 @@ protected:
RefPtr<PipelineListener> listener_;
Mutex mutex_;
};
#endif
MediaPipelineTransmit::MediaPipelineTransmit(
const std::string& pc,
@ -1412,7 +1391,6 @@ MediaPipelineTransmit::MediaPipelineTransmit(
audio_processing_ = MakeAndAddRef<AudioProxyThread>(static_cast<AudioSessionConduit*>(conduit.get()));
listener_->SetAudioProxy(audio_processing_);
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
else { // Video
// For video we send frames to an async VideoFrameConverter that calls
// back to a VideoFrameFeeder that feeds I420 frames to VideoConduit.
@ -1424,16 +1402,13 @@ MediaPipelineTransmit::MediaPipelineTransmit(
listener_->SetVideoFrameConverter(converter_);
}
#endif
}
MediaPipelineTransmit::~MediaPipelineTransmit()
{
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (feeder_) {
feeder_->Detach();
}
#endif
}
nsresult MediaPipelineTransmit::Init() {
@ -1492,7 +1467,6 @@ MediaPipelineTransmit::IsVideo() const
return !!domtrack_->AsVideoStreamTrack();
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
void MediaPipelineTransmit::UpdateSinkIdentity_m(MediaStreamTrack* track,
nsIPrincipal* principal,
const PeerIdentity* sinkIdentity) {
@ -1519,7 +1493,6 @@ void MediaPipelineTransmit::UpdateSinkIdentity_m(MediaStreamTrack* track,
listener_->SetEnabled(enableTrack);
}
#endif
void
MediaPipelineTransmit::DetachMedia()
@ -1554,13 +1527,9 @@ nsresult MediaPipelineTransmit::TransportReady_s(TransportInfo &info) {
nsresult MediaPipelineTransmit::ReplaceTrack(MediaStreamTrack& domtrack) {
// MainThread, checked in calls we make
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsString nsTrackId;
domtrack.GetId(nsTrackId);
std::string track_id(NS_ConvertUTF16toUTF8(nsTrackId).get());
#else
std::string track_id = domtrack.GetId();
#endif
MOZ_MTLOG(ML_DEBUG, "Reattaching pipeline " << description_ << " to track "
<< static_cast<void *>(&domtrack)
<< " track " << track_id << " conduit type=" <<
@ -1801,14 +1770,12 @@ NewData(const MediaSegment& media, TrackRate aRate /* = 0 */) {
for(AudioSegment::ChunkIterator iter(*audio); !iter.IsEnded(); iter.Next()) {
audio_processing_->QueueAudioChunk(aRate, *iter, enabled_);
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
} else {
VideoSegment* video = const_cast<VideoSegment *>(static_cast<const VideoSegment*>(&media));
VideoSegment::ChunkIterator iter(*video);
for(VideoSegment::ChunkIterator iter(*video); !iter.IsEnded(); iter.Next()) {
converter_->QueueVideoChunk(*iter, !enabled_);
}
#endif // MOZILLA_EXTERNAL_LINKAGE
}
}
@ -1844,7 +1811,6 @@ class GenericReceiveCallback : public TrackAddedCallback
// Add a listener on the MSG thread using the MSG command queue
static void AddListener(MediaStream* source, MediaStreamListener* listener) {
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
class Message : public ControlMessage {
public:
Message(MediaStream* stream, MediaStreamListener* listener)
@ -1861,9 +1827,6 @@ static void AddListener(MediaStream* source, MediaStreamListener* listener) {
MOZ_ASSERT(listener);
source->GraphImpl()->AppendMessage(MakeUnique<Message>(source, listener));
#else
source->AddListener(listener);
#endif
}
class GenericReceiveListener : public MediaStreamListener
@ -2120,16 +2083,13 @@ public:
#endif
monitor_("Video PipelineListener")
{
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
image_container_ =
LayerManager::CreateImageContainer(ImageContainer::ASYNCHRONOUS);
#endif
}
// Implement MediaStreamListener
void NotifyPull(MediaStreamGraph* graph, StreamTime desired_time) override
{
#if defined(MOZILLA_INTERNAL_API)
ReentrantMonitorAutoEnter enter(monitor_);
RefPtr<Image> image = image_;
@ -2150,7 +2110,6 @@ public:
return;
}
}
#endif
}
// Accessors for external writes from the renderer

View File

@ -32,9 +32,7 @@ namespace mozilla {
class MediaPipelineFilter;
class PeerIdentity;
class AudioProxyThread;
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
class VideoFrameConverter;
#endif
namespace dom {
class MediaStreamTrack;
@ -319,14 +317,12 @@ public:
// written and used from MainThread
bool IsVideo() const override;
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// When the principal of the domtrack changes, it calls through to here
// so that we can determine whether to enable track transmission.
// `track` has to be null or equal `domtrack_` for us to apply the update.
virtual void UpdateSinkIdentity_m(dom::MediaStreamTrack* track,
nsIPrincipal* principal,
const PeerIdentity* sinkIdentity);
#endif
// Called on the main thread.
void DetachMedia() override;
@ -350,10 +346,8 @@ public:
private:
RefPtr<PipelineListener> listener_;
RefPtr<AudioProxyThread> audio_processing_;
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
RefPtr<VideoFrameFeeder> feeder_;
RefPtr<VideoFrameConverter> converter_;
#endif
dom::MediaStreamTrack* domtrack_;
};

View File

@ -19,21 +19,17 @@
#include "signaling/src/jsep/JsepTransport.h"
#include "signaling/src/common/PtrVector.h"
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "MediaStreamTrack.h"
#include "nsIPrincipal.h"
#include "nsIDocument.h"
#include "mozilla/Preferences.h"
#include "MediaEngine.h"
#endif
#ifdef MOZILLA_INTERNAL_API
#include "mozilla/Preferences.h"
#endif
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "WebrtcGmpVideoCodec.h"
#endif
#include <stdlib.h>
@ -382,13 +378,11 @@ MediaPipelineFactory::CreateOrUpdateMediaPipeline(
const JsepTrackPair& aTrackPair,
const JsepTrack& aTrack)
{
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// The GMP code is all the way on the other side of webrtc.org, and it is not
// feasible to plumb this information all the way through. So, we set it (for
// the duration of this call) in a global variable. This allows the GMP code
// to report errors to the PC.
WebrtcGmpPCHandleSetter setter(mPC->GetHandle());
#endif
MOZ_ASSERT(aTrackPair.mRtpTransport);
@ -638,7 +632,6 @@ MediaPipelineFactory::CreateMediaPipelineSending(
aRtcpFlow,
aFilter);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// implement checking for peerIdentity (where failure == black/silence)
nsIDocument* doc = mPC->GetWindow()->GetExtantDoc();
if (doc) {
@ -649,7 +642,6 @@ MediaPipelineFactory::CreateMediaPipelineSending(
MOZ_MTLOG(ML_ERROR, "Cannot initialize pipeline without attached doc");
return NS_ERROR_FAILURE; // Don't remove this till we know it's safe.
}
#endif
rv = pipeline->Init();
if (NS_FAILED(rv)) {
@ -898,7 +890,6 @@ nsresult
MediaPipelineFactory::ConfigureVideoCodecMode(const JsepTrack& aTrack,
VideoSessionConduit& aConduit)
{
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
RefPtr<LocalSourceStreamInfo> stream =
mPCMedia->GetLocalStreamByTrackId(aTrack.GetTrackId());
@ -936,7 +927,6 @@ MediaPipelineFactory::ConfigureVideoCodecMode(const JsepTrack& aTrack,
return NS_ERROR_FAILURE;
}
#endif
return NS_OK;
}

View File

@ -12,11 +12,9 @@
#include "mozilla/Telemetry.h"
#include "browser_logging/WebRtcLog.h"
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "mozilla/dom/RTCPeerConnectionBinding.h"
#include "mozilla/Preferences.h"
#include <mozilla/Types.h>
#endif
#include "nsNetCID.h" // NS_SOCKETTRANSPORTSERVICE_CONTRACTID
#include "nsServiceManagerUtils.h" // do_GetService
@ -190,7 +188,6 @@ void PeerConnectionCtx::Destroy() {
StopWebRtcLog();
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
typedef Vector<nsAutoPtr<RTCStatsQuery>> RTCStatsQueries;
// Telemetry reporting every second after start of first call.
@ -362,7 +359,6 @@ PeerConnectionCtx::EverySecondTelemetryCallback_m(nsITimer* timer, void *closure
NS_ENSURE_SUCCESS_VOID(rv);
}
}
#endif
void
PeerConnectionCtx::UpdateNetworkState(bool online) {
@ -378,7 +374,6 @@ PeerConnectionCtx::UpdateNetworkState(bool online) {
nsresult PeerConnectionCtx::Initialize() {
initGMP();
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
mTelemetryTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
MOZ_ASSERT(mTelemetryTimer);
nsresult rv = mTelemetryTimer->SetTarget(gMainThread);
@ -389,7 +384,6 @@ nsresult PeerConnectionCtx::Initialize() {
if (XRE_IsContentProcess()) {
WebrtcGlobalChild::Create();
}
#endif // MOZILLA_INTERNAL_API
return NS_OK;
}
@ -442,11 +436,9 @@ nsresult PeerConnectionCtx::Cleanup() {
PeerConnectionCtx::~PeerConnectionCtx() {
// ensure mTelemetryTimer ends on main thread
MOZ_ASSERT(NS_IsMainThread());
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (mTelemetryTimer) {
mTelemetryTimer->Cancel();
}
#endif
};
void PeerConnectionCtx::queueJSEPOperation(nsIRunnable* aOperation) {

View File

@ -7,9 +7,7 @@
#include <string>
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "WebrtcGlobalChild.h"
#endif
#include "mozilla/Attributes.h"
#include "mozilla/StaticPtr.h"
@ -55,12 +53,10 @@ class PeerConnectionCtx {
friend class PeerConnectionWrapper;
friend class mozilla::dom::WebrtcGlobalInformation;
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// WebrtcGlobalInformation uses this; we put it here so we don't need to
// create another shutdown observer class.
mozilla::dom::Sequence<mozilla::dom::RTCStatsReportInternal>
mStatsForClosedPeerConnections;
#endif
const std::map<const std::string, PeerConnectionImpl *>& mGetPeerConnections();
private:
@ -81,7 +77,6 @@ class PeerConnectionCtx {
static void
EverySecondTelemetryCallback_m(nsITimer* timer, void *);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsCOMPtr<nsITimer> mTelemetryTimer;
public:
@ -89,7 +84,6 @@ public:
//std::map<nsString,nsAutoPtr<mozilla::dom::RTCStatsReportInternal>> mLastReports;
nsTArray<nsAutoPtr<mozilla::dom::RTCStatsReportInternal>> mLastReports;
private:
#endif
// We cannot form offers/answers properly until the Gecko Media Plugin stuff
// has been initted, which is a complicated mess of thread dispatches,

View File

@ -49,7 +49,6 @@
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Sprintf.h"
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#ifdef XP_WIN
// We need to undef the MS macro for nsIDocument::CreateEvent
#ifdef CreateEvent
@ -100,8 +99,6 @@
#include "mozilla/dom/Event.h"
#include "nsIDOMCustomEvent.h"
#include "mozilla/EventDispatcher.h"
#endif
#include "mozilla/net/DataChannelProtocol.h"
#include "MediaStreamGraphImpl.h"
@ -153,9 +150,7 @@ class JSErrorResult :
public:
~JSErrorResult()
{
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
SuppressException();
#endif
}
};
@ -190,7 +185,6 @@ private:
};
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
static nsresult InitNSSInContent()
{
NS_ENSURE_TRUE(NS_IsMainThread(), NS_ERROR_NOT_SAME_THREAD);
@ -221,7 +215,6 @@ static nsresult InitNSSInContent()
return NS_OK;
}
#endif // MOZILLA_INTERNAL_API
namespace mozilla {
class DataChannel;
@ -238,7 +231,6 @@ const nsIID nsISupportsWeakReference::COMTypeInfo<nsSupportsWeakReference, void>
namespace mozilla {
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
RTCStatsQuery::RTCStatsQuery(bool internal) :
failed(false),
internalStats(internal),
@ -249,11 +241,9 @@ RTCStatsQuery::~RTCStatsQuery() {
MOZ_ASSERT(NS_IsMainThread());
}
#endif
NS_IMPL_ISUPPORTS0(PeerConnectionImpl)
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
bool
PeerConnectionImpl::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto,
@ -261,7 +251,6 @@ PeerConnectionImpl::WrapObject(JSContext* aCx,
{
return PeerConnectionImplBinding::Wrap(aCx, this, aGivenProto, aReflector);
}
#endif
bool PCUuidGenerator::Generate(std::string* idp) {
nsresult rv;
@ -290,9 +279,6 @@ bool PCUuidGenerator::Generate(std::string* idp) {
bool IsPrivateBrowsing(nsPIDOMWindowInner* aWindow)
{
#if defined(MOZILLA_EXTERNAL_LINKAGE)
return false;
#else
if (!aWindow) {
return false;
}
@ -304,7 +290,6 @@ bool IsPrivateBrowsing(nsPIDOMWindowInner* aWindow)
nsILoadContext *loadContext = doc->GetLoadContext();
return loadContext && loadContext->UsePrivateBrowsing();
#endif
}
PeerConnectionImpl::PeerConnectionImpl(const GlobalObject* aGlobal)
@ -315,11 +300,7 @@ PeerConnectionImpl::PeerConnectionImpl(const GlobalObject* aGlobal)
, mIceGatheringState(PCImplIceGatheringState::New)
, mDtlsConnected(false)
, mWindow(nullptr)
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
, mCertificate(nullptr)
#else
, mIdentity(nullptr)
#endif
, mPrivacyRequested(false)
, mSTSThread(nullptr)
, mAllowIceLoopback(false)
@ -336,7 +317,6 @@ PeerConnectionImpl::PeerConnectionImpl(const GlobalObject* aGlobal)
, mNegotiationNeeded(false)
, mPrivateWindow(false)
{
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
MOZ_ASSERT(NS_IsMainThread());
auto log = RLogConnector::CreateInstance();
if (aGlobal) {
@ -346,18 +326,15 @@ PeerConnectionImpl::PeerConnectionImpl(const GlobalObject* aGlobal)
log->EnterPrivateMode();
}
}
#endif
CSFLogInfo(logTag, "%s: PeerConnectionImpl constructor for %s",
__FUNCTION__, mHandle.c_str());
STAMP_TIMECARD(mTimeCard, "Constructor Completed");
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
mAllowIceLoopback = Preferences::GetBool(
"media.peerconnection.ice.loopback", false);
mAllowIceLinkLocal = Preferences::GetBool(
"media.peerconnection.ice.link_local", false);
mForceIceTcp = Preferences::GetBool(
"media.peerconnection.ice.force_ice_tcp", false);
#endif
memset(mMaxReceiving, 0, sizeof(mMaxReceiving));
memset(mMaxSending, 0, sizeof(mMaxSending));
}
@ -372,7 +349,6 @@ PeerConnectionImpl::~PeerConnectionImpl()
}
// This aborts if not on main thread (in Debug builds)
PC_AUTO_ENTER_API_CALL_NO_CHECK();
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (mPrivateWindow) {
auto * log = RLogConnector::GetInstance();
if (log) {
@ -380,7 +356,6 @@ PeerConnectionImpl::~PeerConnectionImpl()
}
mPrivateWindow = false;
}
#endif
if (PeerConnectionCtx::isActive()) {
PeerConnectionCtx::GetInstance()->mPeerConnections.erase(mHandle);
} else {
@ -436,7 +411,6 @@ PeerConnectionImpl::CreateRemoteSourceStreamInfo(RefPtr<RemoteSourceStreamInfo>*
return NS_OK;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
/**
* In JS, an RTCConfiguration looks like this:
*
@ -588,7 +562,6 @@ PeerConnectionConfiguration::AddIceServer(const RTCIceServer &aServer)
}
return NS_OK;
}
#endif
nsresult
PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
@ -612,7 +585,6 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
mSTSThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &res);
MOZ_ASSERT(mSTSThread);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Initialize NSS if we are in content process. For chrome process, NSS should already
// been initialized.
@ -629,13 +601,11 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
MOZ_ASSERT(aWindow);
mWindow = aWindow->AsInner();
NS_ENSURE_STATE(mWindow);
#endif // MOZILLA_INTERNAL_API
PRTime timestamp = PR_Now();
// Ok if we truncate this.
char temp[128];
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsAutoCString locationCStr;
if (nsCOMPtr<nsIDOMLocation> location = mWindow->GetLocation()) {
@ -651,10 +621,6 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
static_cast<uint64_t>(mWindow ? mWindow->WindowID() : 0),
locationCStr.get() ? locationCStr.get() : "NULL");
#else
SprintfLiteral(temp, "%" PRIu64, static_cast<uint64_t>(timestamp));
#endif // MOZILLA_INTERNAL_API
mName = temp;
// Generate a random handle
@ -732,24 +698,6 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
return res;
}
#if defined(MOZILLA_EXTERNAL_LINKAGE)
{
mIdentity = DtlsIdentity::Generate();
if (!mIdentity) {
return NS_ERROR_FAILURE;
}
std::vector<uint8_t> fingerprint;
res = CalculateFingerprint(DtlsIdentity::DEFAULT_HASH_ALGORITHM,
&fingerprint);
NS_ENSURE_SUCCESS(res, res);
res = mJsepSession->AddDtlsFingerprint(DtlsIdentity::DEFAULT_HASH_ALGORITHM,
fingerprint);
NS_ENSURE_SUCCESS(res, res);
}
#endif
res = mJsepSession->SetBundlePolicy(aConfiguration.getBundlePolicy());
if (NS_FAILED(res)) {
CSFLogError(logTag, "%s: Couldn't set bundle policy, res=%u, error=%s",
@ -762,7 +710,6 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
return NS_OK;
}
#ifndef MOZILLA_EXTERNAL_LINKAGE
void
PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
nsGlobalWindow& aWindow,
@ -792,9 +739,7 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
mPrivacyRequested = true;
}
}
#endif
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
void
PeerConnectionImpl::SetCertificate(mozilla::dom::RTCCertificate& aCertificate)
{
@ -826,19 +771,13 @@ PeerConnectionImpl::Certificate() const
PC_AUTO_ENTER_API_CALL_NO_CHECK();
return mCertificate;
}
#endif
RefPtr<DtlsIdentity>
PeerConnectionImpl::Identity() const
{
PC_AUTO_ENTER_API_CALL_NO_CHECK();
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
MOZ_ASSERT(mCertificate);
return mCertificate->CreateDtlsIdentity();
#else
RefPtr<DtlsIdentity> id = mIdentity;
return id;
#endif
}
class CompareCodecPriority {
@ -918,12 +857,7 @@ class ConfigureCodec {
#endif // MOZ_WEBRTC_OMX
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
mSoftwareH264Enabled = PeerConnectionCtx::GetInstance()->gmpHasH264();
#else
// For unit-tests
mSoftwareH264Enabled = true;
#endif
mH264Enabled = mHardwareH264Supported || mSoftwareH264Enabled;
@ -1151,7 +1085,6 @@ PeerConnectionImpl::EnsureDataConnection(uint16_t aNumstreams)
{
PC_AUTO_ENTER_API_CALL(false);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (mDataConnection) {
CSFLogDebug(logTag,"%s DataConnection already connected",__FUNCTION__);
// Ignore the request to connect when already connected. This entire
@ -1166,7 +1099,6 @@ PeerConnectionImpl::EnsureDataConnection(uint16_t aNumstreams)
}
CSFLogDebug(logTag,"%s DataChannelConnection %p attached to %s",
__FUNCTION__, (void*) mDataConnection.get(), mHandle.c_str());
#endif
return NS_OK;
}
@ -1307,7 +1239,6 @@ PeerConnectionImpl::InitializeDataChannel()
return NS_OK;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (channels > MAX_NUM_STREAMS) {
channels = MAX_NUM_STREAMS;
}
@ -1329,7 +1260,6 @@ PeerConnectionImpl::InitializeDataChannel()
mDataConnection->Destroy();
}
mDataConnection = nullptr;
#endif
return NS_ERROR_FAILURE;
}
@ -1344,15 +1274,11 @@ PeerConnectionImpl::CreateDataChannel(const nsAString& aLabel,
uint16_t aStream,
ErrorResult &rv)
{
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
RefPtr<nsDOMDataChannel> result;
rv = CreateDataChannel(aLabel, aProtocol, aType, ordered,
aMaxTime, aMaxNum, aExternalNegotiated,
aStream, getter_AddRefs(result));
return result.forget();
#else
return nullptr;
#endif
}
NS_IMETHODIMP
@ -1369,7 +1295,6 @@ PeerConnectionImpl::CreateDataChannel(const nsAString& aLabel,
PC_AUTO_ENTER_API_CALL(false);
MOZ_ASSERT(aRetval);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
RefPtr<DataChannel> dataChannel;
DataChannelConnection::Type theType =
static_cast<DataChannelConnection::Type>(aType);
@ -1423,7 +1348,6 @@ PeerConnectionImpl::CreateDataChannel(const nsAString& aLabel,
return rv;
}
*aRetval = static_cast<nsDOMDataChannel*>(retval);
#endif
return NS_OK;
}
@ -1453,7 +1377,6 @@ do_QueryObjectReferent(nsIWeakReference* aRawPtr) {
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Not a member function so that we don't need to keep the PC live.
static void NotifyDataChannel_m(RefPtr<nsIDOMDataChannel> aChannel,
RefPtr<PeerConnectionObserver> aObserver)
@ -1464,7 +1387,6 @@ static void NotifyDataChannel_m(RefPtr<nsIDOMDataChannel> aChannel,
aObserver->NotifyDataChannel(*channel, rv);
NS_DataChannelAppReady(aChannel);
}
#endif
void
PeerConnectionImpl::NotifyDataChannel(already_AddRefed<DataChannel> aChannel)
@ -1481,7 +1403,6 @@ PeerConnectionImpl::NotifyDataChannel(already_AddRefed<DataChannel> aChannel)
CSFLogDebug(logTag, "%s: channel: %p", __FUNCTION__, channel);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsCOMPtr<nsIDOMDataChannel> domchannel;
nsresult rv = NS_NewDOMDataChannel(already_AddRefed<DataChannel>(channel),
mWindow, getter_AddRefs(domchannel));
@ -1499,14 +1420,12 @@ PeerConnectionImpl::NotifyDataChannel(already_AddRefed<DataChannel> aChannel)
domchannel.get(),
pco),
NS_DISPATCH_NORMAL);
#endif
}
NS_IMETHODIMP
PeerConnectionImpl::CreateOffer(const RTCOfferOptions& aOptions)
{
JsepOfferOptions options;
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// convert the RTCOfferOptions to JsepOfferOptions
if (aOptions.mOfferToReceiveAudio.WasPassed()) {
options.mOfferToReceiveAudio =
@ -1524,7 +1443,6 @@ PeerConnectionImpl::CreateOffer(const RTCOfferOptions& aOptions)
options.mDontOfferDataChannel =
mozilla::Some(aOptions.mMozDontOfferDataChannel.Value());
}
#endif
return CreateOffer(options);
}
@ -1768,10 +1686,8 @@ PeerConnectionImpl::SetLocalDescription(int32_t aAction, const char* aSDP)
STAMP_TIMECARD(mTimeCard, "Set Local Description");
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
bool isolated = mMedia->AnyLocalTrackHasPeerIdentity();
mPrivacyRequested = mPrivacyRequested || isolated;
#endif
mLocalRequestedSDP = aSDP;
@ -1838,7 +1754,6 @@ static void DeferredSetRemote(const std::string& aPcHandle,
static void StartTrack(MediaStream* aSource,
TrackID aTrackId,
nsAutoPtr<MediaSegment>&& aSegment) {
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
class Message : public ControlMessage {
public:
Message(MediaStream* aStream,
@ -1886,7 +1801,6 @@ static void StartTrack(MediaStream* aSource,
MakeUnique<Message>(aSource, aTrackId, Move(aSegment)));
CSFLogInfo(logTag, "Dispatched track-add for track id %u on stream %p",
aTrackId, aSource);
#endif
}
@ -1938,16 +1852,11 @@ PeerConnectionImpl::CreateNewRemoteTracks(RefPtr<PeerConnectionObserver>& aPco)
CSFLogDebug(logTag, "Added remote stream %s", info->GetId().c_str());
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
info->GetMediaStream()->AssignId(NS_ConvertUTF8toUTF16(streamId.c_str()));
info->GetMediaStream()->SetLogicalStreamStartTime(
info->GetMediaStream()->GetPlaybackStream()->GetCurrentTime());
#else
info->GetMediaStream()->AssignId((streamId));
#endif
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
Sequence<OwningNonNull<DOMMediaStream>> streams;
if (!streams.AppendElement(OwningNonNull<DOMMediaStream>(
*info->GetMediaStream()),
@ -1969,7 +1878,6 @@ PeerConnectionImpl::CreateNewRemoteTracks(RefPtr<PeerConnectionObserver>& aPco)
// we're not sure and we can fix the stream in SetDtlsConnected
principal = nsNullPrincipal::CreateWithInheritedAttributes(doc->NodePrincipal());
}
#endif
// We need to select unique ids, just use max + 1
TrackID maxTrackId = 0;
@ -1984,12 +1892,8 @@ PeerConnectionImpl::CreateNewRemoteTracks(RefPtr<PeerConnectionObserver>& aPco)
for (RefPtr<JsepTrack>& track : tracks) {
std::string webrtcTrackId(track->GetTrackId());
if (!info->HasTrack(webrtcTrackId)) {
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
RefPtr<RemoteTrackSource> source =
new RemoteTrackSource(principal, nsString());
#else
RefPtr<MediaStreamTrackSource> source = new MediaStreamTrackSource();
#endif
TrackID trackID = ++maxTrackId;
RefPtr<MediaStreamTrack> domTrack;
nsAutoPtr<MediaSegment> segment;
@ -2006,9 +1910,7 @@ PeerConnectionImpl::CreateNewRemoteTracks(RefPtr<PeerConnectionObserver>& aPco)
MediaSegment::VIDEO,
source);
info->GetMediaStream()->AddTrackInternal(domTrack);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
segment = new VideoSegment;
#endif
}
StartTrack(info->GetMediaStream()->GetInputStream()->AsSourceStream(),
@ -2017,7 +1919,6 @@ PeerConnectionImpl::CreateNewRemoteTracks(RefPtr<PeerConnectionObserver>& aPco)
CSFLogDebug(logTag, "Added remote track %s/%s",
info->GetId().c_str(), webrtcTrackId.c_str());
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
domTrack->AssignId(NS_ConvertUTF8toUTF16(webrtcTrackId.c_str()));
aPco->OnAddTrack(*domTrack, streams, jrv);
if (jrv.Failed()) {
@ -2025,7 +1926,6 @@ PeerConnectionImpl::CreateNewRemoteTracks(RefPtr<PeerConnectionObserver>& aPco)
webrtcTrackId.c_str(),
jrv.ErrorCodeAsInt());
}
#endif
}
}
@ -2165,9 +2065,7 @@ PeerConnectionImpl::SetRemoteDescription(int32_t action, const char* aSDP)
RemoveOldRemoteTracks(pco);
pco->OnSetRemoteDescriptionSuccess(jrv);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
startCallTelem();
#endif
}
UpdateSignalingState(sdpType == mozilla::kJsepSdpRollback);
@ -2176,7 +2074,6 @@ PeerConnectionImpl::SetRemoteDescription(int32_t action, const char* aSDP)
// WebRTC uses highres time relative to the UNIX epoch (Jan 1, 1970, UTC).
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsresult
PeerConnectionImpl::GetTimeSinceEpoch(DOMHighResTimeStamp *result) {
MOZ_ASSERT(NS_IsMainThread());
@ -2202,13 +2099,11 @@ public:
mTimestamp.Construct(now);
}
};
#endif
NS_IMETHODIMP
PeerConnectionImpl::GetStats(MediaStreamTrack *aSelector) {
PC_AUTO_ENTER_API_CALL(true);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (!mMedia) {
// Since we zero this out before the d'tor, we should check.
return NS_ERROR_UNEXPECTED;
@ -2225,7 +2120,6 @@ PeerConnectionImpl::GetStats(MediaStreamTrack *aSelector) {
mHandle,
query),
NS_DISPATCH_NORMAL);
#endif
return NS_OK;
}
@ -2248,7 +2142,6 @@ PeerConnectionImpl::AddIceCandidate(const char* aCandidate, const char* aMid, un
CSFLogDebug(logTag, "AddIceCandidate: %s", aCandidate);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// When remote candidates are added before our ICE ctx is up and running
// (the transition to New is async through STS, so this is not impossible),
// we won't record them as trickle candidates. Is this what we want?
@ -2262,7 +2155,6 @@ PeerConnectionImpl::AddIceCandidate(const char* aCandidate, const char* aMid, un
timeDelta.ToMilliseconds());
}
}
#endif
nsresult res = mJsepSession->AddRemoteIceCandidate(aCandidate, aMid, aLevel);
@ -2318,7 +2210,6 @@ PeerConnectionImpl::CloseStreams() {
return NS_OK;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsresult
PeerConnectionImpl::SetPeerIdentity(const nsAString& aPeerIdentity)
{
@ -2342,7 +2233,6 @@ PeerConnectionImpl::SetPeerIdentity(const nsAString& aPeerIdentity)
}
return NS_OK;
}
#endif
nsresult
PeerConnectionImpl::SetDtlsConnected(bool aPrivacyRequested)
@ -2353,7 +2243,6 @@ PeerConnectionImpl::SetDtlsConnected(bool aPrivacyRequested)
// fixate on that peer. Dealing with multiple peers or connections is more
// than this run-down wreck of an object can handle.
// Besides, this is only used to say if we have been connected ever.
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (!mPrivacyRequested && !aPrivacyRequested && !mDtlsConnected) {
// now we know that privacy isn't needed for sure
nsIDocument* doc = GetWindow()->GetExtantDoc();
@ -2363,13 +2252,11 @@ PeerConnectionImpl::SetDtlsConnected(bool aPrivacyRequested)
}
mMedia->UpdateRemoteStreamPrincipals_m(doc->NodePrincipal());
}
#endif
mDtlsConnected = true;
mPrivacyRequested = mPrivacyRequested || aPrivacyRequested;
return NS_OK;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
void
PeerConnectionImpl::PrincipalChanged(MediaStreamTrack* aTrack) {
nsIDocument* doc = GetWindow()->GetExtantDoc();
@ -2379,30 +2266,21 @@ PeerConnectionImpl::PrincipalChanged(MediaStreamTrack* aTrack) {
CSFLogInfo(logTag, "Can't update sink principal; document gone");
}
}
#endif
std::string
PeerConnectionImpl::GetTrackId(const MediaStreamTrack& aTrack)
{
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsString wideTrackId;
aTrack.GetId(wideTrackId);
return NS_ConvertUTF16toUTF8(wideTrackId).get();
#else
return aTrack.GetId();
#endif
}
std::string
PeerConnectionImpl::GetStreamId(const DOMMediaStream& aStream)
{
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsString wideStreamId;
aStream.GetId(wideStreamId);
return NS_ConvertUTF16toUTF8(wideStreamId).get();
#else
return aStream.GetId();
#endif
}
void
@ -2441,9 +2319,7 @@ PeerConnectionImpl::AddTrack(MediaStreamTrack& aTrack,
trackId.c_str(), streamId.c_str());
aTrack.AddPrincipalChangeObserver(this);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
PrincipalChanged(&aTrack);
#endif
if (aTrack.AsAudioStreamTrack()) {
res = AddTrackToJsepSession(SdpMediaSection::kAudio, streamId, trackId);
@ -2454,13 +2330,11 @@ PeerConnectionImpl::AddTrack(MediaStreamTrack& aTrack,
}
if (aTrack.AsVideoStreamTrack()) {
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (!Preferences::GetBool("media.peerconnection.video.enabled", true)) {
// Before this code was moved, this would silently ignore just like it
// does now. Is this actually what we want to do?
return NS_OK;
}
#endif
res = AddTrackToJsepSession(SdpMediaSection::kVideo, streamId, trackId);
if (NS_FAILED(res)) {
@ -2496,7 +2370,6 @@ PeerConnectionImpl::RemoveTrack(MediaStreamTrack& aTrack) {
std::string trackId = PeerConnectionImpl::GetTrackId(aTrack);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsString wideTrackId;
aTrack.GetId(wideTrackId);
for (size_t i = 0; i < mDTMFStates.Length(); ++i) {
@ -2506,7 +2379,6 @@ PeerConnectionImpl::RemoveTrack(MediaStreamTrack& aTrack) {
break;
}
}
#endif
RefPtr<LocalSourceStreamInfo> info = media()->GetLocalStreamByTrackId(trackId);
@ -2553,7 +2425,6 @@ NS_IMETHODIMP
PeerConnectionImpl::InsertDTMF(mozilla::dom::RTCRtpSender& sender,
const nsAString& tones, uint32_t duration,
uint32_t interToneGap) {
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
PC_AUTO_ENTER_API_CALL(false);
// Check values passed in from PeerConnection.js
@ -2612,14 +2483,12 @@ PeerConnectionImpl::InsertDTMF(mozilla::dom::RTCRtpSender& sender,
state->mSendTimer->InitWithFuncCallback(DTMFSendTimerCallback_m, state, 0,
nsITimer::TYPE_ONE_SHOT);
}
#endif
return NS_OK;
}
NS_IMETHODIMP
PeerConnectionImpl::GetDTMFToneBuffer(mozilla::dom::RTCRtpSender& sender,
nsAString& outToneBuffer) {
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
PC_AUTO_ENTER_API_CALL(false);
JSErrorResult jrv;
@ -2641,7 +2510,6 @@ PeerConnectionImpl::GetDTMFToneBuffer(mozilla::dom::RTCRtpSender& sender,
break;
}
}
#endif
return NS_OK;
}
@ -2651,7 +2519,6 @@ PeerConnectionImpl::ReplaceTrack(MediaStreamTrack& aThisTrack,
MediaStreamTrack& aWithTrack) {
PC_AUTO_ENTER_API_CALL(true);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsString trackId;
aThisTrack.GetId(trackId);
@ -2662,7 +2529,6 @@ PeerConnectionImpl::ReplaceTrack(MediaStreamTrack& aThisTrack,
break;
}
}
#endif
RefPtr<PeerConnectionObserver> pco = do_QueryObjectReferent(mPCObserver);
if (!pco) {
@ -2670,7 +2536,6 @@ PeerConnectionImpl::ReplaceTrack(MediaStreamTrack& aThisTrack,
}
JSErrorResult jrv;
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (&aThisTrack == &aWithTrack) {
pco->OnReplaceTrackSuccess(jrv);
if (jrv.Failed()) {
@ -2695,7 +2560,6 @@ PeerConnectionImpl::ReplaceTrack(MediaStreamTrack& aThisTrack,
}
return NS_OK;
}
#endif
std::string origTrackId = PeerConnectionImpl::GetTrackId(aThisTrack);
std::string newTrackId = PeerConnectionImpl::GetTrackId(aWithTrack);
@ -2745,9 +2609,7 @@ PeerConnectionImpl::ReplaceTrack(MediaStreamTrack& aThisTrack,
}
aThisTrack.RemovePrincipalChangeObserver(this);
aWithTrack.AddPrincipalChangeObserver(this);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
PrincipalChanged(&aWithTrack);
#endif
// We update the media pipelines here so we can apply different codec
// settings for different sources (e.g. screensharing as opposed to camera.)
@ -2767,7 +2629,6 @@ PeerConnectionImpl::ReplaceTrack(MediaStreamTrack& aThisTrack,
return NS_OK;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
NS_IMETHODIMP
PeerConnectionImpl::SetParameters(MediaStreamTrack& aTrack,
const RTCRtpParameters& aParameters) {
@ -2789,7 +2650,6 @@ PeerConnectionImpl::SetParameters(MediaStreamTrack& aTrack,
}
return SetParameters(aTrack, constraints);
}
#endif
nsresult
PeerConnectionImpl::SetParameters(
@ -2807,7 +2667,6 @@ PeerConnectionImpl::SetParameters(
return mJsepSession->SetParameters(streamId, trackId, aConstraints);
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
NS_IMETHODIMP
PeerConnectionImpl::GetParameters(MediaStreamTrack& aTrack,
RTCRtpParameters& aOutParameters) {
@ -2828,7 +2687,6 @@ PeerConnectionImpl::GetParameters(MediaStreamTrack& aTrack,
}
return NS_OK;
}
#endif
nsresult
PeerConnectionImpl::GetParameters(
@ -2854,11 +2712,7 @@ PeerConnectionImpl::CalculateFingerprint(
size_t len = 0;
MOZ_ASSERT(fingerprint);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
const UniqueCERTCertificate& cert = mCertificate->Certificate();
#else
const UniqueCERTCertificate& cert = mIdentity->cert();
#endif
nsresult rv = DtlsIdentity::ComputeFingerprint(cert, algorithm,
&buf[0], sizeof(buf),
&len);
@ -2876,9 +2730,7 @@ NS_IMETHODIMP
PeerConnectionImpl::GetFingerprint(char** fingerprint)
{
MOZ_ASSERT(fingerprint);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
MOZ_ASSERT(mCertificate);
#endif
std::vector<uint8_t> fp;
nsresult rv = CalculateFingerprint(DtlsIdentity::DEFAULT_HASH_ALGORITHM, &fp);
NS_ENSURE_SUCCESS(rv, rv);
@ -2996,7 +2848,6 @@ PeerConnectionImpl::PluginCrash(uint32_t aPluginID,
CSFLogError(logTag, "%s: Our plugin %llu crashed", __FUNCTION__, static_cast<unsigned long long>(aPluginID));
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsCOMPtr<nsIDocument> doc = mWindow->GetExtantDoc();
if (!doc) {
NS_WARNING("Couldn't get document for PluginCrashed event!");
@ -3018,7 +2869,6 @@ PeerConnectionImpl::PluginCrash(uint32_t aPluginID,
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
EventDispatcher::DispatchDOMEvent(mWindow, nullptr, event, nullptr, nullptr);
#endif
return true;
}
@ -3030,7 +2880,6 @@ PeerConnectionImpl::RecordEndOfCallTelemetry() const
return;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Bitmask used for WEBRTC/LOOP_CALL_TYPE telemetry reporting
static const uint32_t kAudioTypeMask = 1;
static const uint32_t kVideoTypeMask = 2;
@ -3068,7 +2917,6 @@ PeerConnectionImpl::RecordEndOfCallTelemetry() const
}
Telemetry::Accumulate(Telemetry::WEBRTC_CALL_TYPE,
type);
#endif
}
nsresult
@ -3093,14 +2941,12 @@ PeerConnectionImpl::CloseInt()
if (mJsepSession) {
mJsepSession->Close();
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (mDataConnection) {
CSFLogInfo(logTag, "%s: Destroying DataChannelConnection %p for %s",
__FUNCTION__, (void *) mDataConnection.get(), mHandle.c_str());
mDataConnection->Destroy();
mDataConnection = nullptr; // it may not go away until the runnables are dead
}
#endif
ShutdownMedia();
// DataConnection will need to stay alive until all threads/runnables exit
@ -3116,7 +2962,6 @@ PeerConnectionImpl::ShutdownMedia()
if (!mMedia)
return;
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// before we destroy references to local tracks, detach from them
for(uint32_t i = 0; i < media()->LocalStreamsLength(); ++i) {
LocalSourceStreamInfo *info = media()->GetLocalStreamByIndex(i);
@ -3131,7 +2976,6 @@ PeerConnectionImpl::ShutdownMedia()
Telemetry::Accumulate(Telemetry::WEBRTC_CALL_DURATION,
timeDelta.ToSeconds());
}
#endif
// Forget the reference so that we can transfer it to
// SelfDestruct().
@ -3415,7 +3259,6 @@ PeerConnectionImpl::SendLocalIceCandidateToContent(
NS_DISPATCH_NORMAL);
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
static bool isDone(PCImplIceConnectionState state) {
return state != PCImplIceConnectionState::Checking &&
state != PCImplIceConnectionState::New;
@ -3429,7 +3272,6 @@ static bool isSucceeded(PCImplIceConnectionState state) {
static bool isFailed(PCImplIceConnectionState state) {
return state == PCImplIceConnectionState::Failed;
}
#endif
void PeerConnectionImpl::IceConnectionStateChange(
NrIceCtx* ctx,
@ -3445,7 +3287,6 @@ void PeerConnectionImpl::IceConnectionStateChange(
return;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (!isDone(mIceConnectionState) && isDone(domState)) {
// mIceStartTime can be null if going directly from New to Closed, in which
// case we don't count it as a success or a failure.
@ -3470,7 +3311,6 @@ void PeerConnectionImpl::IceConnectionStateChange(
mAddCandidateErrorCount);
}
}
#endif
mIceConnectionState = domState;
@ -3489,10 +3329,8 @@ void PeerConnectionImpl::IceConnectionStateChange(
STAMP_TIMECARD(mTimeCard, "Ice state: new");
break;
case PCImplIceConnectionState::Checking:
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// For telemetry
mIceStartTime = TimeStamp::Now();
#endif
STAMP_TIMECARD(mTimeCard, "Ice state: checking");
break;
case PCImplIceConnectionState::Connected:
@ -3591,7 +3429,6 @@ PeerConnectionImpl::EndOfLocalCandidates(uint16_t level) {
mJsepSession->EndOfLocalCandidates(level);
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsresult
PeerConnectionImpl::BuildStatsQuery_m(
mozilla::dom::MediaStreamTrack *aSelector,
@ -4022,13 +3859,9 @@ void PeerConnectionImpl::DeliverStatsReportToPCObserver_m(
}
}
#endif
void
PeerConnectionImpl::RecordLongtermICEStatistics() {
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
WebrtcGlobalInformation::StoreLongTermICEStatistics(*this);
#endif
}
void
@ -4088,7 +3921,6 @@ PeerConnectionImpl::IceStreamReady(NrIceMediaStream *aStream)
CSFLogDebug(logTag, "%s: %s", __FUNCTION__, aStream->name().c_str());
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
//Telemetry for when calls start
void
PeerConnectionImpl::startCallTelem() {
@ -4103,38 +3935,29 @@ PeerConnectionImpl::startCallTelem() {
// If we want to track Loop calls independently here, we need two histograms.
Telemetry::Accumulate(Telemetry::WEBRTC_CALL_COUNT_2, 1);
}
#endif
NS_IMETHODIMP
PeerConnectionImpl::GetLocalStreams(nsTArray<RefPtr<DOMMediaStream > >& result)
{
PC_AUTO_ENTER_API_CALL_NO_CHECK();
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
for(uint32_t i=0; i < media()->LocalStreamsLength(); i++) {
LocalSourceStreamInfo *info = media()->GetLocalStreamByIndex(i);
NS_ENSURE_TRUE(info, NS_ERROR_UNEXPECTED);
result.AppendElement(info->GetMediaStream());
}
return NS_OK;
#else
return NS_ERROR_FAILURE;
#endif
}
NS_IMETHODIMP
PeerConnectionImpl::GetRemoteStreams(nsTArray<RefPtr<DOMMediaStream > >& result)
{
PC_AUTO_ENTER_API_CALL_NO_CHECK();
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
for(uint32_t i=0; i < media()->RemoteStreamsLength(); i++) {
RemoteSourceStreamInfo *info = media()->GetRemoteStreamByIndex(i);
NS_ENSURE_TRUE(info, NS_ERROR_UNEXPECTED);
result.AppendElement(info->GetMediaStream());
}
return NS_OK;
#else
return NS_ERROR_FAILURE;
#endif
}
void
@ -4179,7 +4002,6 @@ PeerConnectionImpl::DTMFSendTimerCallback_m(nsITimer* timer, void* closure)
state->mSendTimer->Cancel();
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
RefPtr<PeerConnectionObserver> pco = do_QueryObjectReferent(state->mPeerConnectionImpl->mPCObserver);
if (!pco) {
NS_WARNING("Failed to dispatch the RTCDTMFToneChange event!");
@ -4193,7 +4015,6 @@ PeerConnectionImpl::DTMFSendTimerCallback_m(nsITimer* timer, void* closure)
NS_WARNING("Failed to dispatch the RTCDTMFToneChange event!");
return;
}
#endif
}
} // end mozilla namespace

View File

@ -34,7 +34,6 @@
#include "PrincipalChangeObserver.h"
#include "StreamTracks.h"
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "mozilla/TimeStamp.h"
#include "mozilla/net/DataChannel.h"
#include "VideoUtils.h"
@ -42,7 +41,6 @@
#include "mozilla/dom/RTCStatsReportBinding.h"
#include "nsIPrincipal.h"
#include "mozilla/PeerIdentity.h"
#endif
namespace test {
#ifdef USE_FAKE_PCOBSERVER
@ -116,9 +114,7 @@ using mozilla::DtlsIdentity;
using mozilla::ErrorResult;
using mozilla::NrIceStunServer;
using mozilla::NrIceTurnServer;
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
using mozilla::PeerIdentity;
#endif
class PeerConnectionWrapper;
class PeerConnectionMedia;
@ -176,10 +172,8 @@ public:
void setIceTransportPolicy(NrIceCtx::Policy policy) { mIceTransportPolicy = policy;}
NrIceCtx::Policy getIceTransportPolicy() const { return mIceTransportPolicy; }
#ifndef MOZILLA_EXTERNAL_LINKAGE
nsresult Init(const RTCConfiguration& aSrc);
nsresult AddIceServer(const RTCIceServer& aServer);
#endif
private:
std::vector<NrIceStunServer> mStunServers;
@ -188,7 +182,6 @@ private:
NrIceCtx::Policy mIceTransportPolicy;
};
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Not an inner class so we can forward declare.
class RTCStatsQuery {
public:
@ -211,7 +204,6 @@ class RTCStatsQuery {
bool grabAllLevels;
DOMHighResTimeStamp now;
};
#endif // MOZILLA_INTERNAL_API
// Enter an API call and check that the state is OK,
// the PC isn't closed, etc.
@ -230,10 +222,8 @@ class RTCStatsQuery {
#define PC_AUTO_ENTER_API_CALL_NO_CHECK() CheckThread()
class PeerConnectionImpl final : public nsISupports,
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
public mozilla::DataChannelConnection::DataConnectionListener,
public dom::PrincipalChangeObserver<dom::MediaStreamTrack>,
#endif
public sigslot::has_slots<>
{
struct Internal; // Avoid exposing c includes to bindings
@ -254,9 +244,7 @@ public:
NS_DECL_THREADSAFE_ISUPPORTS
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
#endif
static already_AddRefed<PeerConnectionImpl>
Constructor(const mozilla::dom::GlobalObject& aGlobal, ErrorResult& rv);
@ -268,11 +256,9 @@ public:
// DataConnection observers
void NotifyDataChannel(already_AddRefed<mozilla::DataChannel> aChannel)
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// PeerConnectionImpl only inherits from mozilla::DataChannelConnection
// inside libxul.
override
#endif
;
// Get the media object
@ -336,19 +322,15 @@ public:
const PeerConnectionConfiguration& aConfiguration,
nsISupports* aThread);
#ifndef MOZILLA_EXTERNAL_LINKAGE
// Initialize PeerConnection from an RTCConfiguration object (JS entrypoint)
void Initialize(PeerConnectionObserver& aObserver,
nsGlobalWindow& aWindow,
const RTCConfiguration& aConfiguration,
nsISupports* aThread,
ErrorResult &rv);
#endif
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
void SetCertificate(mozilla::dom::RTCCertificate& aCertificate);
const RefPtr<mozilla::dom::RTCCertificate>& Certificate() const;
#endif
// This is a hack to support external linkage.
RefPtr<DtlsIdentity> Identity() const;
@ -446,7 +428,6 @@ public:
rv = ReplaceTrack(aThisTrack, aWithTrack);
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
NS_IMETHODIMP_TO_ERRORRESULT(SetParameters, ErrorResult &rv,
dom::MediaStreamTrack& aTrack,
const dom::RTCRtpParameters& aParameters)
@ -460,7 +441,6 @@ public:
{
rv = GetParameters(aTrack, aOutParameters);
}
#endif
nsresult
SetParameters(dom::MediaStreamTrack& aTrack,
@ -479,18 +459,15 @@ public:
nsresult GetPeerIdentity(nsAString& peerIdentity)
{
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (mPeerIdentity) {
peerIdentity = mPeerIdentity->ToString();
return NS_OK;
}
#endif
peerIdentity.SetIsVoid(true);
return NS_OK;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
const PeerIdentity* GetPeerIdentity() const { return mPeerIdentity; }
nsresult SetPeerIdentity(const nsAString& peerIdentity);
@ -510,7 +487,6 @@ public:
mName = NS_ConvertUTF16toUTF8(id).get();
return NS_OK;
}
#endif
// this method checks to see if we've made a promise to protect media.
bool PrivacyRequested() const { return mPrivacyRequested; }
@ -635,7 +611,6 @@ public:
bool HasMedia() const;
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// initialize telemetry for when calls start
void startCallTelem();
@ -649,8 +624,6 @@ public:
// PeerConnectionMedia can't do it because it doesn't know about principals
virtual void PrincipalChanged(dom::MediaStreamTrack* aTrack) override;
#endif
static std::string GetStreamId(const DOMMediaStream& aStream);
static std::string GetTrackId(const dom::MediaStreamTrack& track);
@ -672,22 +645,13 @@ private:
MOZ_ASSERT(CheckThreadInt(), "Wrong thread");
}
bool CheckThreadInt() const {
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Thread assertions are disabled in the C++ unit tests because those
// make API calls off the main thread.
// This affects the standalone version of WebRTC since it is also used
// for an alternate build of the unit tests.
// TODO(ekr@rtfm.com): Fix the unit tests so they don't do that.
bool on;
NS_ENSURE_SUCCESS(mThread->IsOnCurrentThread(&on), false);
NS_ENSURE_TRUE(on, false);
#endif
return true;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
nsresult GetTimeSinceEpoch(DOMHighResTimeStamp *result);
#endif
// Shut down media - called on main thread only
void ShutdownMedia();
@ -716,7 +680,6 @@ private:
nsresult RollbackIceRestart();
void FinalizeIceRestart();
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
static void GetStatsForPCObserver_s(
const std::string& pcHandle,
nsAutoPtr<RTCStatsQuery> query);
@ -726,7 +689,6 @@ private:
const std::string& pcHandle,
nsresult result,
nsAutoPtr<RTCStatsQuery> query);
#endif
// When ICE completes, we record a bunch of statistics that outlive the
// PeerConnection. This is just telemetry right now, but this can also
@ -769,15 +731,11 @@ private:
std::string mRemoteFingerprint;
// identity-related fields
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// The entity on the other end of the peer-to-peer connection;
// void if they are not yet identified, and no identity setting has been set
RefPtr<PeerIdentity> mPeerIdentity;
// The certificate we are using.
RefPtr<mozilla::dom::RTCCertificate> mCertificate;
#else
RefPtr<DtlsIdentity> mIdentity;
#endif
// Whether an app should be prevented from accessing media produced by the PC
// If this is true, then media will not be sent until mPeerIdentity matches
// local streams PeerIdentity; and remote streams are protected from content
@ -795,10 +753,8 @@ private:
// The target to run stuff on
nsCOMPtr<nsIEventTarget> mSTSThread;
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// DataConnection that's used to get all the DataChannels
RefPtr<mozilla::DataChannelConnection> mDataConnection;
#endif
bool mAllowIceLoopback;
bool mAllowIceLinkLocal;
@ -811,12 +767,10 @@ private:
std::string mPreviousIceUfrag; // used during rollback of ice restart
std::string mPreviousIcePwd; // used during rollback of ice restart
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Start time of ICE, used for telemetry
mozilla::TimeStamp mIceStartTime;
// Start time of call used for Telemetry
mozilla::TimeStamp mStartTime;
#endif
// Temporary: used to prevent multiple audio streams or multiple video streams
// in a single PC. This is tied up in the IETF discussion around proper

View File

@ -42,7 +42,6 @@
#include "nsProxyRelease.h"
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "MediaStreamList.h"
#include "nsIScriptGlobalObject.h"
#include "mozilla/Preferences.h"
@ -52,7 +51,6 @@
#include "VideoStreamTrack.h"
#include "MediaStreamError.h"
#include "MediaManager.h"
#endif
@ -124,7 +122,6 @@ SourceStreamInfo::EndTrack(MediaStream* stream, dom::MediaStreamTrack* track)
return;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
class Message : public ControlMessage {
public:
Message(MediaStream* stream, TrackID track)
@ -140,8 +137,6 @@ SourceStreamInfo::EndTrack(MediaStream* stream, dom::MediaStreamTrack* track)
stream->GraphImpl()->AppendMessage(
MakeUnique<Message>(stream, track->mTrackID));
#endif
}
void
@ -282,7 +277,6 @@ PeerConnectionMedia::PeerConnectionMedia(PeerConnectionImpl *parent)
nsresult
PeerConnectionMedia::InitProxy()
{
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Allow mochitests to disable this, since mochitest configures a fake proxy
// that serves up content.
bool disable = Preferences::GetBool("media.peerconnection.disable_http_proxy",
@ -291,7 +285,6 @@ PeerConnectionMedia::InitProxy()
mProxyResolveCompleted = true;
return NS_OK;
}
#endif
nsresult rv;
nsCOMPtr<nsIProtocolProxyService> pps =
@ -360,11 +353,7 @@ nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_serv
nsresult rv = InitProxy();
NS_ENSURE_SUCCESS(rv, rv);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
bool ice_tcp = Preferences::GetBool("media.peerconnection.ice.tcp", false);
#else
bool ice_tcp = false;
#endif
// TODO(ekr@rtfm.com): need some way to set not offerer later
// Looks like a bug in the NrIceCtx API.
@ -384,11 +373,7 @@ nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_serv
return rv;
}
// Give us a way to globally turn off TURN support
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
bool disabled = Preferences::GetBool("media.peerconnection.turn.disable", false);
#else
bool disabled = false;
#endif
if (!disabled) {
if (NS_FAILED(rv = mIceCtxHdlr->ctx()->SetTurnServers(turn_servers))) {
CSFLogError(logTag, "%s: Failed to set turn servers", __FUNCTION__);
@ -791,16 +776,12 @@ PeerConnectionMedia::GetPrefDefaultAddressOnly() const
{
ASSERT_ON_THREAD(mMainThread); // will crash on STS thread
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
uint64_t winId = mParent->GetWindow()->WindowID();
bool default_address_only = Preferences::GetBool(
"media.peerconnection.ice.default_address_only", false);
default_address_only |=
!MediaManager::Get()->IsActivelyCapturingOrHasAPermission(winId);
#else
bool default_address_only = true;
#endif
return default_address_only;
}
@ -809,11 +790,7 @@ PeerConnectionMedia::GetPrefProxyOnly() const
{
ASSERT_ON_THREAD(mMainThread); // will crash on STS thread
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
return Preferences::GetBool("media.peerconnection.ice.proxy_only", false);
#else
return false;
#endif
}
void
@ -1471,7 +1448,6 @@ LocalSourceStreamInfo::TakePipelineFrom(RefPtr<LocalSourceStreamInfo>& info,
return NS_OK;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
/**
* Tells you if any local track is isolated to a specific peer identity.
* Obviously, we want all the tracks to be isolated equally so that they can
@ -1550,7 +1526,6 @@ void RemoteSourceStreamInfo::UpdatePrincipal_m(nsIPrincipal* aPrincipal)
}
}
}
#endif // MOZILLA_INTERNAL_API
bool
PeerConnectionMedia::AnyCodecHasPluginID(uint64_t aPluginID)
@ -1702,7 +1677,6 @@ LocalSourceStreamInfo::ForgetPipelineByTrackId_m(const std::string& trackId)
return nullptr;
}
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
auto
RemoteTrackSource::ApplyConstraints(
nsPIDOMWindowInner* aWindow,
@ -1715,6 +1689,5 @@ RemoteTrackSource::ApplyConstraints(
NS_LITERAL_STRING("")));
return p.forget();
}
#endif
} // namespace mozilla

View File

@ -20,13 +20,11 @@
#include "signaling/src/jsep/JsepSession.h"
#include "AudioSegment.h"
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "Layers.h"
#include "VideoUtils.h"
#include "ImageLayers.h"
#include "VideoSegment.h"
#include "MediaStreamTrack.h"
#endif
class nsIPrincipal;
@ -143,11 +141,9 @@ public:
dom::MediaStreamTrack& aNewTrack,
const std::string& newTrackId);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
void UpdateSinkIdentity_m(dom::MediaStreamTrack* aTrack,
nsIPrincipal* aPrincipal,
const PeerIdentity* aSinkIdentity);
#endif
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(LocalSourceStreamInfo)
@ -156,7 +152,6 @@ private:
const std::string& trackId);
};
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
class RemoteTrackSource : public dom::MediaStreamTrackSource
{
public:
@ -188,7 +183,6 @@ public:
protected:
virtual ~RemoteTrackSource() {}
};
#endif
class RemoteSourceStreamInfo : public SourceStreamInfo {
~RemoteSourceStreamInfo() {}
@ -205,9 +199,7 @@ class RemoteSourceStreamInfo : public SourceStreamInfo {
void RemoveTrack(const std::string& trackId) override;
void SyncPipeline(RefPtr<MediaPipelineReceive> aPipeline);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
void UpdatePrincipal_m(nsIPrincipal* aPrincipal);
#endif
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RemoteSourceStreamInfo)
@ -339,7 +331,6 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
const std::string& aNewStreamId,
const std::string& aNewTrackId);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// In cases where the peer isn't yet identified, we disable the pipeline (not
// the stream, that would potentially affect others), so that it sends
// black/silence. Once the peer is identified, re-enable those streams.
@ -352,7 +343,6 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
// When we finally learn who is on the other end, we need to change the ownership
// on streams
void UpdateRemoteStreamPrincipals_m(nsIPrincipal* aPrincipal);
#endif
bool AnyCodecHasPluginID(uint64_t aPluginID);