summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2017-09-21 15:56:47 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-09-21 15:56:47 -0500
commitf77a2367e743ba8f9e48ab4541673295cfb81411 (patch)
tree68e0ecb1dc02081afbde9550dc0b11b17b42d2c0 /res
parentb9f7b03c0be181023d97b817fa8217a65d0cbcfa (diff)
parentf2985e310663b67ccc948515efeae500bdf94a0c (diff)
Merge "bridge: Change participant SFU streams when source streams change."
Diffstat (limited to 'res')
-rw-r--r--res/res_pjsip_sdp_rtp.c13
-rw-r--r--res/res_pjsip_session.c12
2 files changed, 24 insertions, 1 deletions
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 8ec57aa8e..20a219e7e 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);
}
}
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 77ddfbc14..163c2b868 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -765,6 +765,7 @@ static int handle_negotiated_sdp(struct ast_sip_session *session, const pjmedia_
{
int i;
struct ast_stream_topology *topology;
+ unsigned int changed = 0;
for (i = 0; i < local->media_count; ++i) {
struct ast_sip_session_media *session_media;
@@ -802,6 +803,9 @@ static int handle_negotiated_sdp(struct ast_sip_session *session, const pjmedia_
if (handle_negotiated_sdp_session_media(session_media, session, local, remote, i, stream)) {
return -1;
}
+
+ changed |= session_media->changed;
+ session_media->changed = 0;
}
/* Apply the pending media state to the channel and make it active */
@@ -858,7 +862,13 @@ static int handle_negotiated_sdp(struct ast_sip_session *session, const pjmedia_
ast_channel_unlock(session->channel);
- ast_queue_frame(session->channel, &ast_null_frame);
+ if (changed) {
+ struct ast_frame f = { AST_FRAME_CONTROL, .subclass.integer = AST_CONTROL_STREAM_TOPOLOGY_SOURCE_CHANGED };
+
+ ast_queue_frame(session->channel, &f);
+ } else {
+ ast_queue_frame(session->channel, &ast_null_frame);
+ }
return 0;
}