From 5daa2e3315916a650ac1b75bf5e33b4ffb7a147c Mon Sep 17 00:00:00 2001 From: Pascal Cadotte Michaud Date: Tue, 18 Jan 2022 13:50:50 -0500 Subject: [PATCH] plc: move the rtcp management before the PLC RTCP frames can come from another sequence making the PLC code think there's a ton of missing frames --- debian/patches/enable_native_plc.patch | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/debian/patches/enable_native_plc.patch b/debian/patches/enable_native_plc.patch index 8297aa8..6fb21fe 100644 --- a/debian/patches/enable_native_plc.patch +++ b/debian/patches/enable_native_plc.patch @@ -10,7 +10,7 @@ Index: asterisk-18.10.0/main/translate.c /* * If the translator has not provided a format -@@ -564,13 +565,46 @@ static struct ast_frame *generate_interp +@@ -564,14 +565,17 @@ static struct ast_frame *generate_interp /*! \brief do the actual translation */ struct ast_frame *ast_translate(struct ast_trans_pvt *path, struct ast_frame *f, int consume) { @@ -24,7 +24,16 @@ Index: asterisk-18.10.0/main/translate.c long len; - int seqno; + int seqno, frames_missing; -+ + ++ /* RTCP frames can be received with different seqno from main/channel.c:.__ast_queue_frame */ ++ /* These frames are forwarded to the translator for feedback before doing PLC */ + if (f->frametype == AST_FRAME_RTCP) { + /* Just pass the feedback to the right callback, if it exists. + * This "translation" does nothing so return a null frame. */ +@@ -583,6 +587,38 @@ struct ast_frame *ast_translate(struct a + return &ast_null_frame; + } + + /* Determine the amount of lost packets for PLC */ + /* But not at start with first frame = path->f.seqno is still 0x10000 */ + /* But not when there is no sequence number = frame created internally */ @@ -56,10 +65,11 @@ Index: asterisk-18.10.0/main/translate.c + } else { + frames_missing = 0; + } - - if (f->frametype == AST_FRAME_RTCP) { - /* Just pass the feedback to the right callback, if it exists. -@@ -611,19 +645,94 @@ struct ast_frame *ast_translate(struct a ++ + has_timing_info = ast_test_flag(f, AST_FRFLAG_HAS_TIMING_INFO); + ts = f->ts; + len = f->len; +@@ -611,19 +647,94 @@ struct ast_frame *ast_translate(struct a f->samples, ast_format_get_sample_rate(f->subclass.format))); } delivery = f->delivery;