From 78ad6c2b4e4c77ccfe9c89e062f60bf1270e9af9 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 2 May 2025 07:23:25 -0400 Subject: [PATCH] MT#62735 fix heuristic learning mode Change-Id: I2bfd09eefaf6a13f1c7435efa2e07c9ccecfa964 (cherry picked from commit 9068638a4d3db659f049249c6a8cc28c23d32b2e) (cherry picked from commit df4dcb0193a3d833e202163b5bc8c24f751bdf34) --- daemon/media_socket.c | 5 +++-- include/call.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 7a0388262..9abc39bd2 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -2522,9 +2522,10 @@ static bool media_packet_address_check(struct packet_handler_ctx *phc) && phc->mp.stream->advertised_endpoint.port) { // check if we need to reset our learned endpoints - if (memcmp(&rtpe_now, &phc->mp.stream->ep_detect_signal, sizeof(rtpe_now))) { + + if ((phc->mp.call->last_signal - phc->mp.stream->ep_detect_signal) != 0) { memset(&phc->mp.stream->detected_endpoints, 0, sizeof(phc->mp.stream->detected_endpoints)); - phc->mp.stream->ep_detect_signal = rtpe_now; + phc->mp.stream->ep_detect_signal = phc->mp.call->last_signal; } // possible endpoints that can be detected in order of preference: diff --git a/include/call.h b/include/call.h index 3f4afe6a1..72d979128 100644 --- a/include/call.h +++ b/include/call.h @@ -435,7 +435,7 @@ struct packet_stream { sink_handler_q rtp_mirrors; /* LOCK: call->master_lock, in_lock for streamhandler */ struct endpoint endpoint; /* LOCK: out_lock */ struct endpoint detected_endpoints[4]; /* LOCK: out_lock */ - struct timeval ep_detect_signal; /* LOCK: out_lock */ + time_t ep_detect_signal; /* LOCK: out_lock */ struct endpoint advertised_endpoint; /* RO */ struct endpoint learned_endpoint; /* LOCK: out_lock */ struct crypto_context crypto; /* OUT direction, LOCK: out_lock */