From 466cdb337c9afa85d7c50e577b8f33ecb00b732e Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Wed, 22 May 2024 14:26:19 +0700 Subject: [PATCH] Add check for media deinitializing in media init completion callback. --- pjsip/src/pjsua-lib/pjsua_media.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c index d079787a59..d9399a357f 100644 --- a/pjsip/src/pjsua-lib/pjsua_media.c +++ b/pjsip/src/pjsua-lib/pjsua_media.c @@ -1843,6 +1843,12 @@ static pj_status_t call_media_init_cb(pjsua_call_media *call_med, goto on_return; } + /* Check if media is deinitializing */ + if (call_med->call->async_call.med_ch_deinit || !call_med->tp) { + status = PJ_ECANCELLED; + goto on_return; + } + pjmedia_transport_simulate_lost(call_med->tp, PJMEDIA_DIR_ENCODING, pjsua_var.media_cfg.tx_drop_pct);