Bug 1678484: Start the grace period timer before pairing a candidate, just in case that candidate fails immediately. r=drno

Differential Revision: https://phabricator.services.mozilla.com/D97701
This commit is contained in:
Byron Campen [:bwc] 2020-12-01 22:51:41 +00:00
Родитель 870dc9cda3
Коммит dd46ef8cfe
1 изменённых файлов: 14 добавлений и 17 удалений

Просмотреть файл

@ -311,17 +311,17 @@ int nr_ice_peer_ctx_parse_trickle_candidate(nr_ice_peer_ctx *pctx, nr_ice_media_
just re-pair the stream which is inefficient but still
fine because we suppress duplicate pairing */
if (needs_pairing) {
if(r=nr_ice_media_stream_pair_candidates(pctx, stream, pstream)) {
r_log(LOG_ICE,LOG_ERR,"ICE(%s): peer (%s), stream(%s) failed to pair trickle ICE candidates",pctx->ctx->label,pctx->label,stream->label);
ABORT(r);
}
/* Start the remote trickle grace timeout if it hasn't been started by
another trickled candidate or from the SDP. */
if (!pctx->trickle_grace_period_timer) {
nr_ice_peer_ctx_start_trickle_timer(pctx);
}
if(r=nr_ice_media_stream_pair_candidates(pctx, stream, pstream)) {
r_log(LOG_ICE,LOG_ERR,"ICE(%s): peer (%s), stream(%s) failed to pair trickle ICE candidates",pctx->ctx->label,pctx->label,stream->label);
ABORT(r);
}
/* Start checks if this stream is not checking yet or if it has checked
all the available candidates but not had a completed check for all
components.
@ -438,15 +438,15 @@ int nr_ice_peer_ctx_pair_new_trickle_candidate(nr_ice_ctx *ctx, nr_ice_peer_ctx
if ((r = nr_ice_peer_ctx_find_pstream(pctx, cand->stream, &pstream)))
ABORT(r);
if ((r = nr_ice_media_stream_pair_new_trickle_candidate(pctx, pstream, cand)))
ABORT(r);
/* Start the remote trickle grace timeout if it hasn't been started
already. */
if (!pctx->trickle_grace_period_timer) {
nr_ice_peer_ctx_start_trickle_timer(pctx);
}
if ((r = nr_ice_media_stream_pair_new_trickle_candidate(pctx, pstream, cand)))
ABORT(r);
_status=0;
abort:
return _status;
@ -539,11 +539,9 @@ int nr_ice_peer_ctx_start_checks2(nr_ice_peer_ctx *pctx, int allow_non_first)
nr_ice_media_stream *stream;
int started = 0;
/* Ensure that any existing grace period timers are cancelled */
if(pctx->trickle_grace_period_timer) {
NR_async_timer_cancel(pctx->trickle_grace_period_timer);
pctx->trickle_grace_period_timer=0;
}
/* Ensure that grace period timer is running. We might cancel this if we
* didn't actually start any pairs. */
nr_ice_peer_ctx_start_trickle_timer(pctx);
/* Might have added some streams */
pctx->reported_connected = 0;
@ -622,12 +620,11 @@ int nr_ice_peer_ctx_start_checks2(nr_ice_peer_ctx *pctx, int allow_non_first)
if (!started) {
r_log(LOG_ICE,LOG_NOTICE,"ICE(%s): peer (%s) no checks to start",pctx->ctx->label,pctx->label);
/* Never mind on the grace period timer */
NR_async_timer_cancel(pctx->trickle_grace_period_timer);
pctx->trickle_grace_period_timer=0;
ABORT(R_NOT_FOUND);
}
else {
/* Start grace period timer for more remote trickle candidates. */
nr_ice_peer_ctx_start_trickle_timer(pctx);
}
_status=0;
abort: