Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pjmedia/src/pjmedia/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -3168,6 +3168,12 @@ PJ_DEF(pj_status_t) pjmedia_stream_destroy( pjmedia_stream *stream )

PJ_LOG(4,(stream->port.info.name.ptr, "Stream destroying"));

/* Stop the streaming */
if (stream->enc)
stream->port.put_frame = NULL;
if (stream->dec)
stream->port.get_frame = NULL;

/* Send RTCP BYE (also SDES & XR) */
if (stream->transport && !stream->rtcp_sdes_bye_disabled) {
#if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
Expand Down
14 changes: 14 additions & 0 deletions pjsip/src/pjsua-lib/pjsua_media.c
Original file line number Diff line number Diff line change
Expand Up @@ -2269,6 +2269,7 @@ static pj_status_t media_channel_init_cb(pjsua_call_id call_id,

if (call_med->use_custom_med_tp) {
unsigned custom_med_tp_flags = PJSUA_MED_TP_CLOSE_MEMBER;
pj_grp_lock_t *tp_grp_lock = call_med->tp->grp_lock;

/* Use custom media transport returned by the application */
call_med->tp =
Expand All @@ -2279,6 +2280,19 @@ static pj_status_t media_channel_init_cb(pjsua_call_id call_id,
status =
PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_TEMPORARILY_UNAVAILABLE);
}

/* Check if the media transport adapter has no group lock. */
if (call_med->tp && call_med->tp->grp_lock==NULL) {
PJ_LOG(3, (THIS_FILE, "Call %d media %d: Warning, "
"media transport adapter should manage its "
"lifetime using group lock of the underlying "
"transport", call_id, mi));

/* Assign group lock, this will maintain the lifetime of
* the original transport only, not the transport adapter.
*/
call_med->tp->grp_lock = tp_grp_lock;
}
}

if (call_med->tp) {
Expand Down