Skip to content

Commit

Permalink
Also check the same for local SDP
Browse files Browse the repository at this point in the history
  • Loading branch information
sauwming committed Oct 9, 2023
1 parent 93785a3 commit 45856df
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions pjsip/src/pjsua-lib/pjsua_media.c
Original file line number Diff line number Diff line change
Expand Up @@ -3400,9 +3400,8 @@ static pj_bool_t is_ice_running(pjmedia_transport *tp)
static void check_srtp_roc(pjsua_call *call,
unsigned med_idx,
const pjsua_stream_info *new_si_,
const pjmedia_sdp_media *local_m,
const pjmedia_sdp_session *rem_sdp,
const pjmedia_sdp_media *rem_m)
const pjmedia_sdp_session *local_sdp,
const pjmedia_sdp_session *rem_sdp)
{
pjsua_call_media *call_med = &call->media[med_idx];
pjmedia_transport_info tpinfo;
Expand Down Expand Up @@ -3529,11 +3528,19 @@ static void check_srtp_roc(pjsua_call *call,
pjmedia_sdp_attr *attr;

if (local_change) {
pjmedia_sdp_media *local_m = local_sdp->media[med_idx];

attr = pjmedia_sdp_attr_find(local_m->attr_count,
local_m->attr, &STR_ICE_UFRAG,
NULL);
if (!pj_strcmp(&call_med->prev_ice_info.loc_ufrag,
&attr->value))
if (attr == NULL) {
/* Find ice-ufrag attribute in session level */
attr = pjmedia_sdp_attr_find(local_sdp->attr_count,
local_sdp->attr, &STR_ICE_UFRAG,
NULL);
}
if (attr && !pj_strcmp(&call_med->prev_ice_info.loc_ufrag,
&attr->value))
{
PJ_LOG(4, (THIS_FILE, "ICE unchanged, SRTP TX ROC "
"maintained"));
Expand All @@ -3542,11 +3549,13 @@ static void check_srtp_roc(pjsua_call *call,
}

if (rem_change) {
pjmedia_sdp_media *rem_m = rem_sdp->media[med_idx];

attr = pjmedia_sdp_attr_find(rem_m->attr_count,
rem_m->attr, &STR_ICE_UFRAG,
NULL);
if (attr == NULL) {
/* Find ice-ufrag attribute in session descriptor */
/* Find ice-ufrag attribute in session level */
attr = pjmedia_sdp_attr_find(rem_sdp->attr_count,
rem_sdp->attr, &STR_ICE_UFRAG,
NULL);
Expand Down Expand Up @@ -4010,8 +4019,7 @@ pj_status_t pjsua_media_channel_update(pjsua_call_id call_id,
#if PJSUA_MEDIA_HAS_PJMEDIA || PJSUA_THIRD_PARTY_STREAM_HAS_GET_INFO
#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
/* Check if we need to reset or maintain SRTP ROC */
check_srtp_roc(call, mi, &stream_info, local_sdp->media[mi],
remote_sdp, remote_sdp->media[mi]);
check_srtp_roc(call, mi, &stream_info, local_sdp, remote_sdp);
#endif
#endif

Expand Down Expand Up @@ -4267,8 +4275,7 @@ pj_status_t pjsua_media_channel_update(pjsua_call_id call_id,
#if PJSUA_MEDIA_HAS_PJMEDIA || PJSUA_THIRD_PARTY_STREAM_HAS_GET_INFO
#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
/* Check if we need to reset or maintain SRTP ROC */
check_srtp_roc(call, mi, &stream_info, local_sdp->media[mi],
remote_sdp, remote_sdp->media[mi]);
check_srtp_roc(call, mi, &stream_info, local_sdp, remote_sdp);
#endif
#endif

Expand Down

0 comments on commit 45856df

Please sign in to comment.