From 8c3b485d47b90af0d2dd13fd6d2d286a6beb1f52 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 2 Sep 2022 12:09:23 -0400 Subject: [PATCH] TT#189900 fix SSRC tracking indexing Don't increase the index pointer before using it. This fixes slots 1 and 2 being filled before slot 0, which ends up filling slots 0 and 2 first (due to swapping with slot 0), leaving slot 1 empty. Change-Id: If34cf561fcb153edde6408252c3286c8c80991bc (cherry picked from commit 6d26df05809d8348d769746394bb420ec1ce5ba6) --- daemon/media_socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/media_socket.c b/daemon/media_socket.c index ae209a296..5b85c36fb 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -1684,9 +1684,9 @@ static bool __stream_ssrc_inout(struct packet_stream *ps, uint32_t ssrc, mutex_t int ctx_idx = __hunt_ssrc_ctx_idx(ssrc, list, 0); if (ctx_idx == -1) { // SSRC mismatch - get the new entry: + ctx_idx = *ctx_idx_p; // move to next slot - ctx_idx = (*ctx_idx_p + 1) % RTPE_NUM_SSRC_TRACKING; - *ctx_idx_p = ctx_idx; + *ctx_idx_p = (*ctx_idx_p + 1) % RTPE_NUM_SSRC_TRACKING; // eject old entry if present if (list[ctx_idx]) ssrc_ctx_put(&list[ctx_idx]);