res/res_rtp_asterisk: ensure marker bit is correctly set on ssrc change

Certain race conditions between changing bridge types and DTMF can
cause the current FLAG_NEED_MARKER_BIT to send the marker bit before
the actual first packet of native bridging.

This logic keeps track of the ssrc the bridge is currently sending
and will correctly ensure the marker bit is set if SSRC as changed
from the previous sent packet.

ASTERISK-27845

Change-Id: I01858bd0235f1e5e629e20de71b422b16f55759b
16.0
Torrey Searle 7 years ago committed by Richard Mudgett
parent 25764691b0
commit c5d2bf05f4

@ -249,6 +249,7 @@ static AST_RWLIST_HEAD_STATIC(host_candidates, ast_ice_host_candidate);
#define FLAG_NAT_INACTIVE_NOWARN (1 << 1)
#define FLAG_NEED_MARKER_BIT (1 << 3)
#define FLAG_DTMF_COMPENSATE (1 << 4)
#define FLAG_REQ_LOCAL_BRIDGE_BIT (1 << 5)
#define TRANSPORT_SOCKET_RTP 0
#define TRANSPORT_SOCKET_RTCP 1
@ -5984,6 +5985,12 @@ static int bridge_p2p_rtp_write(struct ast_rtp_instance *instance,
ast_clear_flag(bridged, FLAG_NEED_MARKER_BIT);
}
/* Set the marker bit for the first local bridged packet which has the first bridged peer's SSRC. */
if (ast_test_flag(bridged, FLAG_REQ_LOCAL_BRIDGE_BIT)) {
mark = 1;
ast_clear_flag(bridged, FLAG_REQ_LOCAL_BRIDGE_BIT);
}
/* Reconstruct part of the packet */
reconstruct &= 0xFF80FFFF;
reconstruct |= (bridged_payload << 16);
@ -6905,7 +6912,7 @@ static int ast_rtp_local_bridge(struct ast_rtp_instance *instance0, struct ast_r
struct ast_rtp *rtp = ast_rtp_instance_get_data(instance0);
ao2_lock(instance0);
ast_set_flag(rtp, FLAG_NEED_MARKER_BIT);
ast_set_flag(rtp, FLAG_NEED_MARKER_BIT | FLAG_REQ_LOCAL_BRIDGE_BIT);
ao2_unlock(instance0);
return 0;

Loading…
Cancel
Save