diff --git a/daemon/call.c b/daemon/call.c index caea5be1a1..26a77451b5 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -4418,7 +4418,7 @@ static void media_stop(struct call_media *m) { return; t38_gateway_stop(m->t38_gateway); audio_player_stop(m); - codec_handlers_stop(&m->codec_handlers_store); + codec_handlers_stop(&m->codec_handlers_store, NULL); rtcp_timer_stop(&m->rtcp_timer); mqtt_timer_stop(&m->mqtt_timer); } diff --git a/daemon/codec.c b/daemon/codec.c index c44a3de32b..9dccdf329b 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -1027,7 +1027,7 @@ void __codec_handlers_update(struct call_media *receiver, struct call_media *sin if (proto_is_not_rtp(receiver->protocol)) { __generator_stop_all(receiver); __generator_stop_all(sink); - codec_handlers_stop(&receiver->codec_handlers_store); + codec_handlers_stop(&receiver->codec_handlers_store, sink); return; } @@ -1043,7 +1043,7 @@ void __codec_handlers_update(struct call_media *receiver, struct call_media *sin // we're doing some kind of media passthrough - shut down local generators __generator_stop(receiver); __generator_stop(sink); - codec_handlers_stop(&receiver->codec_handlers_store); + codec_handlers_stop(&receiver->codec_handlers_store, sink); bool is_transcoding = false; receiver->rtcp_handler = NULL; @@ -3582,10 +3582,13 @@ static void __ssrc_handler_stop(void *p, void *arg) { dtx_buffer_stop(&ch->dtx_buffer); } } -void codec_handlers_stop(GQueue *q) { +void codec_handlers_stop(GQueue *q, struct call_media *sink) { for (GList *l = q->head; l; l = l->next) { struct codec_handler *h = l->data; + if (sink && h->sink != sink) + continue; + if (h->delay_buffer) { mutex_lock(&h->delay_buffer->lock); __delay_buffer_shutdown(h->delay_buffer, true); diff --git a/include/codec.h b/include/codec.h index 4518ca78ec..bbc4209ee3 100644 --- a/include/codec.h +++ b/include/codec.h @@ -192,7 +192,7 @@ uint64_t codec_encoder_pts(struct codec_ssrc_handler *ch, struct ssrc_ctx *); void codec_decoder_skip_pts(struct codec_ssrc_handler *ch, uint64_t); uint64_t codec_decoder_unskip_pts(struct codec_ssrc_handler *ch); void codec_tracker_update(struct codec_store *); -void codec_handlers_stop(GQueue *); +void codec_handlers_stop(GQueue *, struct call_media *sink); void packet_encoded_packetize(AVPacket *pkt, struct codec_ssrc_handler *ch, struct media_packet *mp, @@ -231,7 +231,7 @@ INLINE void __codec_handlers_update(struct call_media *receiver, struct call_med } INLINE void codec_handler_free(struct codec_handler **handler) { } INLINE void codec_tracker_update(struct codec_store *cs) { } -INLINE void codec_handlers_stop(GQueue *q) { } +INLINE void codec_handlers_stop(GQueue *q, struct call_media *sink) { } INLINE void ensure_codec_def(struct rtp_payload_type *pt, struct call_media *media) { } #endif