summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaco Kroon <jaco@uls.co.za>2024-02-05 08:26:49 +0200
committerJoonas Niilola <juippis@gentoo.org>2024-02-06 16:55:20 +0200
commit28215aa1de35a627ab85c10443901893c5590e2f (patch)
treedca8bab02846ff9922863c40db88e52e4adf29b3 /net-misc/asterisk/files/asterisk-16.30.1-r1-iax2_jitterbuffer.patch
parentnet-misc/asterisk: add 21.1.0 (diff)
downloadgentoo-28215aa1de35a627ab85c10443901893c5590e2f.tar.gz
gentoo-28215aa1de35a627ab85c10443901893c5590e2f.tar.bz2
gentoo-28215aa1de35a627ab85c10443901893c5590e2f.zip
net-misc/asterisk: 16.30.1-r1
Include Fix I wrote that ended up only being included upstream on 18, 20 and master into 16 here. 16 is security only, since this isn't a security issue it was originally not merged to 16 and doubt pushing for that now will be successful. Closes: https://bugs.gentoo.org/923566 Signed-off-by: Jaco Kroon <jaco@uls.co.za> Closes: https://github.com/gentoo/gentoo/pull/35121 Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'net-misc/asterisk/files/asterisk-16.30.1-r1-iax2_jitterbuffer.patch')
-rw-r--r--net-misc/asterisk/files/asterisk-16.30.1-r1-iax2_jitterbuffer.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/net-misc/asterisk/files/asterisk-16.30.1-r1-iax2_jitterbuffer.patch b/net-misc/asterisk/files/asterisk-16.30.1-r1-iax2_jitterbuffer.patch
new file mode 100644
index 000000000000..67fb68b3cf42
--- /dev/null
+++ b/net-misc/asterisk/files/asterisk-16.30.1-r1-iax2_jitterbuffer.patch
@@ -0,0 +1,65 @@
+From 73103bdcd5b342ce5dfa32039333ffadad551151 Mon Sep 17 00:00:00 2001
+From: Naveen Albert <asterisk@phreaknet.org>
+Date: Wed, 14 Dec 2022 16:00:51 +0000
+Subject: [PATCH] chan_iax2: Fix jitterbuffer regression prior to receiving
+ audio.
+
+ASTERISK_29392 (a security fix) introduced a regression by
+not processing frames when we don't have an audio format.
+
+Currently, chan_iax2 only calls jb_get to read frames from
+the jitterbuffer when the voiceformat has been set on the pvt.
+However, this only happens when we receive a voice frame, which
+means that prior to receiving voice frames, other types of frames
+get stalled completely in the jitterbuffer.
+
+To fix this, we now fallback to using the format negotiated during
+call setup until we've actually received a voice frame with a format.
+This ensures we're always able to read from the jitterbuffer.
+
+ASTERISK-30354 #close
+ASTERISK-30162 #close
+
+Change-Id: Ie4fd1e8e088a145ad89e0427c2100a530e964fe9
+---
+ channels/chan_iax2.c | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
+index ab6bd61638..5b3caf03b5 100644
+--- a/channels/chan_iax2.c
++++ b/channels/chan_iax2.c
+@@ -4158,9 +4158,19 @@ static void __get_from_jb(const void *p)
+ now.tv_usec += 1000;
+
+ ms = ast_tvdiff_ms(now, pvt->rxcore);
+-
+- voicefmt = ast_format_compatibility_bitfield2format(pvt->voiceformat);
+- if (voicefmt && ms >= (next = jb_next(pvt->jb))) {
++ if (ms >= (next = jb_next(pvt->jb))) {
++ voicefmt = ast_format_compatibility_bitfield2format(pvt->voiceformat);
++ if (!voicefmt) {
++ /* pvt->voiceformat won't be set if we haven't received any voice frames yet.
++ * In this case, fall back to using the format negotiated during call setup,
++ * so we don't stall the jitterbuffer completely. */
++ voicefmt = ast_format_compatibility_bitfield2format(pvt->peerformat);
++ }
++ if (!voicefmt) {
++ /* Really shouldn't happen, but if it does, should be looked into */
++ ast_log(LOG_WARNING, "No voice format and no peer format available on %s, backlogging frame\n", ast_channel_name(pvt->owner));
++ goto cleanup; /* Don't crash if there's no voice format */
++ }
+ ret = jb_get(pvt->jb, &frame, ms, ast_format_get_default_ms(voicefmt));
+ switch(ret) {
+ case JB_OK:
+@@ -4202,6 +4212,7 @@ static void __get_from_jb(const void *p)
+ break;
+ }
+ }
++cleanup:
+ if (pvt)
+ update_jbsched(pvt);
+ ast_mutex_unlock(&iaxsl[callno]);
+--
+2.41.0
+