R: Minimum latency achievable aside

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

 



Follow up question if you’d be so kind to indulge in my ignorance!

 

While experimenting to find out the best tradeoff between audio quality and latency, I discovered I was unable to get to the point where quality is affected because it seems that Pjsua won’t allow me to go below 42 ms for either play/cap latency even if I set the values to 15ms in pjsua_media_config (I can see it from the information printed out when a device is opened with log-level set to 6).

 

Do you think there is something that can be done here? It all ends in the ALSA lib method in alsa_dev.c that gets the nearest possible buffer size (snd_pcm_hw_params_set_buffer_size_near) as far as I can tell. Do you have any suggestions regarding this? Any other setting that I might change in order to get smaller values returned from this function? My understanding of Alsa is very limited, any pointer in the right direction would be of great help.

 

Also I’m achieving much better results by compiling the library with the audio switchboard enabled (“#define PJMEDIA_CONF_USE_SWITCH_BOARD 1” in config_site.h) but I still experience the same limit while experimenting.

 

Any suggestions?

Thanks,

Gianni

 

 

Da: pjsip [mailto:pjsip-bounces@xxxxxxxxxxxxxxx] Per conto di Bill Gardner
Inviato: giovedì 26 maggio 2016 18:50
A: pjsip@xxxxxxxxxxxxxxx
Oggetto: Re: Minimum latency achievable aside

 

Hi Gianni,

I don't know what minimum latencies you can get with ALSA on PI, you'll just have to experiment. DAWs typically use ASIO format which is designed for low latency operation, I have no idea how hard it would be to implement ASIO or an alternative to ALSA on PI. As you already know most of the pjsua latency is in the audio device buffering. There is also a wsola buffer which holds recorded samples from the microphone awaiting processing by the bridge, this buffer is needed to compensate for differing playback and record sampling rates. And, there is the jitter buffer which is obviously essential to compensate for network delivery timing, missing packets, etc.  There isn't any latency in the media path which isn't essential, more latency allows more variation in the behavior of the audio device or network. You can tweak the parameters to decrease latency at the risk of getting getting poor audio quality when the audio device or network doesn't behave optimally.

I can't see there would be an advantage in using just the pjmedia library instead of pjsua.

Cheers,

Bill

On 5/26/2016 9:44 AM, Gianni Massi wrote:

Hi all,

You’re my hero if you decide to answer even 10% of my question.

 

My question regards latency in applications using the PJSUA library. I am currently running my application on either a machine with Debian or a Raspberry PI board with Raspbian OS using the ALSA audio backend.

 

I was wondering, in your experience is it possible to achieve overall latencies < 50ms with the Pjsua library?

 

I found that the main limit in this is lowering the latency introduced by audio devices, so I was wondering if you could help me understand, if there is a limit, why it so high (in my experience I was not able to go below 42 ms for capture and 42ms for playback, not even by setting the parameter to lower values in the pjsua_media_config object passed during library initialization with pjsua_init()) compared to other applications that use audio devices (e.g. any type of DAWs allows latencies below 20ms).

 

Is there some design requirement to have large buffers at some point in the processing?

Is there anything that can be done by modifying the audio backend?

Can I achieve <50ms latencies by using the pjmedia library directly and not going through pjsua?


Any help will be highly appreciated, Thanks

 

Gianni Massi

 




_______________________________________________
Visit our blog: http://blog.pjsip.org
 
pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

 

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux