[pjsip] conference bridge questions

Benny Prijono bennylp at pjsip.org
Tue Jul 22 09:44:03 EDT 2008

On Fri, Jul 18, 2008 at 9:21 AM, Gang Liu <gangban.lau at gmail.com> wrote:

> Hi nanang
>     Thanks for your link.
>     I had do some testing this week. But at my testing(local LAN), the
> latency is high when both calling and callee use conf bridge for normal call
> handling.

Sorry for the late reply. Nanang has been feeling a bit under the weather
recently so he's been mostly away from computers.

>     I know default value of sound device record/playback latency is 100ms.
> If conf bridge don't add more latency, I think total
>     latency wouldn't reach 300 ms for one way conversion at my local LAN.

300ms seems high for LAN and without the conference bridge. How did you test

> But at my testing we found latency is high. There must
>     be somewhere add more latency besides sound device.

That will be the buffering in conference bridge and in the jitter buffer.

>     So I reduce sound device and conf bridge ptime to 10ms, and change
> sound device record/play back latency to 40 ms.
>     PJMEDIA_SOUND_BUFFER_COUNT still 6. The reduce of latency is quite
> obvious. I thought there maybe some latency caused by
>     bridge.If this isn't true, why only 120 ms latency reduced by sound
> device will let us see impressed result.
>     Yes, the best answer is to learn conference bridge source code. But
> there will be helpful advice from your experts to make it clear.

IMO the main culprit is with the audio burst from your sound device. If your
sound device is sending N burst frames at a time, then it will add up to
2*N*ptime of additional latency end to end. This is because the conference
bridge is buffering N*ptime before transmittign the frame from conference
(due to how conference.c works), and also the burst will be counted as
jitter on the receiver end as well, so the jitter buffer will also buffer
N*ptime, giving it the total of 2*N*ptime of additional latency.

You can see the audio burst characteristic of your sound device from
sndtest.exe output. For example in my computer:

 Dumping results:
  Parameters: clock rate=8000Hz, 80 samples/frame
  Capture stream report:
   Duration: 10s.110
   Frame interval: min=0.004ms, max=30.255ms

The test above shows audio ptime is set to 10ms (80 samples @8KHz sample
rate), and burst value of at least 3 frames at a time (see max frame
interval of 30ms, which counts as 3 frames). In real conversation, the
actual burst can be higher than that due to other activities in your
computer, it can be up to two frames higher.

With this, the end-to-end audio latency here (from mouth to ear, with
conference bridge) is around 250ms, which is not too shabby.

So I would be interested to know what's the sound burst value in your
system, to see if my assumptions above were right.

Btw, we look forward to modify the conference bridge to remove the N*ptime
buffering in the next release, so stay tuned for further latency reductions
(and also APS for those working on Symbian which would also cut latency
significantly). :)


> ------ config_site.h ------------
>     At all testing, we are using G729 codec at ptime 20ms. OS is windows
> XP. And VS 2005.
> regards,
> Gang
> On Fri, Jul 18, 2008 at 12:30 AM, Nanang Izzuddin <nanang at pjsip.org>
> wrote:
>> Hi Gang Lau,
>> 2008/7/17 Gang Lau <gangban.lau at gmail.com>:
>> > Hi,
>> >     I have some questions about conference bridge when play with
>> pjsipua.
>> >
>> >     If we want to create a four party audio conference, is it needed to
>> > connect all channels each other?
>> >
>> >     connect(0, 1);
>> >     connect(0, 2);
>> >     connect(0, 3);
>> >     connect(1, 0);
>> >     ...
>> >     connect(1,3);
>> >     connect(2,0);
>> >     ...
>> >     connect(2,3);
>> >     ...
>> >     connect(3,2);
>> >
>> >     or just all the ports connected to port zero and port zero connected
>> to
>> > all ports is enough.
>> You have to connect all channels each other. Port zero is just a
>> participant as the other stream ports, it doesn't do the mixing, the
>> conference bridge does.
>> >
>> >     And it seems pjsipua create conference bridge by default, even for a
>> > simple call.
>> Yes, assumed you are using PJSUA, there is no pjsipua.
>> >     The conference bridge has 120ms(buffer size 6 * ptime 20 ms)
>> latency.A
>> > simple call will be total 240ms latency caused by
>> >     both side bridge. Is it true?
>> >     How could I reduce latency for pjsipua?
>> >
>> No, it isn't true :)
>> The buffer size you point there should be PJMEDIA_SOUND_BUFFER_COUNT.
>> Please see please see
>> http://trac.pjsip.org/repos/wiki/FAQ#audio-latency about buffer size
>> meaning. The link also gives info about how to reduce latency.
>> Regards,
>> nanang
>> _______________________________________________
>> Visit our blog: http://blog.pjsip.org
>> pjsip mailing list
>> pjsip at lists.pjsip.org
>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080722/3c91e08d/attachment.html 

More information about the pjsip mailing list