[Home]

Summary:ASTERISK-25353: [patch] Transcoding while different in Frame size = Frames lost
Reporter:Alexander Traud (traud)Labels:
Date Opened:2015-08-28 15:45:01Date Closed:2015-09-29 16:31:21
Priority:MajorRegression?
Status:Closed/CompleteComponents:Codecs/General
Versions:SVN 11.19.0 13.5.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) codec_gsm.patch
( 1) codec_ilbc.patch
( 2) codec_lpc10.patch
( 3) codec_speex_for_Asterisk_11.patch
( 4) codec_speex.patch
( 5) translate_for_Asterisk_11.patch
( 6) translate.patch
Description:For example, when Asterisk transcodes from audio-codec iLBC 30 to the audio-codec Speex16, lintospeex_frameout is called twice, with 480 samples each = 960. This should create three frames, with 320 samples each. However, Asterisk sends one small frame (320 samples) and one big frame (640 samples) on the wire.

I noticed this issue while testing my [AMR-WB transcoding module|https://github.com/traud/asterisk-amr]. AMR-WB uses the same amount of samples as Speex16: Two frames are transcoded into one correct frame, and one incorrect double-size frame on the wire. However with AMR, a frame with the wrong byte length MUST be ignored. Therefore, the transcoding destroyed two third of the samples. Only one third was OK. Therefore, the voice was robotic on the AMR side. AMR » iLBC "sounded" OK. By the way, the same happens for Speex8 and AMR-NB (8000 Hz). Consequently, this issue is not related to 8000 Hz «-» 16000 Hz.

The attached patch fixes ast_translate to tag additional frames with the correct delivery time, as expected by main/channel.c:ast_write (see comments there). Furthermore, the patch advances the predicted delivery-time accordingly. This patch does not have any side-effect on current source code because no codecs/codec_XXX.c is returning several frames, yet.

This issue was not reproducible for transcodings which use default_frameout, like G.711 and G.722. Therefore, I changed all transcodings which use ast_trans_frameout: GSM, iLBC, LPC10, and Speex. I tested GSM, Speex8, Speex16, Speex32, and iLBC. Now, those create constant amount of samples on the wire (no normal+big frames anymore). However, I was not able to test LPC10 because I do not have a 3rd-party device to double-check.
Comments:By: Alexander Traud (traud) 2015-09-30 09:54:31.492-0500

Please, do not forget to double-check the ast_trans_frameout usage in other [add-on codecs|https://www.digium.com/products/asterisk/downloads] like the closed-source modules from Digium: G.729 (plus Siren, SILK for Asterisk 11).