From 667c1546e38a85b428c0ac3fc0b8b10f7bcd8204 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 3 May 2022 09:18:29 -0400 Subject: [PATCH] TT#14008 handle possible NULL dtxp->packet closes #1485 Change-Id: Ic7e3d6b9595b5f7cc78f1efe97cd600ec2388c8c --- daemon/codec.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/daemon/codec.c b/daemon/codec.c index dc8695570..678600895 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -2913,7 +2913,7 @@ static void __dtx_send_later(struct codec_timer *ct) { dtxp = g_queue_peek_head(&dtxb->packets); if (dtxp) { // inspect head packet and check TS, see if it's ready to be decoded - ts = dtxp->packet->ts; + ts = dtxp->packet ? dtxp->packet->ts : dtxb->head_ts; ts_diff = ts - dtxb->head_ts; long long ts_diff_us = (long long) ts_diff * 1000000 / dtxb->clockrate; @@ -2944,10 +2944,13 @@ static void __dtx_send_later(struct codec_timer *ct) { media_packet_copy(&dtxb->last_mp, &dtxp->mp); media_packet_copy(&mp_copy, &dtxp->mp); if (dtxb->head_ts) - ts_diff = dtxp->packet->ts - dtxb->head_ts; + ts_diff = dtxp->packet ? dtxp->packet->ts - dtxb->head_ts : 0; else ts_diff = dtxb->tspp; // first packet - ts = dtxb->head_ts = dtxp->packet->ts; + if (dtxp->packet) + ts = dtxb->head_ts = dtxp->packet->ts; + else + ts = dtxb->head_ts; tv_diff = timeval_diff(&rtpe_now, &mp_copy.tv); } else {