Bug 1335966: skip refreshing ICE cosent for streams with no consent context. r?bwc
MozReview-Commit-ID: 91aZIMdGBAQ
--- a/media/mtransport/third_party/nICEr/src/ice/ice_component.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_component.c
@@ -1354,16 +1354,20 @@ void nr_ice_component_consent_calc_conse
comp->consent_ctx->maximum_transmits_timeout_ms = tval;
}
static void nr_ice_component_consent_timer_cb(NR_SOCKET s, int how, void *cb_arg)
{
nr_ice_component *comp=cb_arg;
int r;
+ if (!comp->consent_ctx) {
+ return;
+ }
+
if (comp->consent_timer) {
NR_async_timer_cancel(comp->consent_timer);
}
comp->consent_timer = 0;
comp->consent_ctx->params.ice_binding_request.username =
comp->stream->l2r_user;
comp->consent_ctx->params.ice_binding_request.password =
--- a/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c
@@ -587,36 +587,31 @@ int nr_ice_media_stream_set_state(nr_ice
void nr_ice_media_stream_refresh_consent_all(nr_ice_media_stream *stream)
{
nr_ice_component *comp;
comp=STAILQ_FIRST(&stream->components);
while(comp){
- if((comp->state != NR_ICE_COMPONENT_DISABLED) &&
- (comp->local_component->state != NR_ICE_COMPONENT_DISABLED) &&
- comp->disconnected) {
+ if(comp->disconnected) {
nr_ice_component_refresh_consent_now(comp);
}
comp=STAILQ_NEXT(comp,entry);
}
}
void nr_ice_media_stream_disconnect_all_components(nr_ice_media_stream *stream)
{
nr_ice_component *comp;
comp=STAILQ_FIRST(&stream->components);
while(comp){
- if((comp->state != NR_ICE_COMPONENT_DISABLED) &&
- (comp->local_component->state != NR_ICE_COMPONENT_DISABLED)) {
- comp->disconnected = 1;
- }
+ comp->disconnected = 1;
comp=STAILQ_NEXT(comp,entry);
}
}
void nr_ice_media_stream_set_disconnected(nr_ice_media_stream *stream, int disconnected)
{
if (stream->disconnected == disconnected) {
@@ -726,16 +721,19 @@ int nr_ice_media_stream_component_failed
}
/* Cancel our timer */
if(stream->timer){
NR_async_timer_cancel(stream->timer);
stream->timer=0;
}
+ /* Cancel consent timers in case it is running already */
+ nr_ice_component_consent_destroy(component);
+
if (stream->pctx->handler) {
stream->pctx->handler->vtbl->stream_failed(stream->pctx->handler->obj,stream->local_stream);
}
/* Now tell the peer_ctx that we're connected */
if(r=nr_ice_peer_ctx_check_if_connected(stream->pctx))
ABORT(r);