Reduce Tx Jitter on Android with PJSIP 2.4.5 and PJSUA2 Java Bindings

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

 



Hi everybody, 
I'm using PJSIP 2.4.5 compiled with Android NDK API 19 and PJSUA2 Java bindings on an Android 4.4 phone. The project which contains the compiled stack which I'm using, together with the PJSUA2 Java bindings is also open-source and can be found here: https://github.com/gotev/pjsip-android 

After doing some tests with Wireshark and analyzing the outgoing RTP trasmissions, I've seen that the RTP packets are not transmitted at an equal interval. I use PJSIP's default values, so I expect an RTP packet coming out at a constant rate, but what I see instead is that the timing between the packets is not equal, with a trasmission burst of 3-4 packets at a time. This increases jitter, and when I have some poor SIP device on the other side or poor network connectivity, it causes audio problems. 

By searching on the internet and into the docs, I've discovered that this is due to the poor audio devices on Android and then I've come across this FAQ: https://trac.pjsip.org/repos/wiki/FAQ#tx-timing but I can't figure out how to apply those concepts by using PJSUA2 bindings. Tried to create a master port, but I haven't found any class or method in PJSUA2 Java bindings which maps the ones described in the FAQ. Searched also on the web, but without luck, so I'm asking here. 

In my current implementation, which is a class which extends the PJSUA2 "Call" class, I connect the audio media to the sound device like this: 

@Override 
public void onCallMediaState(OnCallMediaStateParam prm) { 

CallInfo info; 
try { 
info = getInfo(); 
} catch (Exception exc) { 
Log.e("Call", "onCallMediaState: error while getting call info", exc); 
return; 
} 

for (int i = 0; i < info.getMedia().size(); i++) { 
Media media = getMedia(i); 
CallMediaInfo mediaInfo = info.getMedia().get(i); 

if (mediaInfo.getType() == pjmedia_type.PJMEDIA_TYPE_AUDIO 
&& media != null 
&& mediaInfo.getStatus() == pjsua_call_media_status.PJSUA_CALL_MEDIA_ACTIVE) { 
AudioMedia audioMedia = AudioMedia.typecastFromMedia(media); 

// connect the call audio media to sound device 
try { 
AudDevManager mgr = account.getService().getAudDevManager(); 
audioMedia.startTransmit(mgr.getPlaybackDevMedia()); 
mgr.getCaptureDevMedia().startTransmit(audioMedia); 
} catch (Exception exc) { 
Log.e("Call", "Error while connecting audio media to sound device", exc); 
} 
} 
} 
} 

Could someone give some directions on how to use the master clock port in PJSUA2, like shown in the example in the FAQs? 
If this coudn't be accomplished by using PJSUA2, how can I do it by patching the 2.4.5 tag sources? 
Every advice would be helpful. 
Thank you in advance! 

Best Regards, 

Alex Gotev 
MobiMESH - VoiSmart Development Team 
Via Benigno Crespi, 57 
20159 Milano 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20160303/77d31941/attachment.html>


[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