MT#55283 fix SSRC stats tracking

Change-Id: I3578fc3a233a83f67818e8cdd3a545fc5069a18b
pull/1592/head
Richard Fuchs 3 years ago
parent af0db8f284
commit c81859f231

@ -704,8 +704,7 @@ void call_timer(void *ptr) {
ps->ssrc_in, 0);
if (!ctx)
continue;
atomic64_add(&ctx->octets, diff_bytes_in);
atomic64_add(&ctx->packets, diff_packets_in);
// TODO: add in SSRC stats similar to __stream_update_stats
atomic64_set(&ctx->last_seq, ke->target.decrypt.last_index[u]);
if (sfd->crypto.params.crypto_suite

@ -1510,8 +1510,8 @@ static void __stream_update_stats(struct packet_stream *ps, int have_in_lock) {
// check for the right SSRC association
if (!stats_info.ssrc[u]) // end of list
break;
struct ssrc_ctx *ssrc_ctx = __hunt_ssrc_ctx(ntohl(stats_info.ssrc[u]),
ps->ssrc_in, u);
uint32_t ssrc = ntohl(stats_info.ssrc[u]);
struct ssrc_ctx *ssrc_ctx = __hunt_ssrc_ctx(ssrc, ps->ssrc_in, u);
if (!ssrc_ctx)
continue;
struct ssrc_entry_call *parent = ssrc_ctx->parent;
@ -1531,17 +1531,25 @@ static void __stream_update_stats(struct packet_stream *ps, int have_in_lock) {
uint32_t ssrc_map_out = ssrc_ctx->ssrc_map_out;
// update opposite outgoing SSRC
if (mutex_trylock(&ps->out_lock))
continue; // will have to skip this
for (GList *l = ps->rtp_sinks.head; l; l = l->next) {
struct sink_handler *sh = l->data;
struct packet_stream *sink = sh->sink;
if (mutex_trylock(&sink->out_lock))
continue; // will have to skip this
ssrc_ctx = __hunt_ssrc_ctx(ssrc_map_out, ps->ssrc_out, u);
ssrc_ctx = __hunt_ssrc_ctx(ssrc, sink->ssrc_out, u);
if (!ssrc_ctx)
ssrc_ctx = __hunt_ssrc_ctx(ssrc_map_out, sink->ssrc_out, u);
if (ssrc_ctx) {
parent = ssrc_ctx->parent;
atomic64_add(&ssrc_ctx->packets, stats_info.ssrc_stats[u].basic_stats.packets);
atomic64_add(&ssrc_ctx->octets, stats_info.ssrc_stats[u].basic_stats.bytes);
if (ssrc_ctx) {
parent = ssrc_ctx->parent;
atomic64_add(&ssrc_ctx->packets, stats_info.ssrc_stats[u].basic_stats.packets);
atomic64_add(&ssrc_ctx->octets, stats_info.ssrc_stats[u].basic_stats.bytes);
}
mutex_unlock(&sink->out_lock);
}
mutex_unlock(&ps->out_lock);
}
if (!have_in_lock)

Loading…
Cancel
Save