did you try setting the ptime on the rtp to 30 or 60ms<br><br>when you choose a codec in your sip settings on FS in vars.xml, instead of PCMU try PCMU@30i or PCMU@60i<br>it may be that the other side is doing 30 or 60 ms and not telling us.<br>
<br>also in pablio.c in the portaudio_mod directory in ReadAudioStream func, there is a sleep 1 ms too<br>if the windows is really sleeping a lot longer than that, try omitting line 158.<br>This probably will consume the whole cpu but if it fixes your problem it will support the theory that the sleep on windows in inaccurate.<br>
<br><br><br><div class="gmail_quote">On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei <<a href="mailto:csaba.zelei@gmail.com">csaba.zelei@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">
With a little hack I can make mod_portaudio to send rtp packets with
~24ms, ~16ms delay alternately on linux. This result in a constant 4ms
jitter but its better than the original. (diff attached)<br>
However on windows the delta between rtp packets is 15-32 ms randomly,
with occasionally high 70-100ms delta.<br>
I also tried to tweak the windows timer without success.<br>
Does anybody has any idea how to make windows xp more accurate?<br>
<br>
Sluschny, Thomas wrote:
<blockquote type="cite"><div><div></div><div class="Wj3C7c">
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">as you can see here:</font></span></div>
<div dir="ltr" align="left"><span><font size="2">
</font>
<p><a href="http://jira.freeswitch.org/browse/MODENDP-40" target="_blank"><u><font color="#0000ff" size="2">http://jira.freeswitch.org/browse/MODENDP-40</font></u></a></p>
<p><span><font color="#0000ff" face="Arial" size="2">i have this problem all the time (the error mentioned in this
issue was only related with this).</font></span></p>
<p><span><font color="#0000ff" face="Arial" size="2">It has to do with windows handle sleep() method, you has say
sleep(1) for 1ms but on my</font></span></p>
<p><span><font color="#0000ff" face="Arial" size="2">machine it waits 15ms (it depends on your hardware, other PCs
behave different!). So i tested around with high performance counters.</font></span></p>
<p><span><font color="#0000ff" face="Arial" size="2">For now i ignore that problem an set jitterbuffers on other
device big enough.</font></span></p>
<p><span><font color="#0000ff" face="Arial" size="2">Thomas</font></span></p>
</span></div>
<br>
<div dir="ltr" align="left" lang="de">
<hr><font face="Tahoma" size="2"><b>Von:</b>
<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>
[<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">mailto:freeswitch-users-bounces@lists.freeswitch.org</a>] <b>Im Auftrag
von </b>Zelei Csaba<br>
<b>Gesendet:</b> Donnerstag, 24. April 2008 19:05<br>
<b>An:</b> <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a><br>
<b>Betreff:</b> [Freeswitch-users] mod_portaudio send 3 rtp
packet/60ms instead of1 packet/20ms<br>
</font><br>
</div>
Dear all,<br>
<br>
I tried to use FS in client mode, starting calls with mod_portaudio to
our providers gateway ( a Cirpack softswitch )<br>
I experienced that there is 2-3 sec delay in the call, its choppy and
robot like.<br>
I tested it with a softphone, and an ip phone and everything was fine.
I traced back the problem to mod_portaudio sending 3 rtp packet in 60ms
instead of 1 packet/20ms.<br>
<br>
Here is an rtp statistic from a call: (see <a href="http://pastebin.freeswitch.org/4307" target="_blank">http://pastebin.freeswitch.org/4307</a>
for the complete list and sip trace)<br>
<br>
Packet Sequence Delta (ms) <br>
42 26138 0.00 <br>
43 26139 0.02 <br>
46 26140 45.69<br>
47 26141 0.02 <br>
48 26142 2.96 <br>
52 26143 56.31<br>
53 26144 5.75 <br>
54 26145 0.02 <br>
58 26146 51.99<br>
59 26147 0.03 <br>
60 26148 2.96 <br>
63 26149 42.95<br>
65 26150 17.06<br>
66 26151 0.02 <br>
67 26152 2.90 <br>
71 26153 56.99<br>
72 26154 0.03 <br>
73 26155 0.02 <br>
<br>
Did anyone else experience similar problems?<br>
Is this the desired behaviour, because portaudio get data in 60ms
interval or can I set it to 20ms somehow?<br>
<br>
Thanks,<br>
<br>
Csaba Zelei<br>
<br>
<br>
</div></div><pre><hr size="4" width="90%">
_______________________________________________
Freeswitch-users mailing list
<a href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank">Freeswitch-users@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
</pre>
</blockquote>
<br>
</div>
<br>Index: mod_portaudio.c<br>
===================================================================<br>
--- mod_portaudio.c (revision 8260)<br>
+++ mod_portaudio.c (working copy)<br>
@@ -121,6 +121,7 @@<br>
int ring_interval;<br>
GFLAGS flags;<br>
switch_timer_t timer;<br>
+ switch_timer_t sync_timer;<br>
} globals;<br>
<br>
<br>
@@ -282,7 +283,15 @@<br>
}<br>
<br>
switch_set_flag_locked(tech_pvt, TFLAG_IO);<br>
+<br>
+ /* Start Synchronization Timer */<br>
+ //Is it ok to always use 20ms? What about the 160 sample????<br>
+ if ( switch_core_timer_init(&globals.sync_timer,"soft",20,160,switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS)<br>
+ {<br>
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sync Timer failed!!\n");<br>
+ }<br>
<br>
+<br>
/* Move Channel's State Machine to RING */<br>
switch_channel_set_state(channel, CS_RING);<br>
<br>
@@ -412,6 +421,8 @@<br>
}<br>
<br>
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(switch_core_session_get_channel(session)));<br>
+ /* Destroy timer */<br>
+ switch_core_timer_destroy(&globals.sync_timer);<br>
<br>
return SWITCH_STATUS_SUCCESS;<br>
}<br>
@@ -542,12 +553,17 @@<br>
switch_mutex_lock(globals.device_lock);<br>
<br>
get_samples:<br>
-<br>
+<br>
if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,<br>
globals.read_codec.implementation->samples_per_frame,<br>
&globals.timer)) == 0) {<br>
+<br>
+ //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No data reset timer\n");<br>
+ switch_core_timer_sync(&globals.sync_timer);<br>
switch_yield(1000);<br>
+<br>
goto get_samples;<br>
+<br>
} else {<br>
globals.read_frame.datalen = samples * 2;<br>
globals.read_frame.samples = samples;<br>
@@ -562,7 +578,9 @@<br>
status = SWITCH_STATUS_SUCCESS;<br>
}<br>
switch_mutex_unlock(globals.device_lock);<br>
-<br>
+<br>
+ switch_core_timer_next(&globals.sync_timer);<br>
+<br>
return status;<br>
}<br>
<br>
<br>_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
<br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:213-799-1400