[Home]

Summary:ASTERISK-08918: [patch] Incorrect handling of zero-length frames for codecs capable of native PLC
Reporter:mihai (mihai)Labels:
Date Opened:2007-03-01 15:34:26.000-0600Date Closed:2007-05-24 10:28:09
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/CodecInterface
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 07asterisk-1.4-plc-fix.patch
Description:When audio packets are lost, the jitterbuffer will replace them with zero-length frames and then the generic PLC mechanism will interpolate audio based on previously received correct frames. However, if the codec is capable of doing native PLC and does not set the useplc flag in struct ast_translator, then the translation fails. This is the case with speex and ilbc.

The problem occurs in 1.4.0 as well as in the latest trunk.

****** ADDITIONAL INFORMATION ******

How to reproduce:
I'm doing iax2 calls into an app_conference session, with jitterbuffer enabled. However, the problem is not related to neither iax2 nor app_conference:
- make the call
- generate some packet loss on the network (traffic shaping or by using iax2 test losspct command)
- app_conference will log an error message when the call to ast_translate fails.

What causes it:
The problem occurs in main/translate.c, in framein(), around line 177. f->datalen is 0 and we have not setup a pvt->plc structure, so framein() will simply return 0, and ignore the frame. Correct behavior would be to pass the zero-length frame to the translator, if the translator supports native PLC.

Proposed solution (the attached patch was diffed against 1.4.0):
- add a flag (native_plc) to struct ast_translator.
- all codecs that can do native PLC will set this flag to 1. Right now, this means speex and ilbc. These codecs will also not set the useplc flag and will not initialize a pvt->plc structure
- Change the logic in framein() so that if we don't have a generic pvt->plc structure and the translator has the native_plc flag set, then just continue on and pass the frame to the translator's framein() function
Comments:By: mihai (mihai) 2007-03-01 15:57:00.000-0600

I have just faxed in a disclaimer so feel free to use the patch.

By: mihai (mihai) 2007-03-04 18:08:13.000-0600

I have verified that the patch applies correctly to 1.4.1 as well as the latest trunk (rev 57767)

By: Olle Johansson (oej) 2007-05-15 15:24:48

Thanks for contributing code to asteirsk and fixing your disclaimer. Now we need to find a developer to test this and possibly commit it.

By: Jason Parker (jparker) 2007-05-24 10:28:08

Fixed in svn branch 1.4 and trunk in revisions 65877 and 65903.