diff --git a/daemon/call.c b/daemon/call.c index e2f547e15..205158288 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2169,10 +2169,8 @@ void call_destroy(struct call *c) { ice_shutdown(&md->ice_agent); } - if (ml->player) { - media_player_stop(ml->player); - media_player_put(&ml->player); - } + media_player_stop(ml->player); + media_player_put(&ml->player); } k = g_hash_table_get_values(c->ssrc_hash->ht); @@ -2741,6 +2739,8 @@ do_delete: if (output) ng_call_stats(c, fromtag, totag, output, NULL); + media_player_stop(ml->player); + if (delete_delay > 0) { ilog(LOG_INFO, "Scheduling deletion of call branch '"STR_FORMAT"' " "(via-branch '"STR_FORMAT"') in %d seconds", @@ -2758,6 +2758,11 @@ do_delete: goto success_unlock; del_all: + for (i = c->monologues.head; i; i = i->next) { + ml = i->data; + media_player_stop(ml->player); + } + if (delete_delay > 0) { ilog(LOG_INFO, "Scheduling deletion of entire call in %d seconds", delete_delay); c->deleted = rtpe_now.tv_sec + delete_delay; diff --git a/daemon/media_player.c b/daemon/media_player.c index 798056bdd..421af424a 100644 --- a/daemon/media_player.c +++ b/daemon/media_player.c @@ -56,6 +56,9 @@ next: // called with call->master lock in W static void media_player_shutdown(struct media_player *mp) { + if (!mp) + return; + ilog(LOG_DEBUG, "shutting down media_player"); timerthread_obj_deschedule(&mp->tt_obj); avformat_close_input(&mp->fmtctx);