[Freeswitch-dev] Rare audio "clicks" inside mod_conference

Peter Olsson peter.olsson at visionutveckling.se
Wed Aug 15 16:50:09 MSD 2012

I'm not really sure where to ask about this, but I'll give it a try on the dev-list for starters..

I sometimes (very rarely, but often enough to want to find the cause) get audio "clicks" in the audio stream on devices connected to a FS conference. I have samples from wireshark showing the problem. In L16 format it seems there are a few bytes set to 32767 (max int16 value), that is causing the actual audio.

The strange thing is that when this occurs, there is actually no one that sends this audio (but all members except one will get this audio, so it has been put into the buffer by the member without the click), so I'm starting to think if this is a generated packet inside FS, that is not initialized correctly, or if the decoding from PCMA/PCMU to L16 fails for some reason.

I've traced it down so far that I know how to handle it (at least work around it), but I don't know how to reproduce it, and I don't know the real cause. With the help of lots of debugging I've seen that this occurs when a partial frame is read from a member (however, according to wireshark, this partial frame was never sent over the network). We have 8khz conferences, and the connected members use PCMA and/or PCMU, so normally when audio from a member is appended to the audio buffer, the length of the data is 320 bytes (I guess this is L16). When the click occurs, I've seen that the datasize is only 160 bytes instead, which would more indicate a undecoded PCMA/PCMU frame. And as I said, there is no packet with half the payload size anywhere in wireshark, so I'm not really sure where this is coming from. I've looked through most of the code in switch_rtp.c and mod_sofia.c (that's related to RTP), but I can't really find any good reason.

Right now I've added a check (if read_frame->datalen != member->read_impl.encoded_bytes_per_packet), and when using this it works as expected (at least so far - as I said, it happens rarely), but I guess I might miss a frame of audio. I will try to look into this further, but if anyone have any suggestions I'm open for ideas :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20120815/e5512bd5/attachment.html 

Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list