From 248652e47b651ebaf4b397cc3b8c1f893f9bfeb7 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 23 Oct 2026 07:19:05 -0400 Subject: [PATCH] MT#55283 fix int/uint mixup Change-Id: Ie58964c6855f7a8416ffbe46fc4e37c9ac49099f (cherry picked from commit 920c923457d85621e5b7d381402a9c24b38ee617) (cherry picked from commit 1d971b5a8849e4ab827de646090f61e077028c5c) --- daemon/call.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 3af85d40a..199d57765 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -125,7 +125,6 @@ static void call_timer_iterator(call_t *c, struct iterator_helper *hlp) { bool recv_checked = false; int tmp_t_reason = UNKNOWN; enum call_stream_state css; - int64_t timestamp; hlp->count++; @@ -170,7 +169,8 @@ static void call_timer_iterator(call_t *c, struct iterator_helper *hlp) { ice_fragments_cleanup(c->sdp_fragments, false); IQUEUE_FOREACH(&c->streams, ps) { - timestamp = packet_stream_last_packet(ps); + int64_t last_packet = packet_stream_last_packet(ps); + int64_t timestamp = last_packet; if (!ps->media) continue; @@ -193,19 +193,22 @@ static void call_timer_iterator(call_t *c, struct iterator_helper *hlp) { if (css == CSS_ICE) timestamp = atomic64_get_na(&ps->media->ice_agent->last_activity); + int64_t last_kernel_packet = atomic64_get_na(&ps->stats_in->last_packet_us); + int64_t last_user_packet = atomic64_get_na(&ps->last_packet_us); + if (PS_ISSET(ps, RTP)) { - if (rtpe_now - atomic64_get_na(&ps->stats_in->last_packet_us) < 2000000LL) { + if (rtpe_now - last_kernel_packet < 2000000LL) { // kernel activity - if (rtpe_now - atomic64_get_na(&ps->last_packet_us) < 2000000LL) + if (rtpe_now - last_user_packet < 2000000LL) hlp->user_kernel_streams++; // user activity else hlp->kernel_streams++; } - else if (rtpe_now - atomic64_get_na(&ps->last_packet_us) < 2000000LL) + else if (rtpe_now - last_user_packet < 2000000LL) hlp->user_streams++; // user activity } - bool active_media = (rtpe_now - packet_stream_last_packet(ps) < 1000000LL); + bool active_media = (rtpe_now - last_packet < 1000000LL); if (active_media) CALL_CLEAR(sfd->call, FOREIGN_MEDIA); @@ -247,7 +250,7 @@ no_sfd: for (__auto_type l = media->ssrc_hash_in.nq.head; l; l = l->next) { struct ssrc_entry_call *ctx = l->data; - if (rtpe_now - atomic64_get_na(&ctx->stats->last_packet_us) < 2000000L) + if (rtpe_now - (int64_t) atomic64_get_na(&ctx->stats->last_packet_us) < 2000000L) payload_tracker_add(&ctx->tracker, atomic_get_na(&ctx->stats->last_pt)); } @@ -255,7 +258,7 @@ no_sfd: for (__auto_type l = media->ssrc_hash_out.nq.head; l; l = l->next) { struct ssrc_entry_call *ctx = l->data; - if (rtpe_now - atomic64_get_na(&ctx->stats->last_packet_us) < 2000000L) + if (rtpe_now - (int64_t )atomic64_get_na(&ctx->stats->last_packet_us) < 2000000L) payload_tracker_add(&ctx->tracker, atomic_get_na(&ctx->stats->last_pt)); } @@ -266,7 +269,7 @@ no_sfd: goto out; // update every 5 minutes - if (has_srtp && rtpe_now - atomic64_get_na(&c->last_redis_update_us) > 60*5*1000000LL) + if (has_srtp && rtpe_now - (int64_t) atomic64_get_na(&c->last_redis_update_us) > 60*5*1000000LL) do_update = true; goto out;