mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1187775 - Plumb RTCConfiguration.iceTransportPolicy down to NrIceCtx. r=smaug, r=bwc
This commit is contained in:
parent
475b900fc8
commit
3f6eb608ed
@ -14,6 +14,12 @@ dictionary RTCIceServer {
|
||||
DOMString? username = null;
|
||||
};
|
||||
|
||||
enum RTCIceTransportPolicy {
|
||||
"none",
|
||||
"relay",
|
||||
"all"
|
||||
};
|
||||
|
||||
enum RTCBundlePolicy {
|
||||
"balanced",
|
||||
"max-compat",
|
||||
@ -22,6 +28,7 @@ enum RTCBundlePolicy {
|
||||
|
||||
dictionary RTCConfiguration {
|
||||
sequence<RTCIceServer> iceServers;
|
||||
RTCIceTransportPolicy iceTransportPolicy = "all";
|
||||
RTCBundlePolicy bundlePolicy = "balanced";
|
||||
DOMString? peerIdentity = null;
|
||||
sequence<RTCCertificate> certificates;
|
||||
|
@ -381,9 +381,10 @@ RefPtr<NrIceCtx> NrIceCtx::Create(const std::string& name,
|
||||
bool set_interface_priorities,
|
||||
bool allow_loopback,
|
||||
bool tcp_enabled,
|
||||
bool allow_link_local) {
|
||||
bool allow_link_local,
|
||||
Policy policy) {
|
||||
|
||||
RefPtr<NrIceCtx> ctx = new NrIceCtx(name, offerer);
|
||||
RefPtr<NrIceCtx> ctx = new NrIceCtx(name, offerer, policy);
|
||||
|
||||
// Initialize the crypto callbacks and logging stuff
|
||||
if (!initialized) {
|
||||
@ -609,6 +610,11 @@ NrIceCtx::Controlling NrIceCtx::GetControlling() {
|
||||
return (peer_->controlling) ? ICE_CONTROLLING : ICE_CONTROLLED;
|
||||
}
|
||||
|
||||
nsresult NrIceCtx::SetPolicy(Policy policy) {
|
||||
policy_ = policy;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult NrIceCtx::SetStunServers(const std::vector<NrIceStunServer>&
|
||||
stun_servers) {
|
||||
if (stun_servers.empty())
|
||||
|
@ -208,12 +208,18 @@ class NrIceCtx {
|
||||
ICE_CONTROLLED
|
||||
};
|
||||
|
||||
enum Policy { ICE_POLICY_NONE,
|
||||
ICE_POLICY_RELAY,
|
||||
ICE_POLICY_ALL
|
||||
};
|
||||
|
||||
static RefPtr<NrIceCtx> Create(const std::string& name,
|
||||
bool offerer,
|
||||
bool set_interface_priorities = true,
|
||||
bool allow_loopback = false,
|
||||
bool tcp_enabled = true,
|
||||
bool allow_link_local = false);
|
||||
bool allow_link_local = false,
|
||||
Policy policy = ICE_POLICY_ALL);
|
||||
|
||||
// Deinitialize all ICE global state. Used only for testing.
|
||||
static void internal_DeinitializeGlobal();
|
||||
@ -272,6 +278,14 @@ class NrIceCtx {
|
||||
|
||||
Controlling GetControlling();
|
||||
|
||||
// Set whether we're allowed to produce none, relay or all candidates.
|
||||
// TODO(jib@mozilla.com): Work out what change means mid-connection (1181768)
|
||||
nsresult SetPolicy(Policy policy);
|
||||
|
||||
Policy policy() const {
|
||||
return policy_;
|
||||
}
|
||||
|
||||
// Set the STUN servers. Must be called before StartGathering
|
||||
// (if at all).
|
||||
nsresult SetStunServers(const std::vector<NrIceStunServer>& stun_servers);
|
||||
@ -315,7 +329,8 @@ class NrIceCtx {
|
||||
|
||||
private:
|
||||
NrIceCtx(const std::string& name,
|
||||
bool offerer)
|
||||
bool offerer,
|
||||
Policy policy)
|
||||
: connection_state_(ICE_CTX_INIT),
|
||||
gathering_state_(ICE_CTX_GATHER_INIT),
|
||||
name_(name),
|
||||
@ -325,7 +340,8 @@ class NrIceCtx {
|
||||
peer_(nullptr),
|
||||
ice_handler_vtbl_(nullptr),
|
||||
ice_handler_(nullptr),
|
||||
trickle_(true) {
|
||||
trickle_(true),
|
||||
policy_(policy) {
|
||||
// XXX: offerer_ will be used eventually; placate clang in the meantime.
|
||||
(void)offerer_;
|
||||
}
|
||||
@ -371,6 +387,7 @@ class NrIceCtx {
|
||||
nr_ice_handler* ice_handler_; // Must be pointer
|
||||
bool trickle_;
|
||||
nsCOMPtr<nsIEventTarget> sts_target_; // The thread to run on
|
||||
Policy policy_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -504,7 +504,8 @@ int main(int argc, char **argv)
|
||||
std::string dummy("dummy");
|
||||
RUN_ON_THREAD(test_utils->sts_target(),
|
||||
WrapRunnableNM(&NrIceCtx::Create,
|
||||
dummy, false, false, false, false, false),
|
||||
dummy, false, false, false, false, false,
|
||||
NrIceCtx::ICE_POLICY_ALL),
|
||||
NS_DISPATCH_SYNC);
|
||||
|
||||
// Start the tests
|
||||
|
@ -522,6 +522,20 @@ PeerConnectionConfiguration::Init(const RTCConfiguration& aSrc)
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
switch (aSrc.mIceTransportPolicy) {
|
||||
case dom::RTCIceTransportPolicy::None:
|
||||
setIceTransportPolicy(NrIceCtx::ICE_POLICY_NONE);
|
||||
break;
|
||||
case dom::RTCIceTransportPolicy::Relay:
|
||||
setIceTransportPolicy(NrIceCtx::ICE_POLICY_RELAY);
|
||||
break;
|
||||
case dom::RTCIceTransportPolicy::All:
|
||||
setIceTransportPolicy(NrIceCtx::ICE_POLICY_ALL);
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -738,7 +752,8 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
|
||||
|
||||
// Initialize the media object.
|
||||
res = mMedia->Init(aConfiguration.getStunServers(),
|
||||
aConfiguration.getTurnServers());
|
||||
aConfiguration.getTurnServers(),
|
||||
aConfiguration.getIceTransportPolicy());
|
||||
if (NS_FAILED(res)) {
|
||||
CSFLogError(logTag, "%s: Couldn't initialize media object", __FUNCTION__);
|
||||
return res;
|
||||
|
@ -149,7 +149,9 @@ class PCUuidGenerator : public mozilla::JsepUuidGenerator {
|
||||
class PeerConnectionConfiguration
|
||||
{
|
||||
public:
|
||||
PeerConnectionConfiguration() : mBundlePolicy(kBundleBalanced) {}
|
||||
PeerConnectionConfiguration()
|
||||
: mBundlePolicy(kBundleBalanced),
|
||||
mIceTransportPolicy(NrIceCtx::ICE_POLICY_ALL) {}
|
||||
|
||||
bool addStunServer(const std::string& addr, uint16_t port,
|
||||
const char* transport)
|
||||
@ -186,6 +188,8 @@ public:
|
||||
const std::vector<NrIceTurnServer>& getTurnServers() const { return mTurnServers; }
|
||||
void setBundlePolicy(JsepBundlePolicy policy) { mBundlePolicy = policy;}
|
||||
JsepBundlePolicy getBundlePolicy() const { return mBundlePolicy; }
|
||||
void setIceTransportPolicy(NrIceCtx::Policy policy) { mIceTransportPolicy = policy;}
|
||||
NrIceCtx::Policy getIceTransportPolicy() const { return mIceTransportPolicy; }
|
||||
|
||||
#ifndef MOZILLA_EXTERNAL_LINKAGE
|
||||
nsresult Init(const RTCConfiguration& aSrc);
|
||||
@ -196,6 +200,7 @@ private:
|
||||
std::vector<NrIceStunServer> mStunServers;
|
||||
std::vector<NrIceTurnServer> mTurnServers;
|
||||
JsepBundlePolicy mBundlePolicy;
|
||||
NrIceCtx::Policy mIceTransportPolicy;
|
||||
};
|
||||
|
||||
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
|
||||
|
@ -230,7 +230,8 @@ PeerConnectionMedia::PeerConnectionMedia(PeerConnectionImpl *parent)
|
||||
}
|
||||
|
||||
nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_servers,
|
||||
const std::vector<NrIceTurnServer>& turn_servers)
|
||||
const std::vector<NrIceTurnServer>& turn_servers,
|
||||
NrIceCtx::Policy policy)
|
||||
{
|
||||
nsresult rv;
|
||||
#if defined(MOZILLA_XPCOMRT_API)
|
||||
@ -314,7 +315,8 @@ nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_serv
|
||||
true, // Explicitly set priorities
|
||||
mParent->GetAllowIceLoopback(),
|
||||
ice_tcp,
|
||||
mParent->GetAllowIceLinkLocal());
|
||||
mParent->GetAllowIceLinkLocal(),
|
||||
policy);
|
||||
if(!mIceCtx) {
|
||||
CSFLogError(logTag, "%s: Failed to create Ice Context", __FUNCTION__);
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -228,7 +228,8 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
|
||||
|
||||
PeerConnectionImpl* GetPC() { return mParent; }
|
||||
nsresult Init(const std::vector<NrIceStunServer>& stun_servers,
|
||||
const std::vector<NrIceTurnServer>& turn_servers);
|
||||
const std::vector<NrIceTurnServer>& turn_servers,
|
||||
NrIceCtx::Policy policy);
|
||||
// WARNING: This destroys the object!
|
||||
void SelfDestruct();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user