mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-06 06:16:27 +00:00
Bug 1024028 - Part 2: Add an ice_checking callback that is fired when checking actually starts. r=drno
This commit is contained in:
parent
403559c7c9
commit
22545d9d7e
@ -318,6 +318,17 @@ int NrIceCtx::stream_failed(void *obj, nr_ice_media_stream *stream) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int NrIceCtx::ice_checking(void *obj, nr_ice_peer_ctx *pctx) {
|
||||
MOZ_MTLOG(ML_DEBUG, "ice_checking called");
|
||||
|
||||
// Get the ICE ctx
|
||||
NrIceCtx *ctx = static_cast<NrIceCtx *>(obj);
|
||||
|
||||
ctx->SetConnectionState(ICE_CTX_CHECKING);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int NrIceCtx::ice_completed(void *obj, nr_ice_peer_ctx *pctx) {
|
||||
MOZ_MTLOG(ML_DEBUG, "ice_completed called");
|
||||
|
||||
@ -467,6 +478,7 @@ RefPtr<NrIceCtx> NrIceCtx::Create(const std::string& name,
|
||||
ctx->ice_handler_vtbl_->stream_failed = &NrIceCtx::stream_failed;
|
||||
ctx->ice_handler_vtbl_->ice_completed = &NrIceCtx::ice_completed;
|
||||
ctx->ice_handler_vtbl_->msg_recvd = &NrIceCtx::msg_recvd;
|
||||
ctx->ice_handler_vtbl_->ice_checking = &NrIceCtx::ice_checking;
|
||||
|
||||
ctx->ice_handler_ = new nr_ice_handler();
|
||||
ctx->ice_handler_->vtbl = ctx->ice_handler_vtbl_;
|
||||
@ -689,8 +701,6 @@ nsresult NrIceCtx::StartChecks() {
|
||||
SetConnectionState(ICE_CTX_FAILED);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
} else {
|
||||
SetConnectionState(ICE_CTX_CHECKING);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -292,6 +292,7 @@ class NrIceCtx {
|
||||
int potential_ct);
|
||||
static int stream_ready(void *obj, nr_ice_media_stream *stream);
|
||||
static int stream_failed(void *obj, nr_ice_media_stream *stream);
|
||||
static int ice_checking(void *obj, nr_ice_peer_ctx *pctx);
|
||||
static int ice_completed(void *obj, nr_ice_peer_ctx *pctx);
|
||||
static int msg_recvd(void *obj, nr_ice_peer_ctx *pctx,
|
||||
nr_ice_media_stream *stream, int component_id,
|
||||
|
@ -66,6 +66,9 @@ int component_id, nr_ice_cand_pair **potentials,int potential_ct);
|
||||
|
||||
/* A message was delivered to us */
|
||||
int (*msg_recvd)(void *obj, nr_ice_peer_ctx *pctx, nr_ice_media_stream *stream, int component_id, UCHAR *msg, int len);
|
||||
|
||||
/* ICE has started checking. */
|
||||
int (*ice_checking)(void *obj, nr_ice_peer_ctx *pctx);
|
||||
} nr_ice_handler_vtbl;
|
||||
|
||||
typedef struct nr_ice_handler_ {
|
||||
|
@ -410,6 +410,8 @@ int nr_ice_media_stream_start_checks(nr_ice_peer_ctx *pctx, nr_ice_media_stream
|
||||
nr_ice_media_stream_check_timer_cb(0,0,stream);
|
||||
}
|
||||
|
||||
nr_ice_peer_ctx_stream_started_checks(pctx, stream);
|
||||
|
||||
_status=0;
|
||||
abort:
|
||||
return(_status);
|
||||
|
@ -571,6 +571,17 @@ int nr_ice_peer_ctx_start_checks2(nr_ice_peer_ctx *pctx, int allow_non_first)
|
||||
return(_status);
|
||||
}
|
||||
|
||||
void nr_ice_peer_ctx_stream_started_checks(nr_ice_peer_ctx *pctx, nr_ice_media_stream *stream)
|
||||
{
|
||||
if (!pctx->checks_started) {
|
||||
r_log(LOG_ICE,LOG_NOTICE,"ICE(%s): peer (%s) is now checking",pctx->ctx->label,pctx->label);
|
||||
pctx->checks_started = 1;
|
||||
if (pctx->handler && pctx->handler->vtbl->ice_checking) {
|
||||
pctx->handler->vtbl->ice_checking(pctx->handler->obj, pctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
int nr_ice_peer_ctx_dump_state(nr_ice_peer_ctx *pctx,FILE *out)
|
||||
{
|
||||
|
@ -60,6 +60,7 @@ struct nr_ice_peer_ctx_ {
|
||||
nr_ice_media_stream_head peer_streams;
|
||||
int active_streams;
|
||||
int waiting_pairs;
|
||||
UCHAR checks_started;
|
||||
|
||||
void *done_cb_timer;
|
||||
UCHAR reported_done;
|
||||
@ -80,6 +81,7 @@ int nr_ice_peer_ctx_pair_candidates(nr_ice_peer_ctx *pctx);
|
||||
int nr_ice_peer_ctx_parse_global_attributes(nr_ice_peer_ctx *pctx, char **attrs, int attr_ct);
|
||||
int nr_ice_peer_ctx_start_checks(nr_ice_peer_ctx *pctx);
|
||||
int nr_ice_peer_ctx_start_checks2(nr_ice_peer_ctx *pctx, int allow_non_first);
|
||||
void nr_ice_peer_ctx_stream_started_checks(nr_ice_peer_ctx *pctx, nr_ice_media_stream *stream);
|
||||
int nr_ice_peer_ctx_dump_state(nr_ice_peer_ctx *pctx,FILE *out);
|
||||
int nr_ice_peer_ctx_log_state(nr_ice_peer_ctx *pctx);
|
||||
int nr_ice_peer_ctx_stream_done(nr_ice_peer_ctx *pctx, nr_ice_media_stream *stream);
|
||||
|
Loading…
x
Reference in New Issue
Block a user