mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 817430: Set initial controlled/controlling values, based on inbound T/F. r=jesup
This commit is contained in:
parent
fd393200d4
commit
599486b77f
@ -349,6 +349,14 @@ void NrIceCtx::destroy_peer_ctx() {
|
||||
nr_ice_peer_ctx_destroy(&peer_);
|
||||
}
|
||||
|
||||
nsresult NrIceCtx::SetControlling(Controlling controlling) {
|
||||
peer_->controlling = (controlling == ICE_CONTROLLING)? 1 : 0;
|
||||
|
||||
MOZ_MTLOG(PR_LOG_DEBUG, "ICE ctx " << name_ << " setting controlling to" <<
|
||||
controlling);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult NrIceCtx::StartGathering() {
|
||||
this->AddRef();
|
||||
int r = nr_ice_initialize(ctx_, &NrIceCtx::initialized_cb,
|
||||
|
@ -84,6 +84,10 @@ class NrIceCtx {
|
||||
ICE_CTX_FAILED
|
||||
};
|
||||
|
||||
enum Controlling { ICE_CONTROLLING,
|
||||
ICE_CONTROLLED
|
||||
};
|
||||
|
||||
static RefPtr<NrIceCtx> Create(const std::string& name,
|
||||
bool offerer,
|
||||
bool set_interface_priorities = true);
|
||||
@ -111,6 +115,9 @@ class NrIceCtx {
|
||||
// Set the other side's global attributes
|
||||
nsresult ParseGlobalAttributes(std::vector<std::string> attrs);
|
||||
|
||||
// Set whether we are controlling or not.
|
||||
nsresult SetControlling(Controlling controlling);
|
||||
|
||||
// Start ICE gathering
|
||||
nsresult StartGathering();
|
||||
|
||||
|
@ -743,7 +743,7 @@ short vcmSetIceCandidate(const char *peerconnection,
|
||||
* @param[in] peerconnection - the peerconnection in use
|
||||
* @return 0 success, error failure
|
||||
*/
|
||||
static short vcmStartIceChecks_m(const char *peerconnection)
|
||||
static short vcmStartIceChecks_m(const char *peerconnection, cc_boolean isControlling)
|
||||
{
|
||||
CSFLogDebug( logTag, "%s: PC = %s", __FUNCTION__, peerconnection);
|
||||
|
||||
@ -751,6 +751,12 @@ static short vcmStartIceChecks_m(const char *peerconnection)
|
||||
ENSURE_PC(pc, VCM_ERROR);
|
||||
|
||||
nsresult res;
|
||||
res = pc.impl()->media()->ice_ctx()->SetControlling(
|
||||
isControlling ? NrIceCtx::ICE_CONTROLLING : NrIceCtx::ICE_CONTROLLED);
|
||||
if (!NS_SUCCEEDED(res)) {
|
||||
CSFLogError( logTag, "%s: couldn't set controlling", __FUNCTION__ );
|
||||
return VCM_ERROR;
|
||||
}
|
||||
nsresult rv = pc.impl()->media()->ice_ctx()->thread()->Dispatch(
|
||||
WrapRunnableRet(pc.impl()->media()->ice_ctx(), &NrIceCtx::StartChecks, &res),
|
||||
NS_DISPATCH_SYNC);
|
||||
@ -759,12 +765,10 @@ static short vcmStartIceChecks_m(const char *peerconnection)
|
||||
CSFLogError( logTag, "%s(): Could not dispatch to ICE thread", __FUNCTION__);
|
||||
return VCM_ERROR;
|
||||
}
|
||||
|
||||
if (!NS_SUCCEEDED(res)) {
|
||||
CSFLogError( logTag, "%s: couldn't start ICE checks", __FUNCTION__ );
|
||||
return VCM_ERROR;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -776,13 +780,14 @@ static short vcmStartIceChecks_m(const char *peerconnection)
|
||||
* @param[in] peerconnection - the peerconnection in use
|
||||
* @return 0 success, error failure
|
||||
*/
|
||||
short vcmStartIceChecks(const char *peerconnection)
|
||||
short vcmStartIceChecks(const char *peerconnection, cc_boolean isControlling)
|
||||
{
|
||||
short ret;
|
||||
|
||||
VcmSIPCCBinding::getMainThread()->Dispatch(
|
||||
WrapRunnableNMRet(&vcmStartIceChecks_m,
|
||||
peerconnection,
|
||||
isControlling,
|
||||
&ret),
|
||||
NS_DISPATCH_SYNC);
|
||||
|
||||
|
@ -2888,8 +2888,9 @@ fsmdef_ev_createoffer (sm_event_t *event) {
|
||||
FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
|
||||
return SM_RC_CLEANUP;
|
||||
}
|
||||
dcb->inbound = FALSE;
|
||||
|
||||
if (msg->data.session.has_constraints) {
|
||||
if (msg->data.session.has_constraints) {
|
||||
sess_data_p = (session_data_t *)findhash(msg->data.session.sessionid);
|
||||
if (sess_data_p) {
|
||||
gsmsdp_process_cap_constraints(dcb, sess_data_p->cc_constraints);
|
||||
@ -2994,6 +2995,7 @@ fsmdef_ev_createanswer (sm_event_t *event) {
|
||||
FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
|
||||
return SM_RC_CLEANUP;
|
||||
}
|
||||
dcb->inbound = TRUE;
|
||||
|
||||
if (msg->data.session.has_constraints) {
|
||||
sess_data_p = (session_data_t *)findhash(msg->data.session.sessionid);
|
||||
|
@ -3996,7 +3996,8 @@ lsm_connected (lsm_lcb_t *lcb, cc_state_data_connected_t *data)
|
||||
|
||||
/* Start ICE */
|
||||
if (start_ice) {
|
||||
short res = vcmStartIceChecks(dcb->peerconnection);
|
||||
short res = vcmStartIceChecks(dcb->peerconnection, !dcb->inbound);
|
||||
|
||||
/* TODO(emannion): Set state to dead here. */
|
||||
if (res)
|
||||
return CC_RC_SUCCESS;
|
||||
|
@ -474,10 +474,10 @@ short vcmSetIceMediaParams(const char *peerconnection, int level, char *ufrag, c
|
||||
|
||||
/* Start ICE checks
|
||||
* @param[in] peerconnection - the peerconnection in use
|
||||
* @param[in] level - the m-line
|
||||
* @param[in] isControlling - true if controlling, false if controlled
|
||||
* @return 0 success, error failure
|
||||
*/
|
||||
short vcmStartIceChecks(const char *peerconnection);
|
||||
short vcmStartIceChecks(const char *peerconnection, cc_boolean isControlling);
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user