This commit is contained in:
Anton Olofsson 2025-01-21 00:17:21 +00:00 committed by GitHub
commit 7085a15ca4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 3 deletions

View File

@ -975,13 +975,20 @@ typedef enum {
*/
RTP_BUG_ALWAYS_AUTO_ADJUST = (1 << 12)
RTP_BUG_ALWAYS_AUTO_ADJUST = (1 << 12),
/*
Leave the auto-adjust behavior enableed permenantly rather than only at appropriate times. (IMPLICITLY sets RTP_BUG_ACCEPT_ANY_PACKETS)
*/
RTP_BUG_CHANGE_SSRC_ON_MARKER_ALSO_WHEN_SECURE = (1 << 13),
/*
Allow SSRC change when using SRTP.
*/
} switch_rtp_bug_flag_t;
#ifdef _MSC_VER

View File

@ -1010,6 +1010,14 @@ SWITCH_DECLARE(void) switch_core_media_parse_rtp_bugs(switch_rtp_bug_flag_t *fla
*flag_pole &= ~RTP_BUG_CHANGE_SSRC_ON_MARKER;
}
if (switch_stristr("CHANGE_SSRC_ON_MARKER_ALSO_WHEN_SECURE", str)) {
*flag_pole |= RTP_BUG_CHANGE_SSRC_ON_MARKER_ALSO_WHEN_SECURE;
}
if (switch_stristr("~CHANGE_SSRC_ON_MARKER_ALSO_WHEN_SECURE", str)) {
*flag_pole &= ~RTP_BUG_CHANGE_SSRC_ON_MARKER_ALSO_WHEN_SECURE;
}
if (switch_stristr("FLUSH_JB_ON_DTMF", str)) {
*flag_pole |= RTP_BUG_FLUSH_JB_ON_DTMF;
}

View File

@ -8218,7 +8218,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
int delta = rtp_session->ts - rtp_session->last_write_ts;
if (!rtp_session->flags[SWITCH_RTP_FLAG_UDPTL] &&
((!rtp_session->flags[SWITCH_RTP_FLAG_RESET] && (abs(delta) > rtp_session->samples_per_interval * 10))
((rtp_session->flags[SWITCH_RTP_FLAG_RESET] && (abs(delta) > rtp_session->samples_per_interval * 10))
|| rtp_session->ts == rtp_session->samples_per_interval)) {
m++;
}
@ -8254,7 +8254,8 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
}
/* If the marker was set, and the timestamp seems to have started over - set a new SSRC, to indicate this is a new stream */
if (m && !switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND) && (rtp_session->rtp_bugs & RTP_BUG_CHANGE_SSRC_ON_MARKER) &&
if (m && (rtp_session->rtp_bugs & RTP_BUG_CHANGE_SSRC_ON_MARKER) &&
(!switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND) || rtp_session->rtp_bugs & RTP_BUG_CHANGE_SSRC_ON_MARKER_ALSO_WHEN_SECURE) &&
(rtp_session->flags[SWITCH_RTP_FLAG_RESET] || (rtp_session->ts <= rtp_session->last_write_ts && rtp_session->last_write_ts > 0))) {
switch_rtp_set_ssrc(rtp_session, (uint32_t) ((intptr_t) rtp_session + (switch_time_t) switch_epoch_time_now(NULL)));
}