Browse Source

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
pull/1747/head
Richard Fuchs 2 years ago
parent
commit
e24bacaa4c
3 changed files with 9 additions and 6 deletions
  1. +1
    -1
      daemon/call.c
  2. +6
    -3
      daemon/codec.c
  3. +2
    -2
      include/codec.h

+ 1
- 1
daemon/call.c View File

@ -4728,7 +4728,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);
}


+ 6
- 3
daemon/codec.c View File

@ -1040,7 +1040,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;
}
@ -1056,7 +1056,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;
@ -3595,10 +3595,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);


+ 2
- 2
include/codec.h View File

@ -191,7 +191,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,
@ -230,7 +230,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


Loading…
Cancel
Save