<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3314" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=377450608-07052008><FONT face=Arial
color=#0000ff size=2>Hi Anthony,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=377450608-07052008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=377450608-07052008><FONT face=Arial
color=#0000ff size=2>i also tested your patch with no
success.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=377450608-07052008><FONT face=Arial
color=#0000ff size=2>As i already described below, the problem with all 60ms 3
packets comes from the soundcard.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=377450608-07052008><FONT face=Arial
color=#0000ff size=2>The hardware delivers its samples all 60
ms.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=377450608-07052008><FONT face=Arial
color=#0000ff size=2>Our problem is (like <FONT face="Times New Roman"
size=3>Csaba said</FONT>) that we read out the buffer after 60ms, 3 times, each
with samples for 20ms, AND WITH NO DELAY!</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=377450608-07052008><FONT face=Arial
color=#0000ff size=2>So we get: 60ms wait and 3 RTP packets within <1ms to
send, and after that we already wait 60 ms for the next
samples.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=377450608-07052008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=377450608-07052008><FONT face=Arial
color=#0000ff size=2>In my patch i wait appr.20 ms if last method call was no
longer than 4ms ago,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=377450608-07052008><FONT face=Arial
color=#0000ff size=2>but i think we can do better with
switch_core_timer_check<SPAN>() method, but i don't know exactly
how.</SPAN></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=377450608-07052008><FONT face=Arial
color=#0000ff size=2><SPAN></SPAN></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=377450608-07052008><FONT face=Arial
color=#0000ff size=2><SPAN>You are absolutly right with your demand for a better
timing resolution under Windows,</SPAN></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=377450608-07052008><FONT face=Arial
color=#0000ff size=2><SPAN>but this 60ms mystery is caused by the
soundcard.</SPAN></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=377450608-07052008><FONT face=Arial
color=#0000ff size=2><SPAN></SPAN></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=377450608-07052008><FONT face=Arial
color=#0000ff size=2><SPAN>Thomas</SPAN></FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=de dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>Von:</B>
freeswitch-users-bounces@lists.freeswitch.org
[mailto:freeswitch-users-bounces@lists.freeswitch.org] <B>Im Auftrag von
</B>Zelei Csaba<BR><B>Gesendet:</B> Dienstag, 6. Mai 2008 20:22<BR><B>An:</B>
freeswitch-users@lists.freeswitch.org<BR><B>Betreff:</B> Re: [Freeswitch-users]
mod_portaudio send 3 rtppacket/60msinsteadof1 packet/20ms<BR></FONT><BR></DIV>
<DIV></DIV>Yes, but it didnt help with portaudio (just together with the
patch)<BR>What else do you need to test it with? Please tell me, and i will do
it for you tomorrow.<BR>I also found a test code for timeBeginPeriod on this
site: <A
href="http://www.geisswerks.com/ryan/FAQS/timing.html">http://www.geisswerks.com/ryan/FAQS/timing.html</A>
and experienced that sleep(1) is usually 2 ms long (sometimes 4)<BR><BR><BR>
<DIV class=gmail_quote>2008/5/6 Anthony Minessale <<A
href="mailto:anthony.minessale@gmail.com">anthony.minessale@gmail.com</A>>:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Did
you try the trunk with no pathc since my latest email r8269? I added
code that makes the windows timer accurate to 1ms precision. If the
windows timer must be made accurate or many other things in FS will not work
right.
<DIV>
<DIV></DIV>
<DIV class=Wj3C7c><BR><BR><BR>
<DIV class=gmail_quote>On Tue, May 6, 2008 at 10:59 AM, Csaba Zelei <<A
href="mailto:csaba.zelei@gmail.com"
target=_blank>csaba.zelei@gmail.com</A>> wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV text="#000000" bgcolor="#ffffff">Hi Anthony,<BR><BR>I tried your
suggestions (the PCMU@30i 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 írta:
<DIV>
<DIV></DIV>
<DIV>
<BLOCKQUOTE 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
<<A href="mailto:Thomas.Sluschny@siemens.com"
target=_blank>Thomas.Sluschny@siemens.com</A>> wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff 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 face=Arial color=#0000ff
size=2>anyway this may be help you:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>//
sleep with smaller tick time, wait in µs<BR>void betterSleep(long wait)
<BR>{ <BR> LARGE_INTEGER lElapse;<BR> BOOL
succ;<BR> HANDLE timerHandle = 0;<BR> DWORD dwWaitResult;
</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2> __try { </FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2> // return on 0<BR> if (wait <
1)<BR> return;</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2> // create the timer<BR> timerHandle =
(HANDLE) CreateWaitableTimerA(NULL, FALSE, NULL);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2> // set the timer<BR> lElapse.QuadPart =
2500LL - (wait * 10000LL);<BR> succ =
SetWaitableTimer(timerHandle, &lElapse, 0, NULL, NULL,
FALSE);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2> if (!succ) {<BR> printf( "set timer
not successful!\n" ); <BR> }</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2> dwWaitResult = WaitForSingleObject(
<BR> timerHandle,
<BR> wait // fall back timeout with 15ms
granularity<BR> );</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2> switch (dwWaitResult)
<BR> {<BR> // The thread got mutex
ownership.<BR> case WAIT_OBJECT_0:
<BR> //printf( "WAIT_OBJECT_0!\n"
);<BR> break; </FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2> // Cannot get mutex ownership due to
time-out.<BR> case WAIT_TIMEOUT:
<BR> printf( "WAIT_TIMEOUT!\n" );
<BR> break;</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2> // Got ownership of the abandoned mutex
object.<BR> case WAIT_ABANDONED:
<BR> printf( "WAIT_ABANDONED!\n"
);<BR> break;<BR> }<BR> }<BR> __finally
{ <BR> if (timerHandle) CloseHandle(timerHandle);<BR> }
<BR>}<BR></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff 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 face=Arial color=#0000ff size=2>we
count on you ;)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2>Thomas</FONT></SPAN></DIV><BR>
<DIV lang=de dir=ltr align=left>
<HR>
<FONT face=Tahoma size=2>
<DIV><B>Von:</B> <A
href="mailto:freeswitch-users-bounces@lists.freeswitch.org"
target=_blank>freeswitch-users-bounces@lists.freeswitch.org</A>
[mailto:<A 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><BR><B>An:</B> <A
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>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. so let's try using performance
counters to implement proper switch_yield and see if the code begins to
work as planned. 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
<<A href="mailto:Thomas.Sluschny@siemens.com"
target=_blank>Thomas.Sluschny@siemens.com</A>> wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2>Anthony seams to be right.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>I
tested around a little bit and i see:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff 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 face=Arial color=#0000ff 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 face=Arial color=#0000ff 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> </DIV>
<DIV dir=ltr align=left><SPAN><FONT size=+0><FONT size=+0><SPAN><FONT
face=Arial color=#0000ff size=2>I thought we could
use </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> </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> </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 </SPAN></FONT></FONT></FONT></SPAN></FONT></FONT></SPAN></DIV><BR>
<DIV lang=de dir=ltr align=left>
<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>
[mailto:<A 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
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. Its done
because we are doing nonblocking read on the ringbuffer that's tied to
the hardware. 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. This is only a problem when the audio device is not
sending audio at the interval we asked it to. Some cheap
hardware cannot reliably deliver audio at 20ms intervals which is why
i suggested higher value intervals in the config. 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
<<A href="mailto:mike@jerris.com"
target=_blank>mike@jerris.com</A>> wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">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.
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>> Hi,<BR>><BR>> Just a thought here: using
calls like delay(), sleep() etc. for very<BR>> short amount of
time (like in this case a couple of miliseconds)<BR>> should in
my opinion be really discouraged. It is often a symptom of<BR>>
bad programming even in an embedded enviroment, not
mentioning<BR>> platforms like Windows or Linux where you can't
really tell what<BR>> priority does your task have, and will it
not be starved for a long<BR>> time by other tasks. I should be
avoided whenever possible.<BR>> Don't want to sound like a smart
ass here, but isn't there any other<BR>> way? From what I
understood you wait until some amount of voice<BR>> samples
is collected? If that's the case than perhaps you can
measure<BR>> an amount of data collected not the time... If these
are PCM samples<BR>> than the correlation is
straightforward.<BR>> Again, sorry if I'm being a smart ass here
but I've seen some really<BR>> bad code with sleep() calls and
such like, and I can tell you that it<BR>> only worked fine in
specific conditions, and had a tendency to work<BR>> very poorly
when for example CPU was under heavy load.<BR>><BR>>
Luaksz<BR>><BR>> 2008/5/5 Anthony Minessale <<A
href="mailto:anthony.minessale@gmail.com"
target=_blank>anthony.minessale@gmail.com</A>>:<BR>>> 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,<BR>>> instead of<BR>>> PCMU
try PCMU@30i or PCMU@60i<BR>>> it may be that the other side
is doing 30 or 60 ms and not telling<BR>>>
us.<BR>>><BR>>> also in pablio.c in the portaudio_mod
directory in ReadAudioStream<BR>>> func,<BR>>> there is
a sleep 1 ms too<BR>>> if the windows is really sleeping a lot
longer than that, try<BR>>> omitting line<BR>>>
158.<BR>>> This probably will consume the whole cpu but if it
fixes your<BR>>> problem it<BR>>> will support the
theory that the sleep on windows in
inaccurate.<BR>>><BR>>><BR>>><BR>>><BR>>><BR>>>
On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei<BR>>> <<A
href="mailto:csaba.zelei@gmail.com"
target=_blank>csaba.zelei@gmail.com</A>>
wrote:<BR>>>><BR>>>><BR>>>><BR>>>><BR>>>>
With a little hack I can make mod_portaudio to send rtp packets
with<BR>>> ~24ms, ~16ms delay alternately on linux. This
result in a constant<BR>>> 4ms<BR>>> jitter but its
better than the original. (diff attached)<BR>>>> However on
windows the delta between rtp packets is 15-32 ms<BR>>>>
randomly,<BR>>> 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:<BR>>>><BR>>>><BR>>>><BR>>>><BR>>>>
as you can see here:<BR>>>><BR>>>><BR>>>>
<A href="http://jira.freeswitch.org/browse/MODENDP-40"
target=_blank>http://jira.freeswitch.org/browse/MODENDP-40</A><BR>>>><BR>>>>
i have this problem all the time (the error mentioned in
this<BR>>>> issue was<BR>>> only related with
this).<BR>>>><BR>>>> It has to do with windows
handle sleep() method, you has say<BR>>>> sleep(1)
for<BR>>> 1ms but on my<BR>>>><BR>>>>
machine it waits 15ms (it depends on your hardware, other PCs
behave<BR>>> different!). So i tested around with high
performance counters.<BR>>>><BR>>>> For now i
ignore that problem an set jitterbuffers on other
device<BR>>>> big<BR>>>
enough.<BR>>>><BR>>>>
Thomas<BR>>>><BR>>>>
________________________________<BR>>> Von: <A
href="mailto:freeswitch-users-bounces@lists.freeswitch.org"
target=_blank>freeswitch-users-bounces@lists.freeswitch.org</A><BR>>>
[mailto:<A
href="mailto:freeswitch-users-bounces@lists.freeswitch.org"
target=_blank>freeswitch-users-bounces@lists.freeswitch.org</A>] Im
Auftrag<BR>>> von Zelei<BR>>> Csaba<BR>>>>
Gesendet: Donnerstag, 24. April 2008 19:05<BR>>>> An: <A
href="mailto:freeswitch-users@lists.freeswitch.org"
target=_blank>freeswitch-users@lists.freeswitch.org</A><BR>>>>
Betreff: [Freeswitch-users] mod_portaudio send 3 rtp
packet/60ms<BR>>>> instead<BR>>> of1
packet/20ms<BR>>>><BR>>>> Dear
all,<BR>>>><BR>>>> I tried to use FS in client
mode, starting calls with<BR>>>> mod_portaudio to
our<BR>>> providers gateway ( a Cirpack softswitch
)<BR>>>> I experienced that there is 2-3 sec delay in the
call, its choppy<BR>>>> and<BR>>> robot
like.<BR>>>> I tested it with a softphone, and an ip phone
and everything was<BR>>>> fine. I<BR>>> traced back
the problem to mod_portaudio sending 3 rtp packet in
60ms<BR>>> instead of 1
packet/20ms.<BR>>>><BR>>>> Here is an rtp
statistic from a call: (see<BR>>> <A
href="http://pastebin.freeswitch.org/4307"
target=_blank>http://pastebin.freeswitch.org/4307</A> for the
complete list and sip<BR>>>
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<BR>>>>
interval<BR>>> or can I set it to 20ms
somehow?<BR>>>><BR>>>>
Thanks,<BR>>>><BR>>>> Csaba
Zelei<BR>>>><BR>>>><BR>>>>
________________________________<BR>>><BR>>>>
_______________________________________________<BR>>>>
Freeswitch-users mailing list<BR>>>> <A
href="mailto:Freeswitch-users@lists.freeswitch.org"
target=_blank>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>>>><BR>>>><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 (<BR>>>
switch_core_timer_init(&globals.sync_timer,"soft",<BR>>>
20,160,switch_core_session_get_pool(session))<BR>>> !=
SWITCH_STATUS_SUCCESS)<BR>>>> +
{<BR>>>> +
switch_log_printf(SWITCH_CHANNEL_LOG,<BR>>>>
SWITCH_LOG_DEBUG,<BR>>> "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<BR>>>> CHANNEL<BR>>> HANGUP\n",<BR>>>
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,<BR>>>
globals.read_frame.data,<BR>>>><BR>>>
globals.read_codec.implementation->samples_per_frame,<BR>>>><BR>>>
&globals.timer)) == 0) {<BR>>>> +<BR>>>> +
//switch_log_printf(SWITCH_CHANNEL_LOG,
SWITCH_LOG_DEBUG,<BR>>>> "No data<BR>>> 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>>>>
_______________________________________________<BR>>>>
Freeswitch-users mailing list<BR>>>> <A
href="mailto:Freeswitch-users@lists.freeswitch.org"
target=_blank>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>>>><BR>>><BR>>><BR>>><BR>>>
--<BR>>> Anthony Minessale II<BR>>><BR>>>
FreeSWITCH <A href="http://www.freeswitch.org/"
target=_blank>http://www.freeswitch.org/</A><BR>>> ClueCon <A
href="http://www.cluecon.com/"
target=_blank>http://www.cluecon.com/</A><BR>>><BR>>>
AIM: anthm<BR>>> <A
href="mailto:MSN%3Aanthony_minessale@hotmail.com"
target=_blank>MSN:anthony_minessale@hotmail.com</A><BR>>>
GTALK/JABBER/<A href="mailto:PAYPAL%3Aanthony.minessale@gmail.com"
target=_blank>PAYPAL:anthony.minessale@gmail.com</A><BR>>>
IRC: <A href="http://irc.freenode.net"
target=_blank>irc.freenode.net</A>
#freeswitch<BR>>><BR>>> FreeSWITCH Developer
Conference<BR>>> <A
href="mailto:sip%3A888@conference.freeswitch.org"
target=_blank>sip:888@conference.freeswitch.org</A><BR>>> <A
href="http://iax:guest@conference.freeswitch.org/888"
target=_blank>iax:guest@conference.freeswitch.org/888</A><BR>>>
<A href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org"
target=_blank>googletalk:conf+888@conference.freeswitch.org</A><BR>>>
pstn:213-799-1400<BR>>>
_______________________________________________<BR>>>
Freeswitch-users mailing list<BR>>> <A
href="mailto:Freeswitch-users@lists.freeswitch.org"
target=_blank>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>>><BR>><BR>>
_______________________________________________<BR>>
Freeswitch-users mailing list<BR>> <A
href="mailto:Freeswitch-users@lists.freeswitch.org"
target=_blank>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><BR>_______________________________________________<BR>Freeswitch-users
mailing list<BR><A
href="mailto:Freeswitch-users@lists.freeswitch.org"
target=_blank>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></DIV></DIV></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR>Anthony Minessale II<BR><BR>FreeSWITCH <A
href="http://www.freeswitch.org/"
target=_blank>http://www.freeswitch.org/</A><BR>ClueCon <A
href="http://www.cluecon.com/"
target=_blank>http://www.cluecon.com/</A><BR><BR>AIM: anthm<BR><A
href="mailto:MSN%3Aanthony_minessale@hotmail.com"
target=_blank>MSN:anthony_minessale@hotmail.com</A><BR>GTALK/JABBER/<A
href="mailto:PAYPAL%3Aanthony.minessale@gmail.com"
target=_blank>PAYPAL:anthony.minessale@gmail.com</A><BR>IRC: <A
href="http://irc.freenode.net" target=_blank>irc.freenode.net</A>
#freeswitch<BR><BR>FreeSWITCH Developer Conference<BR><A
href="mailto:sip%3A888@conference.freeswitch.org"
target=_blank>sip:888@conference.freeswitch.org</A><BR><A
href="http://iax:guest@conference.freeswitch.org/888"
target=_blank>iax:guest@conference.freeswitch.org/888</A><BR><A
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 href="mailto:Freeswitch-users@lists.freeswitch.org"
target=_blank>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/"
target=_blank>http://www.freeswitch.org/</A><BR>ClueCon <A
href="http://www.cluecon.com/"
target=_blank>http://www.cluecon.com/</A><BR><BR>AIM: anthm<BR><A
href="mailto:MSN%3Aanthony_minessale@hotmail.com"
target=_blank>MSN:anthony_minessale@hotmail.com</A><BR>GTALK/JABBER/<A
href="mailto:PAYPAL%3Aanthony.minessale@gmail.com"
target=_blank>PAYPAL:anthony.minessale@gmail.com</A><BR>IRC: <A
href="http://irc.freenode.net" target=_blank>irc.freenode.net</A>
#freeswitch<BR><BR>FreeSWITCH Developer Conference<BR><A
href="mailto:sip%3A888@conference.freeswitch.org"
target=_blank>sip:888@conference.freeswitch.org</A><BR><A
href="http://iax:guest@conference.freeswitch.org/888"
target=_blank>iax:guest@conference.freeswitch.org/888</A><BR><A
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 href="mailto:Freeswitch-users@lists.freeswitch.org"
target=_blank>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/"
target=_blank>http://www.freeswitch.org/</A><BR>ClueCon <A
href="http://www.cluecon.com/"
target=_blank>http://www.cluecon.com/</A><BR><BR>AIM: anthm<BR><A
href="mailto:MSN%3Aanthony_minessale@hotmail.com"
target=_blank>MSN:anthony_minessale@hotmail.com</A><BR>GTALK/JABBER/<A
href="mailto:PAYPAL%3Aanthony.minessale@gmail.com"
target=_blank>PAYPAL:anthony.minessale@gmail.com</A><BR>IRC: <A
href="http://irc.freenode.net" target=_blank>irc.freenode.net</A>
#freeswitch<BR><BR>FreeSWITCH Developer Conference<BR><A
href="mailto:sip%3A888@conference.freeswitch.org"
target=_blank>sip:888@conference.freeswitch.org</A><BR><A
href="http://iax:guest@conference.freeswitch.org/888"
target=_blank>iax:guest@conference.freeswitch.org/888</A><BR><A
href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org"
target=_blank>googletalk:conf+888@conference.freeswitch.org</A><BR>pstn:213-799-1400
<PRE><HR width="90%" SIZE=4>
_______________________________________________
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></DIV></DIV><BR>_______________________________________________<BR>Freeswitch-users
mailing list<BR><A href="mailto:Freeswitch-users@lists.freeswitch.org"
target=_blank>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/"
target=_blank>http://www.freeswitch.org/</A><BR>ClueCon <A
href="http://www.cluecon.com/"
target=_blank>http://www.cluecon.com/</A><BR><BR>AIM: anthm<BR><A
href="mailto:MSN%3Aanthony_minessale@hotmail.com"
target=_blank>MSN:anthony_minessale@hotmail.com</A><BR>GTALK/JABBER/<A
href="mailto:PAYPAL%3Aanthony.minessale@gmail.com"
target=_blank>PAYPAL:anthony.minessale@gmail.com</A><BR>IRC: <A
href="http://irc.freenode.net" target=_blank>irc.freenode.net</A>
#freeswitch<BR><BR>FreeSWITCH Developer Conference<BR><A
href="mailto:sip%3A888@conference.freeswitch.org"
target=_blank>sip:888@conference.freeswitch.org</A><BR><A
href="http://iax:guest@conference.freeswitch.org/888"
target=_blank>iax:guest@conference.freeswitch.org/888</A><BR><A
href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org"
target=_blank>googletalk:conf+888@conference.freeswitch.org</A><BR>pstn:213-799-1400
</DIV></DIV><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></BODY></HTML>