Browse Source

MT#55283 codec: disable clock skew calculation during media playback

when media playback happens, all packets get scheduled at the same
time with a send time in the future. however, this results in the
output_skew calculation triggering an unnecessary shift in the send
timer, which can cause choppy playback

Change-Id: I449f221a4d348eb615c2af1dca30bec163aa4fc6
rfuchs/dubber
Tom Briden 7 months ago
committed by Richard Fuchs
parent
commit
3bd7298cfe
2 changed files with 8 additions and 1 deletions
  1. +7
    -1
      daemon/codec.c
  2. +1
    -0
      include/codec.h

+ 7
- 1
daemon/codec.c View File

@ -937,6 +937,10 @@ struct codec_handler *codec_handler_make_media_player(const rtp_payload_type *sr
struct codec_handler *h = codec_handler_make_playback(src_pt, dst_pt, last_ts, media, ssrc, codec_set);
if (!h)
return NULL;
ilogs(transcoding, LOG_DEBUG, "Disabling clock skew calculation for media playback handler");
h->ssrc_handler->csch.is_media_playback = true;
if (audio_player_is_active(media)) {
h->packet_decoded = packet_decoded_audio_player;
if (!audio_player_pt_match(media, dst_pt))
@ -2484,7 +2488,9 @@ void codec_output_rtp(struct media_packet *mp, struct codec_scheduler *csch,
ts_diff_us = p->ttq_entry.when - rtpe_now;
csch->output_skew = csch->output_skew * 15 / 16 + ts_diff_us / 16;
if (!csch->is_media_playback)
csch->output_skew = csch->output_skew * 15 / 16 + ts_diff_us / 16;
if (csch->output_skew > 50000 && ts_diff_us > 10000) { // arbitrary value, 50 ms, 10 ms shift
ilogs(transcoding, LOG_DEBUG, "Steady clock skew of %li.%01li ms detected, shifting send timer back by 10 ms",
csch->output_skew / 1000,


+ 1
- 0
include/codec.h View File

@ -106,6 +106,7 @@ struct codec_scheduler {
int64_t first_send;
unsigned long first_send_ts;
long output_skew;
bool is_media_playback; // used to track media playback so we can skip skew calculation
};
struct transcode_config {


Loading…
Cancel
Save