From 1191d2e8ca4ab8138de5af37217eeb4a4c245724 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 9 Jan 2025 15:03:26 -0400 Subject: [PATCH] MT#61822 hold call reference while decoding The media blob is owned by the call, so we need to hold a reference to the call until decoding is finished. Change-Id: I6ed0d35edb485aad2811b287706ef101c4aa2c3f --- daemon/media_player.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/daemon/media_player.c b/daemon/media_player.c index dbe1b2819..caed74beb 100644 --- a/daemon/media_player.c +++ b/daemon/media_player.c @@ -77,6 +77,7 @@ struct media_player_cache_entry { struct media_player_coder coder; // de/encoder data char *info_str; // for logging + call_t *call_ref; }; struct media_player_cache_packet { char *buf; @@ -790,6 +791,7 @@ static void media_player_cache_entry_decoder_thread(void *p) { } t_hash_table_destroy(entry->wait_queue); // not needed any more entry->wait_queue = media_player_ht_null(); + obj_release(entry->call_ref); mutex_unlock(&entry->lock); } @@ -858,6 +860,7 @@ static bool media_player_cache_entry_init(struct media_player *mp, const rtp_pay ZERO(mp->coder); mp->coder.duration = entry->coder.duration; // retain this for reporting entry->coder.avioctx->opaque = &entry->coder; // format context pointer must point to new coder + entry->call_ref = obj_get(mp->call); // hold reference until decoding is finished, as blob is owned by call entry->coder.handler->packet_encoded = media_player_packet_cache;