[Asterisk-code-review] chan_iax2: Fix stalled jitterbuffer prior to receiving audio. (asterisk[master])

N A asteriskteam at digium.com
Wed Dec 14 10:03:34 CST 2022


N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19712 )


Change subject: chan_iax2: Fix stalled jitterbuffer prior to receiving audio.
......................................................................

chan_iax2: Fix stalled jitterbuffer prior to receiving audio.

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 jitter buffer.

To fix this, we now fallback to using the format negotiated during
the call until we've actually received a voice frame with a format.
This ensures we're always able to read from the jitter buffer.

ASTERISK-30354 #close

Change-Id: Ie4fd1e8e088a145ad89e0427c2100a530e964fe9
---
M channels/chan_iax2.c
1 file changed, 27 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/12/19712/1

diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index ab6bd61..0a637df 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -4160,6 +4160,12 @@
 	ms = ast_tvdiff_ms(now, pvt->rxcore);
 
 	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 && ms >= (next = jb_next(pvt->jb))) {
 		ret = jb_get(pvt->jb, &frame, ms, ast_format_get_default_ms(voicefmt));
 		switch(ret) {

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19712
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ie4fd1e8e088a145ad89e0427c2100a530e964fe9
Gerrit-Change-Number: 19712
Gerrit-PatchSet: 1
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221214/631675e7/attachment-0001.html>


More information about the asterisk-code-review mailing list