From f79593ecc9772679b9b5535e951c26b32d1aaacb Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 22 Dec 2021 14:27:21 -0500 Subject: [PATCH] TT#136957 use output PT clock rate instead of encoder clock rate ... for scheduling output RTP packets. This is mostly relevant for DTMF packets which don't have an associated encoder when being forwarded. Change-Id: I56ee94a9ac7f42cc65eec0703bf042065687e43f --- daemon/codec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/daemon/codec.c b/daemon/codec.c index 1b04adcb4..a6556352e 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -1568,14 +1568,13 @@ static void __output_rtp(struct media_packet *mp, struct codec_ssrc_handler *ch, // this packet is dynamically allocated, so we're able to schedule it. // determine scheduled time to send - if (ch->first_send.tv_sec && ch->encoder_format.clockrate) { + if (ch->first_send.tv_sec && handler->dest_pt.clock_rate) { // scale first_send from first_send_ts to ts p->ttq_entry.when = ch->first_send; uint32_t ts_diff = (uint32_t) ts - (uint32_t) ch->first_send_ts; // allow for wrap-around ts_diff += ts_delay; long long ts_diff_us = - (unsigned long long) ts_diff * 1000000 / ch->encoder_format.clockrate - * ch->handler->dest_pt.codec_def->clockrate_mult; + (unsigned long long) ts_diff * 1000000 / handler->dest_pt.clock_rate; timeval_add_usec(&p->ttq_entry.when, ts_diff_us); // how far in the future is this?