MT#55283 selectively stop codec handlers

If we're updating the handlers for one particular source -> sink flow,
only stop/reset the handlers matching this flow.

Change-Id: I1d046f47f8d26cac47c5d0f4318498eacb6c5677
(cherry picked from commit e24bacaa4c)
mr10.5.6
Richard Fuchs 2 years ago
parent 428541cd64
commit 09303cfd2d

@ -4292,7 +4292,7 @@ int call_get_mono_dialogue(struct call_monologue *dialogue[2], struct call *call
static void media_stop(struct call_media *m) {
t38_gateway_stop(m->t38_gateway);
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);
}

@ -988,7 +988,7 @@ bool codec_handlers_update(struct call_media *receiver, struct call_media *sink,
if (proto_is_not_rtp(receiver->protocol)) {
__generator_stop(receiver);
__generator_stop(sink);
codec_handlers_stop(&receiver->codec_handlers_store);
codec_handlers_stop(&receiver->codec_handlers_store, sink);
return false;
}
@ -1004,7 +1004,7 @@ bool codec_handlers_update(struct call_media *receiver, struct call_media *sink,
// 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;
@ -3261,10 +3261,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);

@ -139,7 +139,7 @@ uint64_t codec_encoder_pts(struct codec_ssrc_handler *ch);
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);
#else
@ -150,7 +150,7 @@ INLINE bool codec_handlers_update(struct call_media *receiver, struct call_media
}
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

Loading…
Cancel
Save