Browse Source

TT#86102 remove aggressive endpoint learning heuristics

The previous approach causes problems during re-invites with updated
port (or address) information. The UA might delay actually using the new
endpoint until after the answer is seen, in which case rtpengine would
erroneously immediately latch on to the old endpoint. We need to
reinstate the endpoint learning delay in all cases, and make sure
previously learned endpoints are forgotten whenever a new signal is
seen.

Change-Id: If42ed13c43710616c02cdf018b36a4543d7f6bfe
changes/16/41716/2
Richard Fuchs 5 years ago
parent
commit
112e57f9fe
2 changed files with 8 additions and 4 deletions
  1. +7
    -4
      daemon/media_socket.c
  2. +1
    -0
      include/call.h

+ 7
- 4
daemon/media_socket.c View File

@ -1646,6 +1646,12 @@ static int media_packet_address_check(struct packet_handler_ctx *phc)
&& phc->mp.stream->advertised_endpoint.address.family
&& 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))) {
memset(&phc->mp.stream->detected_endpoints, 0, sizeof(phc->mp.stream->detected_endpoints));
phc->mp.stream->ep_detect_signal = rtpe_now;
}
// possible endpoints that can be detected in order of preference:
// 0: endpoint that matches the address advertised in the SDP
// 1: endpoint with the same address but different port
@ -1664,11 +1670,8 @@ static int media_packet_address_check(struct packet_handler_ctx *phc)
// now grab the best matched endpoint
for (idx = 0; idx < 4; idx++) {
use_endpoint_confirm = &phc->mp.stream->detected_endpoints[idx];
if (use_endpoint_confirm->address.family) {
if (idx == 0) // doesn't get any better than this
goto confirm_now;
if (use_endpoint_confirm->address.family)
break;
}
}
}


+ 1
- 0
include/call.h View File

@ -266,6 +266,7 @@ struct packet_stream {
const struct streamhandler *handler; /* LOCK: in_lock */
struct endpoint endpoint; /* LOCK: out_lock */
struct endpoint detected_endpoints[4]; /* LOCK: out_lock */
struct timeval ep_detect_signal; /* LOCK: out_lock */
struct endpoint advertised_endpoint; /* RO */
struct crypto_context crypto; /* OUT direction, LOCK: out_lock */
struct ssrc_ctx *ssrc_in, /* LOCK: in_lock */ // XXX eliminate these


Loading…
Cancel
Save