[asterisk-commits] res pjsip session: Check for removed stream state. (asterisk[15.0])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 21 13:04:28 CDT 2017
Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/6528 )
Change subject: res_pjsip_session: Check for removed stream state.
......................................................................
res_pjsip_session: Check for removed stream state.
When a sip session is refreshed, the stream topology is looped
through, checking each stream for compatible formats. This would
cause a crash if the stream state was AST_STREAM_STATE_REMOVED,
since the formats would never be set for this stream, causing
a NULL value to be returned from ast_stream_get_formats. This
commit adds a check for streams with removed states.
Also removed a stray semicolon.
Change-Id: Ic86f8b65a4a26a60885b28b8b1a0b22e1b471d42
---
M main/bridge.c
M res/res_pjsip_sdp_rtp.c
M res/res_pjsip_session.c
3 files changed, 8 insertions(+), 6 deletions(-)
Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved; Approved for Submit
diff --git a/main/bridge.c b/main/bridge.c
index b732d5f..051cec1 100644
--- a/main/bridge.c
+++ b/main/bridge.c
@@ -1741,7 +1741,7 @@
ao2_ref(bridge_channel, -1);
-join_exit:;
+join_exit:
ast_bridge_run_after_callback(chan);
bridge_channel_impart_signal(chan);
if (!(ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_ASYNCGOTO)
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 77cd807..4d0cf50 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -1337,7 +1337,7 @@
media->desc.port = 0;
media->desc.port_count = 1;
- if (remote) {
+ if (remote && remote->media[ast_stream_get_position(stream)]) {
pjmedia_sdp_media *remote_media = remote->media[ast_stream_get_position(stream)];
int index;
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index b6fa8bb..d34b1bb 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -1455,6 +1455,10 @@
continue;
}
+ /* No need to do anything with stream if it's media state is removed */
+ if (ast_stream_get_state(stream) == AST_STREAM_STATE_REMOVED) {
+ continue;
+ }
/* Enforce the configured allowed codecs on audio and video streams */
if (ast_stream_get_type(stream) == AST_MEDIA_TYPE_AUDIO || ast_stream_get_type(stream) == AST_MEDIA_TYPE_VIDEO) {
@@ -1465,14 +1469,12 @@
ast_sip_session_media_state_free(media_state);
return 0;
}
-
ast_format_cap_get_compatible(ast_stream_get_formats(stream), session->endpoint->media.codecs, joint_cap);
if (!ast_format_cap_count(joint_cap)) {
ao2_ref(joint_cap, -1);
- ast_sip_session_media_state_free(media_state);
- return 0;
+ ast_stream_set_state(stream, AST_STREAM_STATE_REMOVED);
+ continue;
}
-
ast_stream_set_formats(stream, joint_cap);
}
--
To view, visit https://gerrit.asterisk.org/6528
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 15.0
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic86f8b65a4a26a60885b28b8b1a0b22e1b471d42
Gerrit-Change-Number: 6528
Gerrit-PatchSet: 4
Gerrit-Owner: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170921/4c9d7a16/attachment-0001.html>
More information about the asterisk-commits
mailing list