<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Anthony,<br>
<br>
I tried your suggestions (the PCMU@30i&nbsp; 60i and omitting line 158 in
pablio.c) but none solve the problem.<br>
I also tried the latest trunk but its the same.<br>
I reached the best performance with the latest trunk and the patch
Thomas wrote.(~20ms rtp packet delta, rarely 100+ms)<br>
The only problem with it thats FS ate up 95% cpu but I am not sure if
it has to do anything with mod_portaudio or the windows timer.<br>
<br>
If I am correct we have 2 problem here. <br>
The first is windows timer isnt very accurate. <br>
The second is that mod_portaudio dont have any delay when it can return
audio data immadiately .<br>
Let me explain:<br>
<br>
1. call for channel_read_frame<br>
2. waiting for audio data (~60ms)<br>
3. got 60ms audio data<br>
4. get 20ms (remaining 40ms) audio data, return (and send rtp frame)<br>
5. call for channel_read_frame<br>
6. get 20ms, return(and send rtp frame) within ~1ms<br>
7. call for channel_read_frame<br>
8. get 20ms, return(and send rtp frame) within ~1ms<br>
go back to 1 and start again<br>
<br>
That's what I tried to solve with my patch, but because of the windows
timer it failed.<br>
I hope I could help, and dont misunderstand something.<br>
<br>
Csaba<br>
<br>
Anthony Minessale &iacute;rta:
<blockquote
 cite="mid:191c3a030805060701j1aa81ec0o66532c7ec39d30a6@mail.gmail.com"
 type="cite">I added a small patch to turn up the resolution of Sleep
to 1ms.<br>
Can you see if that helps?<br>
  <br>
  <div class="gmail_quote">On Tue, May 6, 2008 at 8:38 AM, Sluschny,
Thomas &lt;<a moz-do-not-send="true"
 href="mailto:Thomas.Sluschny@siemens.com">Thomas.Sluschny@siemens.com</a>&gt;
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>
    <div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"
 size="2">i already tried to implement such a routine, but as i
remember i had problems to compile,</font></span></div>
    <div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"
 size="2">anyway this may be help you:</font></span></div>
    <div dir="ltr" align="left"><span></span>&nbsp;</div>
    <div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"
 size="2">// sleep with smaller tick time, wait in &micro;s<br>
void betterSleep(long wait) <br>
{ <br>
&nbsp;LARGE_INTEGER lElapse;<br>
&nbsp;BOOL succ;<br>
&nbsp;HANDLE timerHandle = 0;<br>
&nbsp;DWORD dwWaitResult; </font></span></div>
    <div>&nbsp;</div>
    <div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"
 size="2">&nbsp;__try { </font></span></div>
    <div>&nbsp;</div>
    <div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"
 size="2">&nbsp;&nbsp;// return on 0<br>
&nbsp;&nbsp;if (wait &lt; 1)<br>
&nbsp;&nbsp;&nbsp;return;</font></span></div>
    <div>&nbsp;</div>
    <div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"
 size="2">&nbsp;&nbsp;// create the timer<br>
&nbsp;&nbsp;timerHandle = (HANDLE) CreateWaitableTimerA(NULL, FALSE, NULL);</font></span></div>
    <div>&nbsp;</div>
    <div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"
 size="2">&nbsp;&nbsp;// set the timer<br>
&nbsp;&nbsp;lElapse.QuadPart = 2500LL - (wait * 10000LL);<br>
&nbsp;&nbsp;succ = SetWaitableTimer(timerHandle, &amp;lElapse, 0, NULL, NULL,
FALSE);</font></span></div>
    <div>&nbsp;</div>
    <div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"
 size="2">&nbsp;&nbsp;if (!succ) {<br>
&nbsp;&nbsp;&nbsp;printf( "set timer not successful!\n" ); <br>
&nbsp;&nbsp;}</font></span></div>
    <div>&nbsp;</div>
    <div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"
 size="2">&nbsp;&nbsp;dwWaitResult = WaitForSingleObject( <br>
&nbsp;&nbsp;&nbsp;timerHandle,&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;wait&nbsp;&nbsp; // fall back timeout with 15ms granularity<br>
&nbsp;&nbsp;);</font></span></div>
    <div>&nbsp;</div>
    <div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"
 size="2">&nbsp;&nbsp;switch (dwWaitResult) <br>
&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;// The thread got mutex ownership.<br>
&nbsp;&nbsp;case WAIT_OBJECT_0: <br>
&nbsp;&nbsp;&nbsp;//printf( "WAIT_OBJECT_0!\n" );<br>
&nbsp;&nbsp;&nbsp;break; </font></span></div>
    <div>&nbsp;</div>
    <div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"
 size="2">&nbsp;&nbsp;&nbsp;// Cannot get mutex ownership due to time-out.<br>
&nbsp;&nbsp;case WAIT_TIMEOUT: <br>
&nbsp;&nbsp;&nbsp;printf( "WAIT_TIMEOUT!\n" ); <br>
&nbsp;&nbsp;&nbsp;break;</font></span></div>
    <div>&nbsp;</div>
    <div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"
 size="2">&nbsp;&nbsp;&nbsp;// Got ownership of the abandoned mutex object.<br>
&nbsp;&nbsp;case WAIT_ABANDONED: <br>
&nbsp;&nbsp;&nbsp;printf( "WAIT_ABANDONED!\n" );<br>
&nbsp;&nbsp;&nbsp;break;<br>
&nbsp;&nbsp;}<br>
&nbsp;}<br>
&nbsp;__finally { <br>
&nbsp;&nbsp;if (timerHandle) CloseHandle(timerHandle);<br>
&nbsp;} <br>
}<br>
    </font></span></div>
    <div dir="ltr" align="left"><span></span>&nbsp;</div>
    <div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"
 size="2">It may be hard work but: Its cool to be cross platform - you
reach all people around</font></span></div>
    <div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"
 size="2">we count on you ;)</font></span></div>
    <div dir="ltr" align="left"><span></span>&nbsp;</div>
    <div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"
 size="2">Thomas</font></span></div>
    <br>
    <div dir="ltr" align="left" lang="de">
    <hr><font face="Tahoma" size="2">
    <div class="Ih2E3d"><b>Von:</b> <a moz-do-not-send="true"
 href="mailto:freeswitch-users-bounces@lists.freeswitch.org"
 target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>
[mailto:<a moz-do-not-send="true"
 href="mailto:freeswitch-users-bounces@lists.freeswitch.org"
 target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] <b>Im
Auftrag von </b>Anthony Minessale<br>
    </div>
    <b>Gesendet:</b> Dienstag, 6. Mai 2008 15:08
    <div>
    <div class="Wj3C7c"><br>
    <b>An:</b> <a moz-do-not-send="true"
 href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a><br>
    <b>Betreff:</b> Re: [Freeswitch-users] mod_portaudio send 3 rtp
packet/60msinsteadof1 packet/20ms<br>
    </div>
    </div>
    </font><br>
    </div>
    <div>
    <div class="Wj3C7c">if switch_yield for windows is not working
properly maybe if we fix that the code will work as planned.<br>
    <br>
switch_timer_check tells you if the timer has ticked or not and it's
based on a single timer thread that also has the necessity to do 1ms
sleeps to broadcast the time changes to the rest of the system.&nbsp; so
let's try using performance counters to implement proper switch_yield
and see if the code begins to work as planned.&nbsp; I'll try to come up
with a patch because there are several places including the RTP code
where semi-accurate 1ms sleeps are absolutely necessary. <br>
    <br>
This is one of the many joys of being cross platform. =D<br>
    <br>
    <br>
    <br>
    <br>
    <div class="gmail_quote">On Tue, May 6, 2008 at 7:37 AM, Sluschny,
Thomas &lt;<a moz-do-not-send="true"
 href="mailto:Thomas.Sluschny@siemens.com" target="_blank">Thomas.Sluschny@siemens.com</a>&gt;
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>
      <div dir="ltr" align="left"><span><font color="#0000ff"
 face="Arial" size="2">Anthony seams to be right.</font></span></div>
      <div dir="ltr" align="left"><span><font color="#0000ff"
 face="Arial" size="2">I tested around a little bit and i see:</font></span></div>
      <div dir="ltr" align="left"><span><font color="#0000ff"
 face="Arial" size="2">- the main problem is the soundcard (-driver),
it gives 480 frames all 60 ms </font></span></div>
      <div dir="ltr" align="left"><span><font color="#0000ff"
 face="Arial" size="2">- if i chose 160 (256) frames ringbuffer size i
get only 160 frames all 60 ms, and it sounds really croppy (of course,
there are not enough samples ...)</font></span></div>
      <div dir="ltr" align="left"><span><font color="#0000ff"
 face="Arial" size="2">- i get really good results if i store the last
timestamp when </font><font face="Arial"><font color="#0000ff"><font
 size="2">ReadAudioStream<span>() returns, and if current timestamp is
less than 20ms from last i wait 20 ms,</span></font></font></font></span></div>
      <div dir="ltr" align="left"><span><font face="Arial"><font
 color="#0000ff"><font size="2"><span>so the packet difference went
from 60-0-0-60-0-0 ms to 20-20-20-20-20-20</span></font></font></font></span></div>
      <div dir="ltr" align="left"><span><font face="Arial"><font
 color="#0000ff"><font size="2"><span>- i use HighPerformanceCounter to
measure the time in WinXP</span></font></font></font></span></div>
      <div dir="ltr" align="left"><span><font face="Arial"><font
 color="#0000ff"><font size="2"><span></span></font></font></font></span>&nbsp;</div>
      <div dir="ltr" align="left"><span><font size="-0"><font size="-0"><span><font
 color="#0000ff" face="Arial" size="2">I thought we could use&nbsp;</font><font
 face="Arial"><font color="#0000ff"><font size="2">switch_core_timer_check<span>()
to do that timestamp work, but it doesn't work as expected,</span></font></font></font></span></font></font></span></div>
      <div dir="ltr" align="left"><span><font size="-0"><font size="-0"><span><font
 face="Arial"><font color="#0000ff"><font size="2"><span>seams we have
to synchronize to the 60ms clock from soundcard, at least at the
beginning, which means the delay increase.</span></font></font></font></span></font></font></span></div>
      <div dir="ltr" align="left"><span><font size="-0"><font size="-0"><span><font
 face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font></span></font></font></span>&nbsp;</div>
      <div dir="ltr" align="left"><span><font size="-0"><font size="-0"><span><font
 face="Arial"><font color="#0000ff"><font size="2"><span>Thomas</span></font></font></font></span></font></font></span></div>
      <div dir="ltr" align="left"><span><font size="-0"><font size="-0"><span><font
 face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font></span></font></font></span>&nbsp;</div>
      <div dir="ltr" align="left"><span><font size="-0"><font size="-0"><span><font
 face="Arial"><font color="#0000ff"><font size="2"><span>PS: i attach a
patch for better understanding&nbsp;</span></font></font></font></span></font></font></span></div>
      <br>
      <div dir="ltr" align="left" lang="de">
      <hr> <font face="Tahoma" size="2"><b>Von:</b> <a
 moz-do-not-send="true"
 href="mailto:freeswitch-users-bounces@lists.freeswitch.org"
 target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>
[mailto:<a moz-do-not-send="true"
 href="mailto:freeswitch-users-bounces@lists.freeswitch.org"
 target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] <b>Im
Auftrag von </b>Anthony Minessale<br>
      <b>Gesendet:</b> Dienstag, 6. Mai 2008 00:38
      <div><br>
      <b>An:</b> <a moz-do-not-send="true"
 href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a><br>
      </div>
      <b>Betreff:</b> Re: [Freeswitch-users] mod_portaudio send 3 rtp
packet/60ms insteadof1 packet/20ms<br>
      </font><br>
      </div>
      <div>
      <div> This is not normal sleep it's microsecond sleep.&nbsp; Its done
because we are doing nonblocking read on the ringbuffer that's tied to
the hardware.&nbsp; Since this is voip, we must drop audio frames when they
are late and in order to do that we must have a high resolution loop.&nbsp;
This is only a problem when the audio device is not sending audio at
the interval we asked it to.&nbsp; Some cheap hardware cannot reliably
deliver audio at 20ms intervals which is why i suggested higher value
intervals in the config.&nbsp; The request to remove the sleep is to confirm
the proposition that sleep 1ms was really taking 15ms.<br>
      <br>
I appreciate the suggestion and I understand you are not trying to be a
smart ass.<br>
      <br>
      <br>
      <br>
      <div class="gmail_quote">On Mon, May 5, 2008 at 4:35 PM, Michael
Jerris &lt;<a moz-do-not-send="true" href="mailto:mike@jerris.com"
 target="_blank">mike@jerris.com</a>&gt; wrote:<br>
      <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">The
place this is trickiest is when you are in a loop where you want<br>
to wait for audio, AND do something every x ms or so. &nbsp;You can't do a<br>
blocking read, and a read with timeout tends to be quite expensive.<br>
There are some ways around this, but sometimes its just the most<br>
efficient, even if not preferred method.<br>
        <br>
Mike<br>
        <div>
        <div><br>
        <br>
On May 5, 2008, at 5:26 PM, ?ukasz Zwierko wrote:<br>
        <br>
&gt; Hi,<br>
&gt;<br>
&gt; Just a thought here: using calls like delay(), sleep() etc. for
very<br>
&gt; short amount of time (like in this case a couple of miliseconds)<br>
&gt; should in my opinion be really discouraged. It is often a symptom
of<br>
&gt; bad programming even in an embedded enviroment, not mentioning<br>
&gt; platforms like Windows or Linux where you can't really tell what<br>
&gt; priority does your task have, and will it not be starved for a long<br>
&gt; time by other tasks. I should be avoided whenever possible.<br>
&gt; Don't want to sound like a smart ass here, but isn't there any
other<br>
&gt; way? From what I understood you wait until some &nbsp;amount of voice<br>
&gt; samples is collected? If that's the case than perhaps you can
measure<br>
&gt; an amount of data collected not the time... If these are PCM
samples<br>
&gt; than the correlation is straightforward.<br>
&gt; Again, sorry if I'm being a smart ass here but I've seen some
really<br>
&gt; bad code with sleep() calls and such like, and I can tell you that
it<br>
&gt; only worked fine in specific conditions, and had a tendency to work<br>
&gt; very poorly when for example CPU was under heavy load.<br>
&gt;<br>
&gt; Luaksz<br>
&gt;<br>
&gt; 2008/5/5 Anthony Minessale &lt;<a moz-do-not-send="true"
 href="mailto:anthony.minessale@gmail.com" target="_blank">anthony.minessale@gmail.com</a>&gt;:<br>
&gt;&gt; did you try setting the ptime on the rtp to 30 or 60ms<br>
&gt;&gt;<br>
&gt;&gt; when you choose a codec in your sip settings on FS in vars.xml,<br>
&gt;&gt; instead of<br>
&gt;&gt; PCMU try PCMU@30i or PCMU@60i<br>
&gt;&gt; it may be that the other side is doing 30 or 60 ms and not
telling<br>
&gt;&gt; us.<br>
&gt;&gt;<br>
&gt;&gt; also in pablio.c in the portaudio_mod directory in
ReadAudioStream<br>
&gt;&gt; func,<br>
&gt;&gt; there is a sleep 1 ms too<br>
&gt;&gt; if the windows is really sleeping a lot longer than that, try<br>
&gt;&gt; omitting line<br>
&gt;&gt; 158.<br>
&gt;&gt; This probably will consume the whole cpu but if it fixes your<br>
&gt;&gt; problem it<br>
&gt;&gt; will support the theory that the sleep on windows in
inaccurate.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei<br>
&gt;&gt; &lt;<a moz-do-not-send="true"
 href="mailto:csaba.zelei@gmail.com" target="_blank">csaba.zelei@gmail.com</a>&gt;
wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; With a little hack I can make mod_portaudio to send rtp
packets with<br>
&gt;&gt; ~24ms, ~16ms delay alternately on linux. This result in a
constant<br>
&gt;&gt; 4ms<br>
&gt;&gt; jitter but its better than the original. (diff attached)<br>
&gt;&gt;&gt; However on windows the delta between rtp packets is 15-32
ms<br>
&gt;&gt;&gt; randomly,<br>
&gt;&gt; with occasionally high 70-100ms delta.<br>
&gt;&gt;&gt; I also tried to tweak the windows timer without success.<br>
&gt;&gt;&gt; Does anybody has any idea how to make windows xp more
accurate?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Sluschny, Thomas wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; as you can see here:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; <a moz-do-not-send="true"
 href="http://jira.freeswitch.org/browse/MODENDP-40" target="_blank">http://jira.freeswitch.org/browse/MODENDP-40</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; i have this problem all the time (the error mentioned in
this<br>
&gt;&gt;&gt; issue was<br>
&gt;&gt; only related with this).<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; It has to do with windows handle sleep() method, you has
say<br>
&gt;&gt;&gt; sleep(1) for<br>
&gt;&gt; 1ms but on my<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; machine it waits 15ms (it depends on your hardware, other
PCs behave<br>
&gt;&gt; different!). So i tested around with high performance counters.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; For now i ignore that problem an set jitterbuffers on
other device<br>
&gt;&gt;&gt; big<br>
&gt;&gt; enough.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Thomas<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; ________________________________<br>
&gt;&gt; Von: <a moz-do-not-send="true"
 href="mailto:freeswitch-users-bounces@lists.freeswitch.org"
 target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a><br>
&gt;&gt; [mailto:<a moz-do-not-send="true"
 href="mailto:freeswitch-users-bounces@lists.freeswitch.org"
 target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] Im
Auftrag<br>
&gt;&gt; von Zelei<br>
&gt;&gt; Csaba<br>
&gt;&gt;&gt; Gesendet: Donnerstag, 24. April 2008 19:05<br>
&gt;&gt;&gt; An: <a moz-do-not-send="true"
 href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a><br>
&gt;&gt;&gt; Betreff: [Freeswitch-users] mod_portaudio send 3 rtp
packet/60ms<br>
&gt;&gt;&gt; instead<br>
&gt;&gt; of1 packet/20ms<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Dear all,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I tried to use FS in client mode, starting calls with<br>
&gt;&gt;&gt; mod_portaudio to our<br>
&gt;&gt; providers gateway ( a Cirpack softswitch )<br>
&gt;&gt;&gt; I experienced that there is 2-3 sec delay in the call, its
choppy<br>
&gt;&gt;&gt; and<br>
&gt;&gt; robot like.<br>
&gt;&gt;&gt; I tested it with a softphone, and an ip phone and
everything was<br>
&gt;&gt;&gt; fine. I<br>
&gt;&gt; traced back the problem to mod_portaudio sending 3 rtp packet
in 60ms<br>
&gt;&gt; instead of 1 packet/20ms.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Here is an rtp statistic from a call: (see<br>
&gt;&gt; <a moz-do-not-send="true"
 href="http://pastebin.freeswitch.org/4307" target="_blank">http://pastebin.freeswitch.org/4307</a>
for the complete list and sip<br>
&gt;&gt; trace)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Packet &nbsp; &nbsp;Sequence &nbsp; &nbsp;Delta (ms)<br>
&gt;&gt;&gt; 42 &nbsp;26138 &nbsp; &nbsp;0.00<br>
&gt;&gt;&gt; 43 &nbsp; &nbsp;26139 &nbsp; &nbsp;0.02<br>
&gt;&gt;&gt; 46 &nbsp; &nbsp;26140 &nbsp; &nbsp;45.69<br>
&gt;&gt;&gt; 47 &nbsp; &nbsp;26141 &nbsp; &nbsp;0.02<br>
&gt;&gt;&gt; 48 &nbsp; &nbsp;26142 &nbsp; &nbsp;2.96<br>
&gt;&gt;&gt; 52 &nbsp; &nbsp;26143 &nbsp; &nbsp;56.31<br>
&gt;&gt;&gt; 53 &nbsp; &nbsp;26144 &nbsp; &nbsp;5.75<br>
&gt;&gt;&gt; 54 &nbsp; &nbsp;26145 &nbsp; &nbsp;0.02<br>
&gt;&gt;&gt; 58 &nbsp; &nbsp;26146 &nbsp; &nbsp;51.99<br>
&gt;&gt;&gt; 59 &nbsp; &nbsp;26147 &nbsp; &nbsp;0.03<br>
&gt;&gt;&gt; 60 &nbsp; &nbsp;26148 &nbsp; &nbsp;2.96<br>
&gt;&gt;&gt; 63 &nbsp; &nbsp;26149 &nbsp; &nbsp;42.95<br>
&gt;&gt;&gt; 65 &nbsp; &nbsp;26150 &nbsp; &nbsp;17.06<br>
&gt;&gt;&gt; 66 &nbsp; &nbsp;26151 &nbsp; &nbsp;0.02<br>
&gt;&gt;&gt; 67 &nbsp; &nbsp;26152 &nbsp; &nbsp;2.90<br>
&gt;&gt;&gt; 71 &nbsp; &nbsp;26153 &nbsp; &nbsp;56.99<br>
&gt;&gt;&gt; 72 &nbsp; &nbsp;26154 &nbsp; &nbsp;0.03<br>
&gt;&gt;&gt; 73 &nbsp; &nbsp;26155 &nbsp; &nbsp;0.02<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Did anyone else experience similar problems?<br>
&gt;&gt;&gt; Is this the desired behaviour, because portaudio get data
in 60ms<br>
&gt;&gt;&gt; interval<br>
&gt;&gt; or can I set it to 20ms somehow?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Thanks,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Csaba Zelei<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; ________________________________<br>
&gt;&gt;<br>
&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt; Freeswitch-users mailing list<br>
&gt;&gt;&gt; <a moz-do-not-send="true"
 href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank">Freeswitch-users@lists.freeswitch.org</a><br>
&gt;&gt;&gt; <a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt;&gt;&gt; UNSUBSCRIBE:<a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt;&gt;&gt; <a moz-do-not-send="true" href="http://www.freeswitch.org"
 target="_blank">http://www.freeswitch.org</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Index: mod_portaudio.c<br>
&gt;&gt;&gt;
===================================================================<br>
&gt;&gt;&gt; --- mod_portaudio.c &nbsp; &nbsp; (revision 8260)<br>
&gt;&gt;&gt; +++ mod_portaudio.c &nbsp; &nbsp; (working copy)<br>
&gt;&gt;&gt; @@ -121,6 +121,7 @@<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; int ring_interval;<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; GFLAGS flags;<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; switch_timer_t timer;<br>
&gt;&gt;&gt; + &nbsp; &nbsp; &nbsp; switch_timer_t sync_timer;<br>
&gt;&gt;&gt; } globals;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; @@ -282,7 +283,15 @@<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; }<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; switch_set_flag_locked(tech_pvt, TFLAG_IO);<br>
&gt;&gt;&gt; +<br>
&gt;&gt;&gt; + &nbsp; &nbsp; &nbsp; /* Start Synchronization Timer */<br>
&gt;&gt;&gt; + &nbsp; &nbsp; &nbsp; //Is it ok to always use 20ms? What about the 160
sample????<br>
&gt;&gt;&gt; + &nbsp; &nbsp; &nbsp; if (<br>
&gt;&gt; switch_core_timer_init(&amp;globals.sync_timer,"soft",<br>
&gt;&gt; 20,160,switch_core_session_get_pool(session))<br>
&gt;&gt; != SWITCH_STATUS_SUCCESS)<br>
&gt;&gt;&gt; + &nbsp; &nbsp; &nbsp; {<br>
&gt;&gt;&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch_log_printf(SWITCH_CHANNEL_LOG,<br>
&gt;&gt;&gt; SWITCH_LOG_DEBUG,<br>
&gt;&gt; "Sync Timer failed!!\n");<br>
&gt;&gt;&gt; + &nbsp; &nbsp; &nbsp; }<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; +<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; /* Move Channel's State Machine to RING */<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; switch_channel_set_state(channel, CS_RING);<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; @@ -412,6 +421,8 @@<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; }<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; switch_log_printf(SWITCH_CHANNEL_LOG,
SWITCH_LOG_DEBUG, "%s<br>
&gt;&gt;&gt; CHANNEL<br>
&gt;&gt; HANGUP\n",<br>
&gt;&gt;
switch_channel_get_name(switch_core_session_get_channel(session)));<br>
&gt;&gt;&gt; + &nbsp; &nbsp; &nbsp; /* Destroy timer */<br>
&gt;&gt;&gt; + &nbsp; &nbsp; &nbsp; switch_core_timer_destroy(&amp;globals.sync_timer);<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; return SWITCH_STATUS_SUCCESS;<br>
&gt;&gt;&gt; }<br>
&gt;&gt;&gt; @@ -542,12 +553,17 @@<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; switch_mutex_lock(globals.device_lock);<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; get_samples:<br>
&gt;&gt;&gt; -<br>
&gt;&gt;&gt; +<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; if ((samples = ReadAudioStream(globals.audio_stream,<br>
&gt;&gt; globals.read_frame.data,<br>
&gt;&gt;&gt;<br>
&gt;&gt; globals.read_codec.implementation-&gt;samples_per_frame,<br>
&gt;&gt;&gt;<br>
&gt;&gt; &amp;globals.timer)) == 0) {<br>
&gt;&gt;&gt; +<br>
&gt;&gt;&gt; + &nbsp; &nbsp; &nbsp; //switch_log_printf(SWITCH_CHANNEL_LOG,
SWITCH_LOG_DEBUG,<br>
&gt;&gt;&gt; "No data<br>
&gt;&gt; reset timer\n");<br>
&gt;&gt;&gt; + &nbsp; &nbsp; &nbsp; switch_core_timer_sync(&amp;globals.sync_timer);<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;switch_yield(1000);<br>
&gt;&gt;&gt; +<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;goto get_samples;<br>
&gt;&gt;&gt; +<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; } else {<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; globals.read_frame.datalen = samples * 2;<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; globals.read_frame.samples = samples;<br>
&gt;&gt;&gt; @@ -562,7 +578,9 @@<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; status = SWITCH_STATUS_SUCCESS;<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; }<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; switch_mutex_unlock(globals.device_lock);<br>
&gt;&gt;&gt; -<br>
&gt;&gt;&gt; +<br>
&gt;&gt;&gt; + &nbsp; &nbsp; &nbsp; switch_core_timer_next(&amp;globals.sync_timer);<br>
&gt;&gt;&gt; +<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; return status;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; }<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt; Freeswitch-users mailing list<br>
&gt;&gt;&gt; <a moz-do-not-send="true"
 href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank">Freeswitch-users@lists.freeswitch.org</a><br>
&gt;&gt;&gt; <a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt;&gt;&gt; UNSUBSCRIBE:<a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt;&gt;&gt; <a moz-do-not-send="true" href="http://www.freeswitch.org"
 target="_blank">http://www.freeswitch.org</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Anthony Minessale II<br>
&gt;&gt;<br>
&gt;&gt; FreeSWITCH <a moz-do-not-send="true"
 href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org/</a><br>
&gt;&gt; ClueCon <a moz-do-not-send="true"
 href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>
&gt;&gt;<br>
&gt;&gt; AIM: anthm<br>
&gt;&gt; <a moz-do-not-send="true"
 href="mailto:MSN%3Aanthony_minessale@hotmail.com" target="_blank">MSN:anthony_minessale@hotmail.com</a><br>
&gt;&gt; GTALK/JABBER/<a moz-do-not-send="true"
 href="mailto:PAYPAL%3Aanthony.minessale@gmail.com" target="_blank">PAYPAL:anthony.minessale@gmail.com</a><br>
&gt;&gt; IRC: <a moz-do-not-send="true" href="http://irc.freenode.net"
 target="_blank">irc.freenode.net</a> #freeswitch<br>
&gt;&gt;<br>
&gt;&gt; FreeSWITCH Developer Conference<br>
&gt;&gt; <a moz-do-not-send="true"
 href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a><br>
&gt;&gt; <a moz-do-not-send="true"
 href="http://iax:guest@conference.freeswitch.org/888" target="_blank">iax:guest@conference.freeswitch.org/888</a><br>
&gt;&gt; <a moz-do-not-send="true"
 href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org"
 target="_blank">googletalk:conf+888@conference.freeswitch.org</a><br>
&gt;&gt; pstn:213-799-1400<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Freeswitch-users mailing list<br>
&gt;&gt; <a moz-do-not-send="true"
 href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank">Freeswitch-users@lists.freeswitch.org</a><br>
&gt;&gt; <a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt;&gt; UNSUBSCRIBE:<a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt;&gt; <a moz-do-not-send="true" href="http://www.freeswitch.org"
 target="_blank">http://www.freeswitch.org</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Freeswitch-users mailing list<br>
&gt; <a moz-do-not-send="true"
 href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank">Freeswitch-users@lists.freeswitch.org</a><br>
&gt; <a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt; UNSUBSCRIBE:<a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt; <a moz-do-not-send="true" href="http://www.freeswitch.org"
 target="_blank">http://www.freeswitch.org</a><br>
        <br>
        <br>
_______________________________________________<br>
Freeswitch-users mailing list<br>
        <a moz-do-not-send="true"
 href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank">Freeswitch-users@lists.freeswitch.org</a><br>
        <a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
        <a moz-do-not-send="true" href="http://www.freeswitch.org"
 target="_blank">http://www.freeswitch.org</a><br>
        </div>
        </div>
      </blockquote>
      </div>
      <br>
      <br clear="all">
      <br>
-- <br>
Anthony Minessale II<br>
      <br>
FreeSWITCH <a moz-do-not-send="true" href="http://www.freeswitch.org/"
 target="_blank">http://www.freeswitch.org/</a><br>
ClueCon <a moz-do-not-send="true" href="http://www.cluecon.com/"
 target="_blank">http://www.cluecon.com/</a><br>
      <br>
AIM: anthm<br>
      <a moz-do-not-send="true"
 href="mailto:MSN%3Aanthony_minessale@hotmail.com" target="_blank">MSN:anthony_minessale@hotmail.com</a><br>
GTALK/JABBER/<a moz-do-not-send="true"
 href="mailto:PAYPAL%3Aanthony.minessale@gmail.com" target="_blank">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a moz-do-not-send="true" href="http://irc.freenode.net"
 target="_blank">irc.freenode.net</a> #freeswitch<br>
      <br>
FreeSWITCH Developer Conference<br>
      <a moz-do-not-send="true"
 href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a><br>
      <a moz-do-not-send="true"
 href="http://iax:guest@conference.freeswitch.org/888" target="_blank">iax:guest@conference.freeswitch.org/888</a><br>
      <a moz-do-not-send="true"
 href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org"
 target="_blank">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:213-799-1400 </div>
      </div>
      </div>
      <br>
_______________________________________________<br>
Freeswitch-users mailing list<br>
      <a moz-do-not-send="true"
 href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank">Freeswitch-users@lists.freeswitch.org</a><br>
      <a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
      <a moz-do-not-send="true" 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 moz-do-not-send="true" href="http://www.freeswitch.org/"
 target="_blank">http://www.freeswitch.org/</a><br>
ClueCon <a moz-do-not-send="true" href="http://www.cluecon.com/"
 target="_blank">http://www.cluecon.com/</a><br>
    <br>
AIM: anthm<br>
    <a moz-do-not-send="true"
 href="mailto:MSN%3Aanthony_minessale@hotmail.com" target="_blank">MSN:anthony_minessale@hotmail.com</a><br>
GTALK/JABBER/<a moz-do-not-send="true"
 href="mailto:PAYPAL%3Aanthony.minessale@gmail.com" target="_blank">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a moz-do-not-send="true" href="http://irc.freenode.net"
 target="_blank">irc.freenode.net</a> #freeswitch<br>
    <br>
FreeSWITCH Developer Conference<br>
    <a moz-do-not-send="true"
 href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a><br>
    <a moz-do-not-send="true"
 href="http://iax:guest@conference.freeswitch.org/888" target="_blank">iax:guest@conference.freeswitch.org/888</a><br>
    <a moz-do-not-send="true"
 href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org"
 target="_blank">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:213-799-1400 </div>
    </div>
    </div>
    <br>
_______________________________________________<br>
Freeswitch-users mailing list<br>
    <a moz-do-not-send="true"
 href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
    <a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
    <a moz-do-not-send="true" 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 moz-do-not-send="true" href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>
ClueCon <a moz-do-not-send="true" href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
  <br>
AIM: anthm<br>
  <a moz-do-not-send="true"
 href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>
GTALK/JABBER/<a moz-do-not-send="true"
 href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a moz-do-not-send="true" href="http://irc.freenode.net">irc.freenode.net</a>
#freeswitch<br>
  <br>
FreeSWITCH Developer Conference<br>
  <a moz-do-not-send="true"
 href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br>
  <a moz-do-not-send="true"
 href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br>
  <a moz-do-not-send="true"
 href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:213-799-1400
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Freeswitch-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
  </pre>
</blockquote>
<br>
</body>
</html>