mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1027350 - Allow loopback addresses for ICE in signaling unit test. r=bwc
--HG-- extra : rebase_source : 3e73f02aa1c889f331c8326f17bb5e245204b780
This commit is contained in:
parent
d004d664c2
commit
a67889b98e
@ -260,6 +260,7 @@ PeerConnectionImpl::PeerConnectionImpl(const GlobalObject* aGlobal)
|
||||
, mIdentity(nullptr)
|
||||
, mPrivacyRequested(false)
|
||||
, mSTSThread(nullptr)
|
||||
, mAllowIceLoopback(false)
|
||||
, mMedia(nullptr)
|
||||
, mNumAudioStreams(0)
|
||||
, mNumVideoStreams(0)
|
||||
@ -609,6 +610,7 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
|
||||
}
|
||||
|
||||
mMedia = new PeerConnectionMedia(this);
|
||||
mMedia->SetAllowIceLoopback(mAllowIceLoopback);
|
||||
|
||||
// Connect ICE slots.
|
||||
mMedia->SignalIceGatheringStateChange.connect(
|
||||
|
@ -259,6 +259,9 @@ public:
|
||||
return mMedia;
|
||||
}
|
||||
|
||||
// Configure the ability to use localhost.
|
||||
void SetAllowIceLoopback(bool val) { mAllowIceLoopback = val; }
|
||||
|
||||
// Handle system to allow weak references to be passed through C code
|
||||
virtual const std::string& GetHandle();
|
||||
|
||||
@ -729,6 +732,7 @@ private:
|
||||
nsRefPtr<mozilla::DataChannelConnection> mDataConnection;
|
||||
#endif
|
||||
|
||||
bool mAllowIceLoopback;
|
||||
nsRefPtr<PeerConnectionMedia> mMedia;
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
|
@ -196,27 +196,26 @@ PeerConnectionImpl* PeerConnectionImpl::CreatePeerConnection()
|
||||
PeerConnectionMedia::PeerConnectionMedia(PeerConnectionImpl *parent)
|
||||
: mParent(parent),
|
||||
mParentHandle(parent->GetHandle()),
|
||||
mAllowIceLoopback(false),
|
||||
mIceCtx(nullptr),
|
||||
mDNSResolver(new mozilla::NrIceResolver()),
|
||||
mMainThread(mParent->GetMainThread()),
|
||||
mSTSThread(mParent->GetSTSThread()) {}
|
||||
mSTSThread(mParent->GetSTSThread()) {
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
mAllowIceLoopback = Preferences::GetBool(
|
||||
"media.peerconnection.ice.loopback", false);
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_servers,
|
||||
const std::vector<NrIceTurnServer>& turn_servers)
|
||||
{
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
bool allow_loopback = Preferences::GetBool(
|
||||
"media.peerconnection.ice.loopback", false);
|
||||
#else
|
||||
bool allow_loopback = false;
|
||||
#endif
|
||||
|
||||
// TODO(ekr@rtfm.com): need some way to set not offerer later
|
||||
// Looks like a bug in the NrIceCtx API.
|
||||
mIceCtx = NrIceCtx::Create("PC:" + mParent->GetName(),
|
||||
true, // Offerer
|
||||
true, // Trickle
|
||||
allow_loopback);
|
||||
mAllowIceLoopback);
|
||||
if(!mIceCtx) {
|
||||
CSFLogError(logTag, "%s: Failed to create Ice Context", __FUNCTION__);
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -296,6 +296,9 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
|
||||
// WARNING: This destroys the object!
|
||||
void SelfDestruct();
|
||||
|
||||
// Configure the ability to use localhost.
|
||||
void SetAllowIceLoopback(bool val) { mAllowIceLoopback = val; }
|
||||
|
||||
mozilla::RefPtr<mozilla::NrIceCtx> ice_ctx() const { return mIceCtx; }
|
||||
|
||||
mozilla::RefPtr<mozilla::NrIceMediaStream> ice_media_stream(size_t i) const {
|
||||
@ -443,6 +446,9 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
|
||||
// This is only accessed on the main thread (with one special exception)
|
||||
nsTArray<nsRefPtr<RemoteSourceStreamInfo> > mRemoteSourceStreams;
|
||||
|
||||
// Allow loopback for ICE.
|
||||
bool mAllowIceLoopback;
|
||||
|
||||
// ICE objects
|
||||
mozilla::RefPtr<mozilla::NrIceCtx> mIceCtx;
|
||||
std::vector<mozilla::RefPtr<mozilla::NrIceMediaStream> > mIceStreams;
|
||||
|
@ -947,7 +947,7 @@ class SignalingAgent {
|
||||
sipcc::PeerConnectionImpl *pcImpl =
|
||||
sipcc::PeerConnectionImpl::CreatePeerConnection();
|
||||
EXPECT_TRUE(pcImpl);
|
||||
|
||||
pcImpl->SetAllowIceLoopback(true);
|
||||
pc = new PCDispatchWrapper(pcImpl);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user