linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] linphone-android: delay keeps increasing when soun


From: Dario Fiumicello
Subject: [Linphone-developers] linphone-android: delay keeps increasing when sound card gets stuck.
Date: Wed, 17 Oct 2012 11:25:35 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1

Hello everyone, I'm playing with Linphone for Android and I noticed a strange problem that arise when, for some reason, sound card gets stuck for some time (from a hundred of milliseconds to 2 or 3 seconds) and doesn't consume audio stream.

I'm making an example: A is a standard VoIP phone and is calling B, which is an Android with Linphone. Both are using PCMA

A is saying "Hello, I'm a standard VoIP phone and I'm calling you on Android.". The total time to say this is, for example, 5 seconds.

B is receiving "Hello, I'm a standar ...........(silence)....................d VoIP phone and I'm call.....(silence).......ing you on Android." The receive time is, for example, 7 seconds.

At a first glance I thought that the problem was somewhere in the network or in the jitter buffer, but after I made a trace on the phone I discovered that packets arrived correctly and perfectly in sequence, so the problem should be "inside" the phone.

Thinghs are even worse if the call is very long, since the delay keeps increasing. Sometime after a 5 minute call I have a delay of about 5 seconds!!!

So, since I had this big delay, I thought that somewhere in the code there was a queue that is going to get filled and filled with data that the phone is not able to consume.

After digging a little I found the "bad" queue; in msandroid.cpp, in function "void msandroid_sound_write_process(MSFilter *f)", there is an ms_bufferizer_put() that fills the queue d->bufferizer. As far as I understand this queue is then used by the soundcard in order to play audio to the speaker.

By putting a debug print line in the ms_bufferizer_put() I discovered that every time I hear a big "silence hole" this queue became bigger and bigger. Since it is not upper-limited it keeps accumulating delay, making impossible to have a good phone call.

To check if I was right I modified ms_bufferizer_put() in order to flush the queue if it reaches a size of 20 packets. That makes the trick! If the soundcard is not able to consume the stream then the queue automatically discards old voice data, so once the sound card starts working again it keeps playing "fresh" audio.

I tested it with three different mobiles, Alcatel OT-908 with 2.2.2, LG E730 with 2.3.4 and Samsung GT-S7500 with 2.3.6, all of them gives me the same "silence hole" problem. Moreover, on LG I discovered that the "dmesg" command sometimes tells me:

[audio_out.c:audio_dsp_event] PCMDMAMISSED 32

Apart from the problem of the sound card hanging (which I suppose is not a linphone fault), I think that queues used to connect mediastreamer filters has to be upper-bounded in order to avoid such bad situations.

I'd like to know what do you think and if this is a good solution for avoiding this problem.

Thank you, kind regards.
-- 
Dario Fiumicello

reply via email to

[Prev in Thread] Current Thread [Next in Thread]