зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1535442 - Part 3: Fire per-transport end-of-candidates signals, with ufrag. r=mjf
Differential Revision: https://phabricator.services.mozilla.com/D24277 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
ae9ec57f6a
Коммит
b1a7a65902
|
@ -427,6 +427,11 @@ void NrIceCtx::trickle_cb(void *arg, nr_ice_ctx *ice_ctx,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!candidate) {
|
||||
s->SignalCandidate(s, "", stream->ufrag);
|
||||
return;
|
||||
}
|
||||
|
||||
// Format the candidate.
|
||||
char candidate_str[NR_ICE_MAX_ATTRIBUTE_SIZE];
|
||||
int r = nr_ice_format_candidate_attribute(candidate, candidate_str,
|
||||
|
|
|
@ -707,6 +707,20 @@ void nr_ice_component_stop_gathering(nr_ice_component *component)
|
|||
}
|
||||
}
|
||||
|
||||
int nr_ice_component_is_done_gathering(nr_ice_component *comp)
|
||||
{
|
||||
nr_ice_candidate *cand=TAILQ_FIRST(&comp->candidates);
|
||||
while(cand){
|
||||
if(cand->state != NR_ICE_CAND_STATE_INITIALIZED &&
|
||||
cand->state != NR_ICE_CAND_STATE_FAILED){
|
||||
return 0;
|
||||
}
|
||||
cand=TAILQ_NEXT(cand,entry_comp);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int nr_ice_any_peer_paired(nr_ice_candidate* cand) {
|
||||
nr_ice_peer_ctx* pctx=STAILQ_FIRST(&cand->ctx->peers);
|
||||
while(pctx && pctx->state == NR_ICE_PEER_STATE_UNPAIRED){
|
||||
|
|
|
@ -87,6 +87,7 @@ int nr_ice_component_create(struct nr_ice_media_stream_ *stream, int component_i
|
|||
int nr_ice_component_destroy(nr_ice_component **componentp);
|
||||
int nr_ice_component_initialize(struct nr_ice_ctx_ *ctx,nr_ice_component *component);
|
||||
void nr_ice_component_stop_gathering(nr_ice_component *component);
|
||||
int nr_ice_component_is_done_gathering(nr_ice_component *comp);
|
||||
int nr_ice_component_maybe_prune_candidate(nr_ice_ctx *ctx, nr_ice_component *comp, nr_ice_candidate *c1, int *was_pruned);
|
||||
int nr_ice_component_pair_candidate(nr_ice_peer_ctx *pctx, nr_ice_component *pcomp, nr_ice_candidate *lcand, int pair_all_remote);
|
||||
int nr_ice_component_pair_candidates(nr_ice_peer_ctx *pctx, nr_ice_component *lcomp, nr_ice_component *pcomp);
|
||||
|
|
|
@ -511,12 +511,16 @@ void nr_ice_gather_finished_cb(NR_SOCKET s, int h, void *cb_arg)
|
|||
int r;
|
||||
nr_ice_candidate *cand=cb_arg;
|
||||
nr_ice_ctx *ctx;
|
||||
nr_ice_media_stream *stream;
|
||||
int component_id;
|
||||
|
||||
|
||||
assert(cb_arg);
|
||||
if (!cb_arg)
|
||||
return;
|
||||
ctx = cand->ctx;
|
||||
stream = cand->stream;
|
||||
component_id = cand->component_id;
|
||||
|
||||
ctx->uninitialized_candidates--;
|
||||
if (cand->state == NR_ICE_CAND_STATE_FAILED) {
|
||||
|
@ -540,9 +544,13 @@ void nr_ice_gather_finished_cb(NR_SOCKET s, int h, void *cb_arg)
|
|||
r_log(LOG_ICE, LOG_NOTICE, "ICE(%s): Problem pruning candidates",ctx->label);
|
||||
}
|
||||
|
||||
if (was_pruned) {
|
||||
cand = NULL;
|
||||
}
|
||||
|
||||
/* If we are initialized, the candidate wasn't pruned,
|
||||
and we have a trickle ICE callback fire the callback */
|
||||
if (ctx->trickle_cb && !was_pruned &&
|
||||
if (ctx->trickle_cb && cand &&
|
||||
!nr_ice_ctx_hide_candidate(ctx, cand)) {
|
||||
ctx->trickle_cb(ctx->trickle_cb_arg, ctx, cand->stream, cand->component_id, cand);
|
||||
|
||||
|
@ -551,6 +559,11 @@ void nr_ice_gather_finished_cb(NR_SOCKET s, int h, void *cb_arg)
|
|||
/* But continue */
|
||||
}
|
||||
}
|
||||
|
||||
if (nr_ice_media_stream_is_done_gathering(stream) &&
|
||||
ctx->trickle_cb) {
|
||||
ctx->trickle_cb(ctx->trickle_cb_arg, ctx, stream, component_id, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if(ctx->uninitialized_candidates==0){
|
||||
|
|
|
@ -656,6 +656,19 @@ void nr_ice_media_stream_set_obsolete(nr_ice_media_stream *str)
|
|||
nr_ice_media_stream_stop_checking(str);
|
||||
}
|
||||
|
||||
int nr_ice_media_stream_is_done_gathering(nr_ice_media_stream *str)
|
||||
{
|
||||
nr_ice_component *comp;
|
||||
comp=STAILQ_FIRST(&str->components);
|
||||
while(comp){
|
||||
if(!nr_ice_component_is_done_gathering(comp)) {
|
||||
return 0;
|
||||
}
|
||||
comp=STAILQ_NEXT(comp,entry);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void nr_ice_media_stream_refresh_consent_all(nr_ice_media_stream *stream)
|
||||
{
|
||||
nr_ice_component *comp;
|
||||
|
|
|
@ -103,6 +103,7 @@ int nr_ice_media_stream_check_if_connected(nr_ice_media_stream *stream);
|
|||
int nr_ice_media_stream_set_state(nr_ice_media_stream *str, int state);
|
||||
void nr_ice_media_stream_stop_checking(nr_ice_media_stream *str);
|
||||
void nr_ice_media_stream_set_obsolete(nr_ice_media_stream *str);
|
||||
int nr_ice_media_stream_is_done_gathering(nr_ice_media_stream *str);
|
||||
int nr_ice_media_stream_get_best_candidate(nr_ice_media_stream *str, int component, nr_ice_candidate **candp);
|
||||
int nr_ice_media_stream_send(nr_ice_peer_ctx *pctx, nr_ice_media_stream *str, int component, UCHAR *data, int len);
|
||||
int nr_ice_media_stream_get_active(nr_ice_peer_ctx *pctx, nr_ice_media_stream *str, int component, nr_ice_candidate **local, nr_ice_candidate **remote);
|
||||
|
|
Загрузка…
Ссылка в новой задаче