mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1149298 - Part 3: Fire end of candidates signal when StartGathering has nothing to do, and only call StartGathering once per offer/answer. r=drno
This commit is contained in:
parent
010c73039c
commit
f9a911e015
@ -677,19 +677,21 @@ abort:
|
||||
|
||||
nsresult NrIceCtx::StartGathering() {
|
||||
ASSERT_ON_THREAD(sts_target_);
|
||||
SetGatheringState(ICE_CTX_GATHER_STARTED);
|
||||
// This might start gathering for the first time, or again after
|
||||
// renegotiation, or might do nothing at all if gathering has already
|
||||
// finished.
|
||||
int r = nr_ice_gather(ctx_, &NrIceCtx::gather_cb, this);
|
||||
|
||||
if (r && (r != R_WOULDBLOCK)) {
|
||||
if (!r) {
|
||||
SetGatheringState(ICE_CTX_GATHER_COMPLETE);
|
||||
} else if (r != R_WOULDBLOCK) {
|
||||
MOZ_MTLOG(ML_ERROR, "Couldn't gather ICE candidates for '"
|
||||
<< name_ << "', error=" << r);
|
||||
SetConnectionState(ICE_CTX_FAILED);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
SetGatheringState(ICE_CTX_GATHER_STARTED);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2419,11 +2419,16 @@ PeerConnectionImpl::SetSignalingState_m(PCImplSignalingState aSignalingState)
|
||||
return;
|
||||
}
|
||||
|
||||
bool restartGathering =
|
||||
aSignalingState == PCImplSignalingState::SignalingHaveLocalOffer ||
|
||||
(aSignalingState == PCImplSignalingState::SignalingStable &&
|
||||
mSignalingState == PCImplSignalingState::SignalingHaveRemoteOffer);
|
||||
|
||||
mSignalingState = aSignalingState;
|
||||
|
||||
if (mSignalingState == PCImplSignalingState::SignalingHaveLocalOffer ||
|
||||
mSignalingState == PCImplSignalingState::SignalingStable) {
|
||||
mMedia->UpdateTransports(*mJsepSession);
|
||||
mMedia->UpdateTransports(*mJsepSession, restartGathering);
|
||||
}
|
||||
|
||||
bool fireNegotiationNeeded = false;
|
||||
|
@ -328,7 +328,8 @@ nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_serv
|
||||
}
|
||||
|
||||
void
|
||||
PeerConnectionMedia::UpdateTransports(const JsepSession& session) {
|
||||
PeerConnectionMedia::UpdateTransports(const JsepSession& session,
|
||||
bool restartGathering) {
|
||||
|
||||
auto transports = session.GetTransports();
|
||||
for (size_t i = 0; i < transports.size(); ++i) {
|
||||
@ -361,8 +362,9 @@ PeerConnectionMedia::UpdateTransports(const JsepSession& session) {
|
||||
NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
|
||||
GatherIfReady();
|
||||
if (restartGathering) {
|
||||
GatherIfReady();
|
||||
}
|
||||
}
|
||||
|
||||
nsresult PeerConnectionMedia::UpdateMediaPipelines(
|
||||
|
@ -244,7 +244,7 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
|
||||
}
|
||||
|
||||
// Create and modify transports in response to negotiation events.
|
||||
void UpdateTransports(const JsepSession& session);
|
||||
void UpdateTransports(const JsepSession& session, bool restartGathering);
|
||||
|
||||
// Start ICE checks.
|
||||
void StartIceChecks(const JsepSession& session);
|
||||
|
Loading…
Reference in New Issue
Block a user