From f2985e310663b67ccc948515efeae500bdf94a0c Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Sat, 16 Sep 2017 11:19:59 -0300 Subject: bridge: Change participant SFU streams when source streams change. Some endpoints do not like a stream being reused for a new media stream. The frame/jitterbuffer can rely on underlying attributes of the media stream in order to order the packets. When a new stream takes its place without any notice the buffer can get confused and the media ends up getting dropped. This change uses the SSRC change to determine that a new source is reusing an existing stream and then bridge_softmix renegotiates each participant such that they see a new media stream. This causes the frame/jitterbuffer to start fresh and work as expected. ASTERISK-27277 Change-Id: I30ccbdba16ca073d7f31e0e59ab778c153afae07 --- res/res_pjsip_sdp_rtp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'res/res_pjsip_sdp_rtp.c') diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c index e095f0660..88b94ee43 100644 --- a/res/res_pjsip_sdp_rtp.c +++ b/res/res_pjsip_sdp_rtp.c @@ -1022,6 +1022,19 @@ static void process_ssrc_attributes(struct ast_sip_session *session, struct ast_ continue; } + /* If we are currently negotiating as a result of the remote side renegotiating then + * determine if the source for this stream has changed. + */ + if (pjmedia_sdp_neg_get_state(session->inv_session->neg) == PJMEDIA_SDP_NEG_STATE_REMOTE_OFFER && + session->active_media_state) { + struct ast_rtp_instance_stats stats = { 0, }; + + if (!ast_rtp_instance_get_stats(session_media->rtp, &stats, AST_RTP_INSTANCE_STAT_REMOTE_SSRC) && + stats.remote_ssrc != ssrc) { + session_media->changed = 1; + } + } + ast_rtp_instance_set_remote_ssrc(session_media->rtp, ssrc); } } -- cgit v1.2.3