summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2017-09-21 12:30:18 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-09-21 12:30:18 -0500
commit357a2f353b1157a86aefb6220d7f8c7166ccb0f7 (patch)
treeb29ea23170ad2395a20c86ec8b6987bc45cac163 /res
parent5ff46578aa20921cf3649809a9be9b7231acc507 (diff)
parente666051d790bb2a9d1e9ff6bb11bd69db6e0efba (diff)
Merge "res_pjsip_session: Check for removed stream state."
Diffstat (limited to 'res')
-rw-r--r--res/res_pjsip_sdp_rtp.c2
-rw-r--r--res/res_pjsip_session.c10
2 files changed, 7 insertions, 5 deletions
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index e095f0660..8ec57aa8e 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -1338,7 +1338,7 @@ static int create_outgoing_sdp_stream(struct ast_sip_session *session, struct as
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 64416a063..77ddfbc14 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -1455,6 +1455,10 @@ int ast_sip_session_refresh(struct ast_sip_session *session,
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 @@ int ast_sip_session_refresh(struct ast_sip_session *session,
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);
}