Skip to content

Commit

Permalink
Merging with master to pass CI test
Browse files Browse the repository at this point in the history
  • Loading branch information
sauwming committed Oct 13, 2023
2 parents 266419f + bd9db5f commit 583cda3
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pjlib/src/pj/ssl_sock_imp_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ inline static void io_read(pj_ssl_sock_t *ssock, circ_buf_t *cb,
pj_uint8_t *dst, pj_size_t len)
{
PJ_UNUSED_ARG(ssock);
return circ_read(cb, dst, len);
circ_read(cb, dst, len);
}
inline static pj_status_t io_write(pj_ssl_sock_t *ssock, circ_buf_t *cb,
const pj_uint8_t *src, pj_size_t len)
Expand Down
2 changes: 2 additions & 0 deletions pjmedia/src/pjmedia/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ PJ_DEF(void) pjmedia_event_mgr_destroy(pjmedia_event_mgr *mgr)
mgr->is_quitting = PJ_TRUE;
pj_sem_post(mgr->sem);
pj_thread_join(mgr->thread);
pj_thread_destroy(mgr->thread);
mgr->thread = NULL;
}

if (mgr->sem) {
Expand Down
2 changes: 1 addition & 1 deletion pjmedia/src/pjmedia/transport_srtp_dtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ static pj_status_t dtls_create(transport_srtp *srtp,
pj_grp_lock_add_ref(grp_lock);
pj_grp_lock_add_handler(grp_lock, pool, ds, &dtls_on_destroy);
} else {
status = pj_lock_create_simple_mutex(ds->pool, "dtls_ssl_lock%p",
status = pj_lock_create_recursive_mutex(ds->pool, "dtls_ssl_lock%p",
&ds->ossl_lock);
if (status != PJ_SUCCESS)
return status;
Expand Down
11 changes: 11 additions & 0 deletions pjnath/src/pjnath/turn_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,8 @@ static void turn_on_state(pj_turn_session *sess,
(*turn_sock->cb.on_state)(turn_sock, old_state, new_state);
}

pj_grp_lock_acquire(turn_sock->grp_lock);

/* Make sure user hasn't destroyed us in the callback */
if (turn_sock->sess && new_state == PJ_TURN_STATE_RESOLVED) {
pj_turn_session_info info;
Expand Down Expand Up @@ -1250,6 +1252,7 @@ static void turn_on_state(pj_turn_session *sess,
status = pj_sock_socket(turn_sock->af, sock_type, 0, &sock);
if (status != PJ_SUCCESS) {
turn_sock_destroy(turn_sock, status);
pj_grp_lock_release(turn_sock->grp_lock);
return;
}

Expand All @@ -1260,6 +1263,7 @@ static void turn_on_state(pj_turn_session *sess,
if (status != PJ_SUCCESS) {
pj_sock_close(sock);
turn_sock_destroy(turn_sock, status);
pj_grp_lock_release(turn_sock->grp_lock);
return;
}
/* Apply QoS, if specified */
Expand All @@ -1271,6 +1275,7 @@ static void turn_on_state(pj_turn_session *sess,
{
pj_sock_close(sock);
turn_sock_destroy(turn_sock, status);
pj_grp_lock_release(turn_sock->grp_lock);
return;
}

Expand Down Expand Up @@ -1387,6 +1392,7 @@ static void turn_on_state(pj_turn_session *sess,
}
if (status != PJ_SUCCESS) {
turn_sock_destroy(turn_sock, status);
pj_grp_lock_release(turn_sock->grp_lock);
return;
}
if (turn_sock->cert) {
Expand All @@ -1398,6 +1404,7 @@ static void turn_on_state(pj_turn_session *sess,

if (status != PJ_SUCCESS) {
turn_sock_destroy(turn_sock, status);
pj_grp_lock_release(turn_sock->grp_lock);
return;
}

Expand All @@ -1415,6 +1422,7 @@ static void turn_on_state(pj_turn_session *sess,

if (status != PJ_SUCCESS) {
turn_sock_destroy(turn_sock, status);
pj_grp_lock_release(turn_sock->grp_lock);
return;
}

Expand Down Expand Up @@ -1457,6 +1465,7 @@ static void turn_on_state(pj_turn_session *sess,
pj_sockaddr_print(&info.server, addrtxt,
sizeof(addrtxt), 3)));
turn_sock_destroy(turn_sock, status);
pj_grp_lock_release(turn_sock->grp_lock);
return;
}

Expand All @@ -1478,6 +1487,8 @@ static void turn_on_state(pj_turn_session *sess,
&delay, TIMER_DESTROY,
turn_sock->grp_lock);
}

pj_grp_lock_release(turn_sock->grp_lock);
}


Expand Down
42 changes: 28 additions & 14 deletions pjsip/src/pjsua-lib/pjsua_media.c
Original file line number Diff line number Diff line change
Expand Up @@ -3400,8 +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_sdp,
const pjmedia_sdp_media *remote_sdp)
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 @@ -3528,11 +3528,19 @@ static void check_srtp_roc(pjsua_call *call,
pjmedia_sdp_attr *attr;

if (local_change) {
attr = pjmedia_sdp_attr_find(local_sdp->attr_count,
local_sdp->attr, &STR_ICE_UFRAG,
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 @@ -3541,11 +3549,19 @@ static void check_srtp_roc(pjsua_call *call,
}

if (rem_change) {
attr = pjmedia_sdp_attr_find(remote_sdp->attr_count,
remote_sdp->attr, &STR_ICE_UFRAG,
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 (!pj_strcmp(&call_med->prev_ice_info.rem_ufrag,
&attr->value))
if (attr == NULL) {
/* Find ice-ufrag attribute in session level */
attr = pjmedia_sdp_attr_find(rem_sdp->attr_count,
rem_sdp->attr, &STR_ICE_UFRAG,
NULL);
}
if (attr && !pj_strcmp(&call_med->prev_ice_info.rem_ufrag,
&attr->value))
{
PJ_LOG(4, (THIS_FILE, "ICE unchanged, SRTP RX ROC "
"maintained"));
Expand Down Expand Up @@ -4003,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->media[mi]);
check_srtp_roc(call, mi, &stream_info, local_sdp, remote_sdp);
#endif
#endif

Expand Down Expand Up @@ -4260,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->media[mi]);
check_srtp_roc(call, mi, &stream_info, local_sdp, remote_sdp);
#endif
#endif

Expand Down

0 comments on commit 583cda3

Please sign in to comment.