mod_portaudio send 3 rtp packet/60ms instead of 1 packet/20ms
Dear all, I tried to use FS in client mode, starting calls with mod_portaudio to our providers gateway ( a Cirpack softswitch ) I experienced that there is 2-3 sec delay in the call, its choppy and robot like. 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. Here is an rtp statistic from a call: (see http://pastebin.freeswitch.org/4307 for the complete list and sip trace) Packet Sequence Delta (ms) 42 26138 0.00 43 26139 0.02 46 26140 45.69 47 26141 0.02 48 26142 2.96 52 26143 56.31 53 26144 5.75 54 26145 0.02 58 26146 51.99 59 26147 0.03 60 26148 2.96 63 26149 42.95 65 26150 17.06 66 26151 0.02 67 26152 2.90 71 26153 56.99 72 26154 0.03 73 26155 0.02 Did anyone else experience similar problems? Is this the desired behaviour, because portaudio get data in 60ms interval or can I set it to 20ms somehow? Thanks, Csaba Zelei
as you can see here: http://jira.freeswitch.org/browse/MODENDP-40 <http://jira.freeswitch.org/browse/MODENDP-40> i have this problem all the time (the error mentioned in this issue was only related with this). It has to do with windows handle sleep() method, you has say sleep(1) for 1ms but on my machine it waits 15ms (it depends on your hardware, other PCs behave different!). So i tested around with high performance counters. For now i ignore that problem an set jitterbuffers on other device big enough. Thomas ________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Zelei Csaba Gesendet: Donnerstag, 24. April 2008 19:05 An: freeswitch-users@lists.freeswitch.org Betreff: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms instead of1 packet/20ms Dear all, I tried to use FS in client mode, starting calls with mod_portaudio to our providers gateway ( a Cirpack softswitch ) I experienced that there is 2-3 sec delay in the call, its choppy and robot like. 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. Here is an rtp statistic from a call: (see http://pastebin.freeswitch.org/4307 for the complete list and sip trace) Packet Sequence Delta (ms) 42 26138 0.00 43 26139 0.02 46 26140 45.69 47 26141 0.02 48 26142 2.96 52 26143 56.31 53 26144 5.75 54 26145 0.02 58 26146 51.99 59 26147 0.03 60 26148 2.96 63 26149 42.95 65 26150 17.06 66 26151 0.02 67 26152 2.90 71 26153 56.99 72 26154 0.03 73 26155 0.02 Did anyone else experience similar problems? Is this the desired behaviour, because portaudio get data in 60ms interval or can I set it to 20ms somehow? Thanks, Csaba Zelei
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) However on windows the delta between rtp packets is 15-32 ms randomly, with occasionally high 70-100ms delta. I also tried to tweak the windows timer without success. Does anybody has any idea how to make windows xp more accurate? Sluschny, Thomas wrote:
as you can see here:
_http://jira.freeswitch.org/browse/MODENDP-40_
i have this problem all the time (the error mentioned in this issue was only related with this).
It has to do with windows handle sleep() method, you has say sleep(1) for 1ms but on my
machine it waits 15ms (it depends on your hardware, other PCs behave different!). So i tested around with high performance counters.
For now i ignore that problem an set jitterbuffers on other device big enough.
Thomas
------------------------------------------------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Zelei Csaba *Gesendet:* Donnerstag, 24. April 2008 19:05 *An:* freeswitch-users@lists.freeswitch.org *Betreff:* [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms instead of1 packet/20ms
Dear all,
I tried to use FS in client mode, starting calls with mod_portaudio to our providers gateway ( a Cirpack softswitch ) I experienced that there is 2-3 sec delay in the call, its choppy and robot like. 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.
Here is an rtp statistic from a call: (see http://pastebin.freeswitch.org/4307 for the complete list and sip trace)
Packet Sequence Delta (ms) 42 26138 0.00 43 26139 0.02 46 26140 45.69 47 26141 0.02 48 26142 2.96 52 26143 56.31 53 26144 5.75 54 26145 0.02 58 26146 51.99 59 26147 0.03 60 26148 2.96 63 26149 42.95 65 26150 17.06 66 26151 0.02 67 26152 2.90 71 26153 56.99 72 26154 0.03 73 26155 0.02
Did anyone else experience similar problems? Is this the desired behaviour, because portaudio get data in 60ms interval or can I set it to 20ms somehow?
Thanks,
Csaba Zelei
------------------------------------------------------------------------
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Index: mod_portaudio.c =================================================================== --- mod_portaudio.c (revision 8260) +++ mod_portaudio.c (working copy) @@ -121,6 +121,7 @@ int ring_interval; GFLAGS flags; switch_timer_t timer; + switch_timer_t sync_timer; } globals; @@ -282,7 +283,15 @@ } switch_set_flag_locked(tech_pvt, TFLAG_IO); + + /* Start Synchronization Timer */ + //Is it ok to always use 20ms? What about the 160 sample???? + if ( switch_core_timer_init(&globals.sync_timer,"soft",20,160,switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) + { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sync Timer failed!!\n"); + } + /* Move Channel's State Machine to RING */ switch_channel_set_state(channel, CS_RING); @@ -412,6 +421,8 @@ } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(switch_core_session_get_channel(session))); + /* Destroy timer */ + switch_core_timer_destroy(&globals.sync_timer); return SWITCH_STATUS_SUCCESS; } @@ -542,12 +553,17 @@ switch_mutex_lock(globals.device_lock); get_samples: - + if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data, globals.read_codec.implementation->samples_per_frame, &globals.timer)) == 0) { + + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No data reset timer\n"); + switch_core_timer_sync(&globals.sync_timer); switch_yield(1000); + goto get_samples; + } else { globals.read_frame.datalen = samples * 2; globals.read_frame.samples = samples; @@ -562,7 +578,9 @@ status = SWITCH_STATUS_SUCCESS; } switch_mutex_unlock(globals.device_lock); - + + switch_core_timer_next(&globals.sync_timer); + return status; }
did you try setting the ptime on the rtp to 30 or 60ms when you choose a codec in your sip settings on FS in vars.xml, instead of PCMU try PCMU@30i or PCMU@60i it may be that the other side is doing 30 or 60 ms and not telling us. also in pablio.c in the portaudio_mod directory in ReadAudioStream func, there is a sleep 1 ms too if the windows is really sleeping a lot longer than that, try omitting line 158. 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. On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei <csaba.zelei@gmail.com> wrote:
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) However on windows the delta between rtp packets is 15-32 ms randomly, with occasionally high 70-100ms delta. I also tried to tweak the windows timer without success. Does anybody has any idea how to make windows xp more accurate?
Sluschny, Thomas wrote:
as you can see here:
*http://jira.freeswitch.org/browse/MODENDP-40*<http://jira.freeswitch.org/browse/MODENDP-40>
i have this problem all the time (the error mentioned in this issue was only related with this).
It has to do with windows handle sleep() method, you has say sleep(1) for 1ms but on my
machine it waits 15ms (it depends on your hardware, other PCs behave different!). So i tested around with high performance counters.
For now i ignore that problem an set jitterbuffers on other device big enough.
Thomas
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [ mailto:freeswitch-users-bounces@lists.freeswitch.org<freeswitch-users-bounces@lists.freeswitch.org>] *Im Auftrag von *Zelei Csaba *Gesendet:* Donnerstag, 24. April 2008 19:05 *An:* freeswitch-users@lists.freeswitch.org *Betreff:* [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms instead of1 packet/20ms
Dear all,
I tried to use FS in client mode, starting calls with mod_portaudio to our providers gateway ( a Cirpack softswitch ) I experienced that there is 2-3 sec delay in the call, its choppy and robot like. 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.
Here is an rtp statistic from a call: (see http://pastebin.freeswitch.org/4307 for the complete list and sip trace)
Packet Sequence Delta (ms) 42 26138 0.00 43 26139 0.02 46 26140 45.69 47 26141 0.02 48 26142 2.96 52 26143 56.31 53 26144 5.75 54 26145 0.02 58 26146 51.99 59 26147 0.03 60 26148 2.96 63 26149 42.95 65 26150 17.06 66 26151 0.02 67 26152 2.90 71 26153 56.99 72 26154 0.03 73 26155 0.02
Did anyone else experience similar problems? Is this the desired behaviour, because portaudio get data in 60ms interval or can I set it to 20ms somehow?
Thanks,
Csaba Zelei
------------------------------
_______________________________________________ Freeswitch-users mailing listFreeswitch-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.frees...
Index: mod_portaudio.c =================================================================== --- mod_portaudio.c (revision 8260) +++ mod_portaudio.c (working copy) @@ -121,6 +121,7 @@ int ring_interval; GFLAGS flags; switch_timer_t timer; + switch_timer_t sync_timer; } globals;
@@ -282,7 +283,15 @@ }
switch_set_flag_locked(tech_pvt, TFLAG_IO); + + /* Start Synchronization Timer */ + //Is it ok to always use 20ms? What about the 160 sample???? + if ( switch_core_timer_init(&globals.sync_timer,"soft",20,160,switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) + { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sync Timer failed!!\n"); + }
+ /* Move Channel's State Machine to RING */ switch_channel_set_state(channel, CS_RING);
@@ -412,6 +421,8 @@ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(switch_core_session_get_channel(session))); + /* Destroy timer */ + switch_core_timer_destroy(&globals.sync_timer);
return SWITCH_STATUS_SUCCESS; } @@ -542,12 +553,17 @@ switch_mutex_lock(globals.device_lock);
get_samples: - + if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
globals.read_codec.implementation->samples_per_frame,
&globals.timer)) == 0) { + + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No data reset timer\n"); + switch_core_timer_sync(&globals.sync_timer); switch_yield(1000); + goto get_samples; + } else { globals.read_frame.datalen = samples * 2; globals.read_frame.samples = samples; @@ -562,7 +578,9 @@ status = SWITCH_STATUS_SUCCESS; } switch_mutex_unlock(globals.device_lock); - + + switch_core_timer_next(&globals.sync_timer); + return status; }
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
Hi, Just a thought here: using calls like delay(), sleep() etc. for very short amount of time (like in this case a couple of miliseconds) should in my opinion be really discouraged. It is often a symptom of bad programming even in an embedded enviroment, not mentioning platforms like Windows or Linux where you can't really tell what priority does your task have, and will it not be starved for a long time by other tasks. I should be avoided whenever possible. Don't want to sound like a smart ass here, but isn't there any other way? From what I understood you wait until some amount of voice samples is collected? If that's the case than perhaps you can measure an amount of data collected not the time... If these are PCM samples than the correlation is straightforward. Again, sorry if I'm being a smart ass here but I've seen some really bad code with sleep() calls and such like, and I can tell you that it only worked fine in specific conditions, and had a tendency to work very poorly when for example CPU was under heavy load. Luaksz 2008/5/5 Anthony Minessale <anthony.minessale@gmail.com>:
did you try setting the ptime on the rtp to 30 or 60ms
when you choose a codec in your sip settings on FS in vars.xml, instead of PCMU try PCMU@30i or PCMU@60i it may be that the other side is doing 30 or 60 ms and not telling us.
also in pablio.c in the portaudio_mod directory in ReadAudioStream func, there is a sleep 1 ms too if the windows is really sleeping a lot longer than that, try omitting line 158. 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.
On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei <csaba.zelei@gmail.com> wrote:
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)
However on windows the delta between rtp packets is 15-32 ms randomly, with occasionally high 70-100ms delta. I also tried to tweak the windows timer without success. Does anybody has any idea how to make windows xp more accurate?
Sluschny, Thomas wrote:
as you can see here:
http://jira.freeswitch.org/browse/MODENDP-40
i have this problem all the time (the error mentioned in this issue was only related with this).
It has to do with windows handle sleep() method, you has say sleep(1) for 1ms but on my
machine it waits 15ms (it depends on your hardware, other PCs behave different!). So i tested around with high performance counters.
For now i ignore that problem an set jitterbuffers on other device big enough.
Thomas
________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Zelei Csaba Gesendet: Donnerstag, 24. April 2008 19:05 An: freeswitch-users@lists.freeswitch.org Betreff: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms instead of1 packet/20ms
Dear all,
I tried to use FS in client mode, starting calls with mod_portaudio to our providers gateway ( a Cirpack softswitch ) I experienced that there is 2-3 sec delay in the call, its choppy and robot like. 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.
Here is an rtp statistic from a call: (see http://pastebin.freeswitch.org/4307 for the complete list and sip trace)
Packet Sequence Delta (ms) 42 26138 0.00 43 26139 0.02 46 26140 45.69 47 26141 0.02 48 26142 2.96 52 26143 56.31 53 26144 5.75 54 26145 0.02 58 26146 51.99 59 26147 0.03 60 26148 2.96 63 26149 42.95 65 26150 17.06 66 26151 0.02 67 26152 2.90 71 26153 56.99 72 26154 0.03 73 26155 0.02
Did anyone else experience similar problems? Is this the desired behaviour, because portaudio get data in 60ms interval or can I set it to 20ms somehow?
Thanks,
Csaba Zelei
________________________________
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Index: mod_portaudio.c =================================================================== --- mod_portaudio.c (revision 8260) +++ mod_portaudio.c (working copy) @@ -121,6 +121,7 @@ int ring_interval; GFLAGS flags; switch_timer_t timer; + switch_timer_t sync_timer; } globals;
@@ -282,7 +283,15 @@ }
switch_set_flag_locked(tech_pvt, TFLAG_IO); + + /* Start Synchronization Timer */ + //Is it ok to always use 20ms? What about the 160 sample???? + if ( switch_core_timer_init(&globals.sync_timer,"soft",20,160,switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) + { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sync Timer failed!!\n"); + }
+ /* Move Channel's State Machine to RING */ switch_channel_set_state(channel, CS_RING);
@@ -412,6 +421,8 @@ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(switch_core_session_get_channel(session))); + /* Destroy timer */ + switch_core_timer_destroy(&globals.sync_timer);
return SWITCH_STATUS_SUCCESS; } @@ -542,12 +553,17 @@ switch_mutex_lock(globals.device_lock);
get_samples: - + if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
globals.read_codec.implementation->samples_per_frame,
&globals.timer)) == 0) {
+ + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No data reset timer\n"); + switch_core_timer_sync(&globals.sync_timer); switch_yield(1000); + goto get_samples; + } else { globals.read_frame.datalen = samples * 2; globals.read_frame.samples = samples; @@ -562,7 +578,9 @@ status = SWITCH_STATUS_SUCCESS; } switch_mutex_unlock(globals.device_lock); - + + switch_core_timer_next(&globals.sync_timer); + return status;
}
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org pstn:213-799-1400 _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
The place this is trickiest is when you are in a loop where you want to wait for audio, AND do something every x ms or so. You can't do a blocking read, and a read with timeout tends to be quite expensive. There are some ways around this, but sometimes its just the most efficient, even if not preferred method. Mike On May 5, 2008, at 5:26 PM, ?ukasz Zwierko wrote:
Hi,
Just a thought here: using calls like delay(), sleep() etc. for very short amount of time (like in this case a couple of miliseconds) should in my opinion be really discouraged. It is often a symptom of bad programming even in an embedded enviroment, not mentioning platforms like Windows or Linux where you can't really tell what priority does your task have, and will it not be starved for a long time by other tasks. I should be avoided whenever possible. Don't want to sound like a smart ass here, but isn't there any other way? From what I understood you wait until some amount of voice samples is collected? If that's the case than perhaps you can measure an amount of data collected not the time... If these are PCM samples than the correlation is straightforward. Again, sorry if I'm being a smart ass here but I've seen some really bad code with sleep() calls and such like, and I can tell you that it only worked fine in specific conditions, and had a tendency to work very poorly when for example CPU was under heavy load.
Luaksz
2008/5/5 Anthony Minessale <anthony.minessale@gmail.com>:
did you try setting the ptime on the rtp to 30 or 60ms
when you choose a codec in your sip settings on FS in vars.xml, instead of PCMU try PCMU@30i or PCMU@60i it may be that the other side is doing 30 or 60 ms and not telling us.
also in pablio.c in the portaudio_mod directory in ReadAudioStream func, there is a sleep 1 ms too if the windows is really sleeping a lot longer than that, try omitting line 158. 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.
On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei <csaba.zelei@gmail.com> wrote:
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)
However on windows the delta between rtp packets is 15-32 ms randomly, with occasionally high 70-100ms delta. I also tried to tweak the windows timer without success. Does anybody has any idea how to make windows xp more accurate?
Sluschny, Thomas wrote:
as you can see here:
http://jira.freeswitch.org/browse/MODENDP-40
i have this problem all the time (the error mentioned in this issue was only related with this).
It has to do with windows handle sleep() method, you has say sleep(1) for 1ms but on my
machine it waits 15ms (it depends on your hardware, other PCs behave different!). So i tested around with high performance counters.
For now i ignore that problem an set jitterbuffers on other device big enough.
Thomas
________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Zelei Csaba Gesendet: Donnerstag, 24. April 2008 19:05 An: freeswitch-users@lists.freeswitch.org Betreff: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms instead of1 packet/20ms
Dear all,
I tried to use FS in client mode, starting calls with mod_portaudio to our providers gateway ( a Cirpack softswitch ) I experienced that there is 2-3 sec delay in the call, its choppy and robot like. 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.
Here is an rtp statistic from a call: (see http://pastebin.freeswitch.org/4307 for the complete list and sip trace)
Packet Sequence Delta (ms) 42 26138 0.00 43 26139 0.02 46 26140 45.69 47 26141 0.02 48 26142 2.96 52 26143 56.31 53 26144 5.75 54 26145 0.02 58 26146 51.99 59 26147 0.03 60 26148 2.96 63 26149 42.95 65 26150 17.06 66 26151 0.02 67 26152 2.90 71 26153 56.99 72 26154 0.03 73 26155 0.02
Did anyone else experience similar problems? Is this the desired behaviour, because portaudio get data in 60ms interval or can I set it to 20ms somehow?
Thanks,
Csaba Zelei
________________________________
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Index: mod_portaudio.c =================================================================== --- mod_portaudio.c (revision 8260) +++ mod_portaudio.c (working copy) @@ -121,6 +121,7 @@ int ring_interval; GFLAGS flags; switch_timer_t timer; + switch_timer_t sync_timer; } globals;
@@ -282,7 +283,15 @@ }
switch_set_flag_locked(tech_pvt, TFLAG_IO); + + /* Start Synchronization Timer */ + //Is it ok to always use 20ms? What about the 160 sample???? + if ( switch_core_timer_init(&globals.sync_timer,"soft", 20,160,switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) + { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sync Timer failed!!\n"); + }
+ /* Move Channel's State Machine to RING */ switch_channel_set_state(channel, CS_RING);
@@ -412,6 +421,8 @@ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(switch_core_session_get_channel(session))); + /* Destroy timer */ + switch_core_timer_destroy(&globals.sync_timer);
return SWITCH_STATUS_SUCCESS; } @@ -542,12 +553,17 @@ switch_mutex_lock(globals.device_lock);
get_samples: - + if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
globals.read_codec.implementation->samples_per_frame,
&globals.timer)) == 0) {
+ + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No data reset timer\n"); + switch_core_timer_sync(&globals.sync_timer); switch_yield(1000); + goto get_samples; + } else { globals.read_frame.datalen = samples * 2; globals.read_frame.samples = samples; @@ -562,7 +578,9 @@ status = SWITCH_STATUS_SUCCESS; } switch_mutex_unlock(globals.device_lock); - + + switch_core_timer_next(&globals.sync_timer); + return status;
}
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org pstn:213-799-1400 _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
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. I appreciate the suggestion and I understand you are not trying to be a smart ass. On Mon, May 5, 2008 at 4:35 PM, Michael Jerris <mike@jerris.com> wrote:
The place this is trickiest is when you are in a loop where you want to wait for audio, AND do something every x ms or so. You can't do a blocking read, and a read with timeout tends to be quite expensive. There are some ways around this, but sometimes its just the most efficient, even if not preferred method.
Mike
On May 5, 2008, at 5:26 PM, ?ukasz Zwierko wrote:
Hi,
Just a thought here: using calls like delay(), sleep() etc. for very short amount of time (like in this case a couple of miliseconds) should in my opinion be really discouraged. It is often a symptom of bad programming even in an embedded enviroment, not mentioning platforms like Windows or Linux where you can't really tell what priority does your task have, and will it not be starved for a long time by other tasks. I should be avoided whenever possible. Don't want to sound like a smart ass here, but isn't there any other way? From what I understood you wait until some amount of voice samples is collected? If that's the case than perhaps you can measure an amount of data collected not the time... If these are PCM samples than the correlation is straightforward. Again, sorry if I'm being a smart ass here but I've seen some really bad code with sleep() calls and such like, and I can tell you that it only worked fine in specific conditions, and had a tendency to work very poorly when for example CPU was under heavy load.
Luaksz
2008/5/5 Anthony Minessale <anthony.minessale@gmail.com>:
did you try setting the ptime on the rtp to 30 or 60ms
when you choose a codec in your sip settings on FS in vars.xml, instead of PCMU try PCMU@30i or PCMU@60i it may be that the other side is doing 30 or 60 ms and not telling us.
also in pablio.c in the portaudio_mod directory in ReadAudioStream func, there is a sleep 1 ms too if the windows is really sleeping a lot longer than that, try omitting line 158. 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.
On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei <csaba.zelei@gmail.com> wrote:
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)
However on windows the delta between rtp packets is 15-32 ms randomly, with occasionally high 70-100ms delta. I also tried to tweak the windows timer without success. Does anybody has any idea how to make windows xp more accurate?
Sluschny, Thomas wrote:
as you can see here:
http://jira.freeswitch.org/browse/MODENDP-40
i have this problem all the time (the error mentioned in this issue was only related with this).
It has to do with windows handle sleep() method, you has say sleep(1) for 1ms but on my
machine it waits 15ms (it depends on your hardware, other PCs behave different!). So i tested around with high performance counters.
For now i ignore that problem an set jitterbuffers on other device big enough.
Thomas
________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Zelei Csaba Gesendet: Donnerstag, 24. April 2008 19:05 An: freeswitch-users@lists.freeswitch.org Betreff: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms instead of1 packet/20ms
Dear all,
I tried to use FS in client mode, starting calls with mod_portaudio to our providers gateway ( a Cirpack softswitch ) I experienced that there is 2-3 sec delay in the call, its choppy and robot like. 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.
Here is an rtp statistic from a call: (see http://pastebin.freeswitch.org/4307 for the complete list and sip trace)
Packet Sequence Delta (ms) 42 26138 0.00 43 26139 0.02 46 26140 45.69 47 26141 0.02 48 26142 2.96 52 26143 56.31 53 26144 5.75 54 26145 0.02 58 26146 51.99 59 26147 0.03 60 26148 2.96 63 26149 42.95 65 26150 17.06 66 26151 0.02 67 26152 2.90 71 26153 56.99 72 26154 0.03 73 26155 0.02
Did anyone else experience similar problems? Is this the desired behaviour, because portaudio get data in 60ms interval or can I set it to 20ms somehow?
Thanks,
Csaba Zelei
________________________________
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Index: mod_portaudio.c =================================================================== --- mod_portaudio.c (revision 8260) +++ mod_portaudio.c (working copy) @@ -121,6 +121,7 @@ int ring_interval; GFLAGS flags; switch_timer_t timer; + switch_timer_t sync_timer; } globals;
@@ -282,7 +283,15 @@ }
switch_set_flag_locked(tech_pvt, TFLAG_IO); + + /* Start Synchronization Timer */ + //Is it ok to always use 20ms? What about the 160 sample???? + if ( switch_core_timer_init(&globals.sync_timer,"soft", 20,160,switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) + { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sync Timer failed!!\n"); + }
+ /* Move Channel's State Machine to RING */ switch_channel_set_state(channel, CS_RING);
@@ -412,6 +421,8 @@ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(switch_core_session_get_channel(session))); + /* Destroy timer */ + switch_core_timer_destroy(&globals.sync_timer);
return SWITCH_STATUS_SUCCESS; } @@ -542,12 +553,17 @@ switch_mutex_lock(globals.device_lock);
get_samples: - + if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
globals.read_codec.implementation->samples_per_frame,
&globals.timer)) == 0) {
+ + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No data reset timer\n"); + switch_core_timer_sync(&globals.sync_timer); switch_yield(1000); + goto get_samples; + } else { globals.read_frame.datalen = samples * 2; globals.read_frame.samples = samples; @@ -562,7 +578,9 @@ status = SWITCH_STATUS_SUCCESS; } switch_mutex_unlock(globals.device_lock); - + + switch_core_timer_next(&globals.sync_timer); + return status;
}
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400 _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
Anthony seams to be right. I tested around a little bit and i see: - the main problem is the soundcard (-driver), it gives 480 frames all 60 ms - 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 ...) - i get really good results if i store the last timestamp when ReadAudioStream() returns, and if current timestamp is less than 20ms from last i wait 20 ms, so the packet difference went from 60-0-0-60-0-0 ms to 20-20-20-20-20-20 - i use HighPerformanceCounter to measure the time in WinXP I thought we could use switch_core_timer_check() to do that timestamp work, but it doesn't work as expected, seams we have to synchronize to the 60ms clock from soundcard, at least at the beginning, which means the delay increase. Thomas PS: i attach a patch for better understanding ________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Anthony Minessale Gesendet: Dienstag, 6. Mai 2008 00:38 An: freeswitch-users@lists.freeswitch.org Betreff: Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms insteadof1 packet/20ms 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. I appreciate the suggestion and I understand you are not trying to be a smart ass. On Mon, May 5, 2008 at 4:35 PM, Michael Jerris <mike@jerris.com> wrote: The place this is trickiest is when you are in a loop where you want to wait for audio, AND do something every x ms or so. You can't do a blocking read, and a read with timeout tends to be quite expensive. There are some ways around this, but sometimes its just the most efficient, even if not preferred method. Mike On May 5, 2008, at 5:26 PM, ?ukasz Zwierko wrote: > Hi, > > Just a thought here: using calls like delay(), sleep() etc. for very > short amount of time (like in this case a couple of miliseconds) > should in my opinion be really discouraged. It is often a symptom of > bad programming even in an embedded enviroment, not mentioning > platforms like Windows or Linux where you can't really tell what > priority does your task have, and will it not be starved for a long > time by other tasks. I should be avoided whenever possible. > Don't want to sound like a smart ass here, but isn't there any other > way? From what I understood you wait until some amount of voice > samples is collected? If that's the case than perhaps you can measure > an amount of data collected not the time... If these are PCM samples > than the correlation is straightforward. > Again, sorry if I'm being a smart ass here but I've seen some really > bad code with sleep() calls and such like, and I can tell you that it > only worked fine in specific conditions, and had a tendency to work > very poorly when for example CPU was under heavy load. > > Luaksz > > 2008/5/5 Anthony Minessale <anthony.minessale@gmail.com>: >> did you try setting the ptime on the rtp to 30 or 60ms >> >> when you choose a codec in your sip settings on FS in vars.xml, >> instead of >> PCMU try PCMU@30i or PCMU@60i >> it may be that the other side is doing 30 or 60 ms and not telling >> us. >> >> also in pablio.c in the portaudio_mod directory in ReadAudioStream >> func, >> there is a sleep 1 ms too >> if the windows is really sleeping a lot longer than that, try >> omitting line >> 158. >> 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. >> >> >> >> >> >> On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei >> <csaba.zelei@gmail.com> wrote: >>> >>> >>> >>> >>> 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) >>> However on windows the delta between rtp packets is 15-32 ms >>> randomly, >> with occasionally high 70-100ms delta. >>> I also tried to tweak the windows timer without success. >>> Does anybody has any idea how to make windows xp more accurate? >>> >>> Sluschny, Thomas wrote: >>> >>> >>> >>> >>> as you can see here: >>> >>> >>> http://jira.freeswitch.org/browse/MODENDP-40 >>> >>> i have this problem all the time (the error mentioned in this >>> issue was >> only related with this). >>> >>> It has to do with windows handle sleep() method, you has say >>> sleep(1) for >> 1ms but on my >>> >>> machine it waits 15ms (it depends on your hardware, other PCs behave >> different!). So i tested around with high performance counters. >>> >>> For now i ignore that problem an set jitterbuffers on other device >>> big >> enough. >>> >>> Thomas >>> >>> ________________________________ >> Von: freeswitch-users-bounces@lists.freeswitch.org >> [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag >> von Zelei >> Csaba >>> Gesendet: Donnerstag, 24. April 2008 19:05 >>> An: freeswitch-users@lists.freeswitch.org >>> Betreff: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms >>> instead >> of1 packet/20ms >>> >>> Dear all, >>> >>> I tried to use FS in client mode, starting calls with >>> mod_portaudio to our >> providers gateway ( a Cirpack softswitch ) >>> I experienced that there is 2-3 sec delay in the call, its choppy >>> and >> robot like. >>> 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. >>> >>> Here is an rtp statistic from a call: (see >> http://pastebin.freeswitch.org/4307 for the complete list and sip >> trace) >>> >>> Packet Sequence Delta (ms) >>> 42 26138 0.00 >>> 43 26139 0.02 >>> 46 26140 45.69 >>> 47 26141 0.02 >>> 48 26142 2.96 >>> 52 26143 56.31 >>> 53 26144 5.75 >>> 54 26145 0.02 >>> 58 26146 51.99 >>> 59 26147 0.03 >>> 60 26148 2.96 >>> 63 26149 42.95 >>> 65 26150 17.06 >>> 66 26151 0.02 >>> 67 26152 2.90 >>> 71 26153 56.99 >>> 72 26154 0.03 >>> 73 26155 0.02 >>> >>> Did anyone else experience similar problems? >>> Is this the desired behaviour, because portaudio get data in 60ms >>> interval >> or can I set it to 20ms somehow? >>> >>> Thanks, >>> >>> Csaba Zelei >>> >>> >>> ________________________________ >> >>> _______________________________________________ >>> Freeswitch-users mailing list >>> Freeswitch-users@lists.freeswitch.org >>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >>> UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users >>> http://www.freeswitch.org >>> >>> >>> >>> Index: mod_portaudio.c >>> =================================================================== >>> --- mod_portaudio.c (revision 8260) >>> +++ mod_portaudio.c (working copy) >>> @@ -121,6 +121,7 @@ >>> int ring_interval; >>> GFLAGS flags; >>> switch_timer_t timer; >>> + switch_timer_t sync_timer; >>> } globals; >>> >>> >>> @@ -282,7 +283,15 @@ >>> } >>> >>> switch_set_flag_locked(tech_pvt, TFLAG_IO); >>> + >>> + /* Start Synchronization Timer */ >>> + //Is it ok to always use 20ms? What about the 160 sample???? >>> + if ( >> switch_core_timer_init(&globals.sync_timer,"soft", >> 20,160,switch_core_session_get_pool(session)) >> != SWITCH_STATUS_SUCCESS) >>> + { >>> + switch_log_printf(SWITCH_CHANNEL_LOG, >>> SWITCH_LOG_DEBUG, >> "Sync Timer failed!!\n"); >>> + } >>> >>> + >>> /* Move Channel's State Machine to RING */ >>> switch_channel_set_state(channel, CS_RING); >>> >>> @@ -412,6 +421,8 @@ >>> } >>> >>> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s >>> CHANNEL >> HANGUP\n", >> switch_channel_get_name(switch_core_session_get_channel(session))); >>> + /* Destroy timer */ >>> + switch_core_timer_destroy(&globals.sync_timer); >>> >>> return SWITCH_STATUS_SUCCESS; >>> } >>> @@ -542,12 +553,17 @@ >>> switch_mutex_lock(globals.device_lock); >>> >>> get_samples: >>> - >>> + >>> if ((samples = ReadAudioStream(globals.audio_stream, >> globals.read_frame.data, >>> >> globals.read_codec.implementation->samples_per_frame, >>> >> &globals.timer)) == 0) { >>> + >>> + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, >>> "No data >> reset timer\n"); >>> + switch_core_timer_sync(&globals.sync_timer); >>> switch_yield(1000); >>> + >>> goto get_samples; >>> + >>> } else { >>> globals.read_frame.datalen = samples * 2; >>> globals.read_frame.samples = samples; >>> @@ -562,7 +578,9 @@ >>> status = SWITCH_STATUS_SUCCESS; >>> } >>> switch_mutex_unlock(globals.device_lock); >>> - >>> + >>> + switch_core_timer_next(&globals.sync_timer); >>> + >>> return status; >>> >>> } >>> >>> >>> _______________________________________________ >>> Freeswitch-users mailing list >>> Freeswitch-users@lists.freeswitch.org >>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >>> UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users >>> http://www.freeswitch.org >>> >>> >> >> >> >> -- >> Anthony Minessale II >> >> FreeSWITCH http://www.freeswitch.org/ >> ClueCon http://www.cluecon.com/ >> >> AIM: anthm >> MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> >> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> >> IRC: irc.freenode.net #freeswitch >> >> FreeSWITCH Developer Conference >> sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> >> iax:guest@conference.freeswitch.org/888 >> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> >> pstn:213-799-1400 >> _______________________________________________ >> Freeswitch-users mailing list >> Freeswitch-users@lists.freeswitch.org >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >> UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users >> http://www.freeswitch.org >> >> > > _______________________________________________ > Freeswitch-users mailing list > Freeswitch-users@lists.freeswitch.org > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users > UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users > http://www.freeswitch.org _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org -- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
if switch_yield for windows is not working properly maybe if we fix that the code will work as planned. 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. This is one of the many joys of being cross platform. =D On Tue, May 6, 2008 at 7:37 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
Anthony seams to be right. I tested around a little bit and i see: - the main problem is the soundcard (-driver), it gives 480 frames all 60 ms - 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 ...) - i get really good results if i store the last timestamp when ReadAudioStream() returns, and if current timestamp is less than 20ms from last i wait 20 ms, so the packet difference went from 60-0-0-60-0-0 ms to 20-20-20-20-20-20 - i use HighPerformanceCounter to measure the time in WinXP
I thought we could use switch_core_timer_check() to do that timestamp work, but it doesn't work as expected, seams we have to synchronize to the 60ms clock from soundcard, at least at the beginning, which means the delay increase.
Thomas
PS: i attach a patch for better understanding
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Anthony Minessale *Gesendet:* Dienstag, 6. Mai 2008 00:38 *An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms insteadof1 packet/20ms
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.
I appreciate the suggestion and I understand you are not trying to be a smart ass.
On Mon, May 5, 2008 at 4:35 PM, Michael Jerris <mike@jerris.com> wrote:
The place this is trickiest is when you are in a loop where you want to wait for audio, AND do something every x ms or so. You can't do a blocking read, and a read with timeout tends to be quite expensive. There are some ways around this, but sometimes its just the most efficient, even if not preferred method.
Mike
On May 5, 2008, at 5:26 PM, ?ukasz Zwierko wrote:
Hi,
Just a thought here: using calls like delay(), sleep() etc. for very short amount of time (like in this case a couple of miliseconds) should in my opinion be really discouraged. It is often a symptom of bad programming even in an embedded enviroment, not mentioning platforms like Windows or Linux where you can't really tell what priority does your task have, and will it not be starved for a long time by other tasks. I should be avoided whenever possible. Don't want to sound like a smart ass here, but isn't there any other way? From what I understood you wait until some amount of voice samples is collected? If that's the case than perhaps you can measure an amount of data collected not the time... If these are PCM samples than the correlation is straightforward. Again, sorry if I'm being a smart ass here but I've seen some really bad code with sleep() calls and such like, and I can tell you that it only worked fine in specific conditions, and had a tendency to work very poorly when for example CPU was under heavy load.
Luaksz
2008/5/5 Anthony Minessale <anthony.minessale@gmail.com>:
did you try setting the ptime on the rtp to 30 or 60ms
when you choose a codec in your sip settings on FS in vars.xml, instead of PCMU try PCMU@30i or PCMU@60i it may be that the other side is doing 30 or 60 ms and not telling us.
also in pablio.c in the portaudio_mod directory in ReadAudioStream func, there is a sleep 1 ms too if the windows is really sleeping a lot longer than that, try omitting line 158. 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.
On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei <csaba.zelei@gmail.com> wrote:
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)
However on windows the delta between rtp packets is 15-32 ms randomly, with occasionally high 70-100ms delta. I also tried to tweak the windows timer without success. Does anybody has any idea how to make windows xp more accurate?
Sluschny, Thomas wrote:
as you can see here:
http://jira.freeswitch.org/browse/MODENDP-40
i have this problem all the time (the error mentioned in this issue was only related with this).
It has to do with windows handle sleep() method, you has say sleep(1) for 1ms but on my
machine it waits 15ms (it depends on your hardware, other PCs behave different!). So i tested around with high performance counters.
For now i ignore that problem an set jitterbuffers on other device big enough.
Thomas
________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Zelei Csaba Gesendet: Donnerstag, 24. April 2008 19:05 An: freeswitch-users@lists.freeswitch.org Betreff: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms instead of1 packet/20ms
Dear all,
I tried to use FS in client mode, starting calls with mod_portaudio to our providers gateway ( a Cirpack softswitch ) I experienced that there is 2-3 sec delay in the call, its choppy and robot like. 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.
Here is an rtp statistic from a call: (see http://pastebin.freeswitch.org/4307 for the complete list and sip trace)
Packet Sequence Delta (ms) 42 26138 0.00 43 26139 0.02 46 26140 45.69 47 26141 0.02 48 26142 2.96 52 26143 56.31 53 26144 5.75 54 26145 0.02 58 26146 51.99 59 26147 0.03 60 26148 2.96 63 26149 42.95 65 26150 17.06 66 26151 0.02 67 26152 2.90 71 26153 56.99 72 26154 0.03 73 26155 0.02
Did anyone else experience similar problems? Is this the desired behaviour, because portaudio get data in 60ms interval or can I set it to 20ms somehow?
Thanks,
Csaba Zelei
________________________________
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Index: mod_portaudio.c =================================================================== --- mod_portaudio.c (revision 8260) +++ mod_portaudio.c (working copy) @@ -121,6 +121,7 @@ int ring_interval; GFLAGS flags; switch_timer_t timer; + switch_timer_t sync_timer; } globals;
@@ -282,7 +283,15 @@ }
switch_set_flag_locked(tech_pvt, TFLAG_IO); + + /* Start Synchronization Timer */ + //Is it ok to always use 20ms? What about the 160 sample???? + if ( switch_core_timer_init(&globals.sync_timer,"soft", 20,160,switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) + { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sync Timer failed!!\n"); + }
+ /* Move Channel's State Machine to RING */ switch_channel_set_state(channel, CS_RING);
@@ -412,6 +421,8 @@ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(switch_core_session_get_channel(session))); + /* Destroy timer */ + switch_core_timer_destroy(&globals.sync_timer);
return SWITCH_STATUS_SUCCESS; } @@ -542,12 +553,17 @@ switch_mutex_lock(globals.device_lock);
get_samples: - + if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
globals.read_codec.implementation->samples_per_frame,
&globals.timer)) == 0) {
+ + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No data reset timer\n"); + switch_core_timer_sync(&globals.sync_timer); switch_yield(1000); + goto get_samples; + } else { globals.read_frame.datalen = samples * 2; globals.read_frame.samples = samples; @@ -562,7 +578,9 @@ status = SWITCH_STATUS_SUCCESS; } switch_mutex_unlock(globals.device_lock); - + + switch_core_timer_next(&globals.sync_timer); + return status;
}
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com<MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org<sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400 _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
i already tried to implement such a routine, but as i remember i had problems to compile, anyway this may be help you: // sleep with smaller tick time, wait in µs void betterSleep(long wait) { LARGE_INTEGER lElapse; BOOL succ; HANDLE timerHandle = 0; DWORD dwWaitResult; __try { // return on 0 if (wait < 1) return; // create the timer timerHandle = (HANDLE) CreateWaitableTimerA(NULL, FALSE, NULL); // set the timer lElapse.QuadPart = 2500LL - (wait * 10000LL); succ = SetWaitableTimer(timerHandle, &lElapse, 0, NULL, NULL, FALSE); if (!succ) { printf( "set timer not successful!\n" ); } dwWaitResult = WaitForSingleObject( timerHandle, wait // fall back timeout with 15ms granularity ); switch (dwWaitResult) { // The thread got mutex ownership. case WAIT_OBJECT_0: //printf( "WAIT_OBJECT_0!\n" ); break; // Cannot get mutex ownership due to time-out. case WAIT_TIMEOUT: printf( "WAIT_TIMEOUT!\n" ); break; // Got ownership of the abandoned mutex object. case WAIT_ABANDONED: printf( "WAIT_ABANDONED!\n" ); break; } } __finally { if (timerHandle) CloseHandle(timerHandle); } } It may be hard work but: Its cool to be cross platform - you reach all people around we count on you ;) Thomas ________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Anthony Minessale Gesendet: Dienstag, 6. Mai 2008 15:08 An: freeswitch-users@lists.freeswitch.org Betreff: Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60msinsteadof1 packet/20ms if switch_yield for windows is not working properly maybe if we fix that the code will work as planned. 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. This is one of the many joys of being cross platform. =D On Tue, May 6, 2008 at 7:37 AM, Sluschny, Thomas <Thomas.Sluschny@siemens.com> wrote: Anthony seams to be right. I tested around a little bit and i see: - the main problem is the soundcard (-driver), it gives 480 frames all 60 ms - 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 ...) - i get really good results if i store the last timestamp when ReadAudioStream() returns, and if current timestamp is less than 20ms from last i wait 20 ms, so the packet difference went from 60-0-0-60-0-0 ms to 20-20-20-20-20-20 - i use HighPerformanceCounter to measure the time in WinXP I thought we could use switch_core_timer_check() to do that timestamp work, but it doesn't work as expected, seams we have to synchronize to the 60ms clock from soundcard, at least at the beginning, which means the delay increase. Thomas PS: i attach a patch for better understanding ________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Anthony Minessale Gesendet: Dienstag, 6. Mai 2008 00:38 An: freeswitch-users@lists.freeswitch.org Betreff: Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms insteadof1 packet/20ms 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. I appreciate the suggestion and I understand you are not trying to be a smart ass. On Mon, May 5, 2008 at 4:35 PM, Michael Jerris <mike@jerris.com> wrote: The place this is trickiest is when you are in a loop where you want to wait for audio, AND do something every x ms or so. You can't do a blocking read, and a read with timeout tends to be quite expensive. There are some ways around this, but sometimes its just the most efficient, even if not preferred method. Mike On May 5, 2008, at 5:26 PM, ?ukasz Zwierko wrote: > Hi, > > Just a thought here: using calls like delay(), sleep() etc. for very > short amount of time (like in this case a couple of miliseconds) > should in my opinion be really discouraged. It is often a symptom of > bad programming even in an embedded enviroment, not mentioning > platforms like Windows or Linux where you can't really tell what > priority does your task have, and will it not be starved for a long > time by other tasks. I should be avoided whenever possible. > Don't want to sound like a smart ass here, but isn't there any other > way? From what I understood you wait until some amount of voice > samples is collected? If that's the case than perhaps you can measure > an amount of data collected not the time... If these are PCM samples > than the correlation is straightforward. > Again, sorry if I'm being a smart ass here but I've seen some really > bad code with sleep() calls and such like, and I can tell you that it > only worked fine in specific conditions, and had a tendency to work > very poorly when for example CPU was under heavy load. > > Luaksz > > 2008/5/5 Anthony Minessale <anthony.minessale@gmail.com>: >> did you try setting the ptime on the rtp to 30 or 60ms >> >> when you choose a codec in your sip settings on FS in vars.xml, >> instead of >> PCMU try PCMU@30i or PCMU@60i >> it may be that the other side is doing 30 or 60 ms and not telling >> us. >> >> also in pablio.c in the portaudio_mod directory in ReadAudioStream >> func, >> there is a sleep 1 ms too >> if the windows is really sleeping a lot longer than that, try >> omitting line >> 158. >> 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. >> >> >> >> >> >> On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei >> <csaba.zelei@gmail.com> wrote: >>> >>> >>> >>> >>> 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) >>> However on windows the delta between rtp packets is 15-32 ms >>> randomly, >> with occasionally high 70-100ms delta. >>> I also tried to tweak the windows timer without success. >>> Does anybody has any idea how to make windows xp more accurate? >>> >>> Sluschny, Thomas wrote: >>> >>> >>> >>> >>> as you can see here: >>> >>> >>> http://jira.freeswitch.org/browse/MODENDP-40 >>> >>> i have this problem all the time (the error mentioned in this >>> issue was >> only related with this). >>> >>> It has to do with windows handle sleep() method, you has say >>> sleep(1) for >> 1ms but on my >>> >>> machine it waits 15ms (it depends on your hardware, other PCs behave >> different!). So i tested around with high performance counters. >>> >>> For now i ignore that problem an set jitterbuffers on other device >>> big >> enough. >>> >>> Thomas >>> >>> ________________________________ >> Von: freeswitch-users-bounces@lists.freeswitch.org >> [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag >> von Zelei >> Csaba >>> Gesendet: Donnerstag, 24. April 2008 19:05 >>> An: freeswitch-users@lists.freeswitch.org >>> Betreff: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms >>> instead >> of1 packet/20ms >>> >>> Dear all, >>> >>> I tried to use FS in client mode, starting calls with >>> mod_portaudio to our >> providers gateway ( a Cirpack softswitch ) >>> I experienced that there is 2-3 sec delay in the call, its choppy >>> and >> robot like. >>> 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. >>> >>> Here is an rtp statistic from a call: (see >> http://pastebin.freeswitch.org/4307 for the complete list and sip >> trace) >>> >>> Packet Sequence Delta (ms) >>> 42 26138 0.00 >>> 43 26139 0.02 >>> 46 26140 45.69 >>> 47 26141 0.02 >>> 48 26142 2.96 >>> 52 26143 56.31 >>> 53 26144 5.75 >>> 54 26145 0.02 >>> 58 26146 51.99 >>> 59 26147 0.03 >>> 60 26148 2.96 >>> 63 26149 42.95 >>> 65 26150 17.06 >>> 66 26151 0.02 >>> 67 26152 2.90 >>> 71 26153 56.99 >>> 72 26154 0.03 >>> 73 26155 0.02 >>> >>> Did anyone else experience similar problems? >>> Is this the desired behaviour, because portaudio get data in 60ms >>> interval >> or can I set it to 20ms somehow? >>> >>> Thanks, >>> >>> Csaba Zelei >>> >>> >>> ________________________________ >> >>> _______________________________________________ >>> Freeswitch-users mailing list >>> Freeswitch-users@lists.freeswitch.org >>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users >>> http://www.freeswitch.org >>> >>> >>> >>> Index: mod_portaudio.c >>> =================================================================== >>> --- mod_portaudio.c (revision 8260) >>> +++ mod_portaudio.c (working copy) >>> @@ -121,6 +121,7 @@ >>> int ring_interval; >>> GFLAGS flags; >>> switch_timer_t timer; >>> + switch_timer_t sync_timer; >>> } globals; >>> >>> >>> @@ -282,7 +283,15 @@ >>> } >>> >>> switch_set_flag_locked(tech_pvt, TFLAG_IO); >>> + >>> + /* Start Synchronization Timer */ >>> + //Is it ok to always use 20ms? What about the 160 sample???? >>> + if ( >> switch_core_timer_init(&globals.sync_timer,"soft", >> 20,160,switch_core_session_get_pool(session)) >> != SWITCH_STATUS_SUCCESS) >>> + { >>> + switch_log_printf(SWITCH_CHANNEL_LOG, >>> SWITCH_LOG_DEBUG, >> "Sync Timer failed!!\n"); >>> + } >>> >>> + >>> /* Move Channel's State Machine to RING */ >>> switch_channel_set_state(channel, CS_RING); >>> >>> @@ -412,6 +421,8 @@ >>> } >>> >>> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s >>> CHANNEL >> HANGUP\n", >> switch_channel_get_name(switch_core_session_get_channel(session))); >>> + /* Destroy timer */ >>> + switch_core_timer_destroy(&globals.sync_timer); >>> >>> return SWITCH_STATUS_SUCCESS; >>> } >>> @@ -542,12 +553,17 @@ >>> switch_mutex_lock(globals.device_lock); >>> >>> get_samples: >>> - >>> + >>> if ((samples = ReadAudioStream(globals.audio_stream, >> globals.read_frame.data, >>> >> globals.read_codec.implementation->samples_per_frame, >>> >> &globals.timer)) == 0) { >>> + >>> + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, >>> "No data >> reset timer\n"); >>> + switch_core_timer_sync(&globals.sync_timer); >>> switch_yield(1000); >>> + >>> goto get_samples; >>> + >>> } else { >>> globals.read_frame.datalen = samples * 2; >>> globals.read_frame.samples = samples; >>> @@ -562,7 +578,9 @@ >>> status = SWITCH_STATUS_SUCCESS; >>> } >>> switch_mutex_unlock(globals.device_lock); >>> - >>> + >>> + switch_core_timer_next(&globals.sync_timer); >>> + >>> return status; >>> >>> } >>> >>> >>> _______________________________________________ >>> Freeswitch-users mailing list >>> Freeswitch-users@lists.freeswitch.org >>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users >>> http://www.freeswitch.org >>> >>> >> >> >> >> -- >> Anthony Minessale II >> >> FreeSWITCH http://www.freeswitch.org/ >> ClueCon http://www.cluecon.com/ >> >> AIM: anthm >> MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> >> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> >> IRC: irc.freenode.net #freeswitch >> >> FreeSWITCH Developer Conference >> sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> >> iax:guest@conference.freeswitch.org/888 >> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> >> pstn:213-799-1400 >> _______________________________________________ >> Freeswitch-users mailing list >> Freeswitch-users@lists.freeswitch.org >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users >> http://www.freeswitch.org >> >> > > _______________________________________________ > Freeswitch-users mailing list > Freeswitch-users@lists.freeswitch.org > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users > http://www.freeswitch.org _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org -- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400 _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org -- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
I added a small patch to turn up the resolution of Sleep to 1ms. Can you see if that helps? On Tue, May 6, 2008 at 8:38 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
i already tried to implement such a routine, but as i remember i had problems to compile, anyway this may be help you:
// sleep with smaller tick time, wait in µs void betterSleep(long wait) { LARGE_INTEGER lElapse; BOOL succ; HANDLE timerHandle = 0; DWORD dwWaitResult;
__try {
// return on 0 if (wait < 1) return;
// create the timer timerHandle = (HANDLE) CreateWaitableTimerA(NULL, FALSE, NULL);
// set the timer lElapse.QuadPart = 2500LL - (wait * 10000LL); succ = SetWaitableTimer(timerHandle, &lElapse, 0, NULL, NULL, FALSE);
if (!succ) { printf( "set timer not successful!\n" ); }
dwWaitResult = WaitForSingleObject( timerHandle, wait // fall back timeout with 15ms granularity );
switch (dwWaitResult) { // The thread got mutex ownership. case WAIT_OBJECT_0: //printf( "WAIT_OBJECT_0!\n" ); break;
// Cannot get mutex ownership due to time-out. case WAIT_TIMEOUT: printf( "WAIT_TIMEOUT!\n" ); break;
// Got ownership of the abandoned mutex object. case WAIT_ABANDONED: printf( "WAIT_ABANDONED!\n" ); break; } } __finally { if (timerHandle) CloseHandle(timerHandle); } }
It may be hard work but: Its cool to be cross platform - you reach all people around we count on you ;)
Thomas
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Anthony Minessale *Gesendet:* Dienstag, 6. Mai 2008 15:08
*An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60msinsteadof1 packet/20ms
if switch_yield for windows is not working properly maybe if we fix that the code will work as planned.
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.
This is one of the many joys of being cross platform. =D
On Tue, May 6, 2008 at 7:37 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
Anthony seams to be right. I tested around a little bit and i see: - the main problem is the soundcard (-driver), it gives 480 frames all 60 ms - 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 ...) - i get really good results if i store the last timestamp when ReadAudioStream() returns, and if current timestamp is less than 20ms from last i wait 20 ms, so the packet difference went from 60-0-0-60-0-0 ms to 20-20-20-20-20-20 - i use HighPerformanceCounter to measure the time in WinXP
I thought we could use switch_core_timer_check() to do that timestamp work, but it doesn't work as expected, seams we have to synchronize to the 60ms clock from soundcard, at least at the beginning, which means the delay increase.
Thomas
PS: i attach a patch for better understanding
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Anthony Minessale *Gesendet:* Dienstag, 6. Mai 2008 00:38 *An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms insteadof1 packet/20ms
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.
I appreciate the suggestion and I understand you are not trying to be a smart ass.
On Mon, May 5, 2008 at 4:35 PM, Michael Jerris <mike@jerris.com> wrote:
The place this is trickiest is when you are in a loop where you want to wait for audio, AND do something every x ms or so. You can't do a blocking read, and a read with timeout tends to be quite expensive. There are some ways around this, but sometimes its just the most efficient, even if not preferred method.
Mike
On May 5, 2008, at 5:26 PM, ?ukasz Zwierko wrote:
Hi,
Just a thought here: using calls like delay(), sleep() etc. for very short amount of time (like in this case a couple of miliseconds) should in my opinion be really discouraged. It is often a symptom of bad programming even in an embedded enviroment, not mentioning platforms like Windows or Linux where you can't really tell what priority does your task have, and will it not be starved for a long time by other tasks. I should be avoided whenever possible. Don't want to sound like a smart ass here, but isn't there any other way? From what I understood you wait until some amount of voice samples is collected? If that's the case than perhaps you can measure an amount of data collected not the time... If these are PCM samples than the correlation is straightforward. Again, sorry if I'm being a smart ass here but I've seen some really bad code with sleep() calls and such like, and I can tell you that it only worked fine in specific conditions, and had a tendency to work very poorly when for example CPU was under heavy load.
Luaksz
2008/5/5 Anthony Minessale <anthony.minessale@gmail.com>:
did you try setting the ptime on the rtp to 30 or 60ms
when you choose a codec in your sip settings on FS in vars.xml, instead of PCMU try PCMU@30i or PCMU@60i it may be that the other side is doing 30 or 60 ms and not telling us.
also in pablio.c in the portaudio_mod directory in ReadAudioStream func, there is a sleep 1 ms too if the windows is really sleeping a lot longer than that, try omitting line 158. 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.
On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei <csaba.zelei@gmail.com> wrote:
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)
However on windows the delta between rtp packets is 15-32 ms randomly, with occasionally high 70-100ms delta. I also tried to tweak the windows timer without success. Does anybody has any idea how to make windows xp more accurate?
Sluschny, Thomas wrote:
as you can see here:
http://jira.freeswitch.org/browse/MODENDP-40
i have this problem all the time (the error mentioned in this issue was only related with this).
It has to do with windows handle sleep() method, you has say sleep(1) for 1ms but on my
machine it waits 15ms (it depends on your hardware, other PCs behave different!). So i tested around with high performance counters.
For now i ignore that problem an set jitterbuffers on other device big enough.
Thomas
________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Zelei Csaba Gesendet: Donnerstag, 24. April 2008 19:05 An: freeswitch-users@lists.freeswitch.org Betreff: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms instead of1 packet/20ms
Dear all,
I tried to use FS in client mode, starting calls with mod_portaudio to our providers gateway ( a Cirpack softswitch ) I experienced that there is 2-3 sec delay in the call, its choppy and robot like. 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.
Here is an rtp statistic from a call: (see http://pastebin.freeswitch.org/4307 for the complete list and sip trace)
Packet Sequence Delta (ms) 42 26138 0.00 43 26139 0.02 46 26140 45.69 47 26141 0.02 48 26142 2.96 52 26143 56.31 53 26144 5.75 54 26145 0.02 58 26146 51.99 59 26147 0.03 60 26148 2.96 63 26149 42.95 65 26150 17.06 66 26151 0.02 67 26152 2.90 71 26153 56.99 72 26154 0.03 73 26155 0.02
Did anyone else experience similar problems? Is this the desired behaviour, because portaudio get data in 60ms interval or can I set it to 20ms somehow?
Thanks,
Csaba Zelei
________________________________
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Index: mod_portaudio.c
===================================================================
--- mod_portaudio.c (revision 8260) +++ mod_portaudio.c (working copy) @@ -121,6 +121,7 @@ int ring_interval; GFLAGS flags; switch_timer_t timer; + switch_timer_t sync_timer; } globals;
@@ -282,7 +283,15 @@ }
switch_set_flag_locked(tech_pvt, TFLAG_IO); + + /* Start Synchronization Timer */ + //Is it ok to always use 20ms? What about the 160 sample???? + if ( switch_core_timer_init(&globals.sync_timer,"soft", 20,160,switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) + { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sync Timer failed!!\n"); + }
+ /* Move Channel's State Machine to RING */ switch_channel_set_state(channel, CS_RING);
@@ -412,6 +421,8 @@ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(switch_core_session_get_channel(session))); + /* Destroy timer */ + switch_core_timer_destroy(&globals.sync_timer);
return SWITCH_STATUS_SUCCESS; } @@ -542,12 +553,17 @@ switch_mutex_lock(globals.device_lock);
get_samples: - + if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
globals.read_codec.implementation->samples_per_frame,
&globals.timer)) == 0) {
+ + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No data reset timer\n"); + switch_core_timer_sync(&globals.sync_timer); switch_yield(1000); + goto get_samples; + } else { globals.read_frame.datalen = samples * 2; globals.read_frame.samples = samples; @@ -562,7 +578,9 @@ status = SWITCH_STATUS_SUCCESS; } switch_mutex_unlock(globals.device_lock); - + + switch_core_timer_next(&globals.sync_timer); + return status;
}
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com<MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org<sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400 _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
Hi Anthony, I tried your suggestions (the PCMU@30i 60i and omitting line 158 in pablio.c) but none solve the problem. I also tried the latest trunk but its the same. I reached the best performance with the latest trunk and the patch Thomas wrote.(~20ms rtp packet delta, rarely 100+ms) 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. If I am correct we have 2 problem here. The first is windows timer isnt very accurate. The second is that mod_portaudio dont have any delay when it can return audio data immadiately . Let me explain: 1. call for channel_read_frame 2. waiting for audio data (~60ms) 3. got 60ms audio data 4. get 20ms (remaining 40ms) audio data, return (and send rtp frame) 5. call for channel_read_frame 6. get 20ms, return(and send rtp frame) within ~1ms 7. call for channel_read_frame 8. get 20ms, return(and send rtp frame) within ~1ms go back to 1 and start again That's what I tried to solve with my patch, but because of the windows timer it failed. I hope I could help, and dont misunderstand something. Csaba Anthony Minessale írta:
I added a small patch to turn up the resolution of Sleep to 1ms. Can you see if that helps?
On Tue, May 6, 2008 at 8:38 AM, Sluschny, Thomas <Thomas.Sluschny@siemens.com <mailto:Thomas.Sluschny@siemens.com>> wrote:
i already tried to implement such a routine, but as i remember i had problems to compile, anyway this may be help you:
// sleep with smaller tick time, wait in µs void betterSleep(long wait) { LARGE_INTEGER lElapse; BOOL succ; HANDLE timerHandle = 0; DWORD dwWaitResult;
__try {
// return on 0 if (wait < 1) return;
// create the timer timerHandle = (HANDLE) CreateWaitableTimerA(NULL, FALSE, NULL);
// set the timer lElapse.QuadPart = 2500LL - (wait * 10000LL); succ = SetWaitableTimer(timerHandle, &lElapse, 0, NULL, NULL, FALSE);
if (!succ) { printf( "set timer not successful!\n" ); }
dwWaitResult = WaitForSingleObject( timerHandle, wait // fall back timeout with 15ms granularity );
switch (dwWaitResult) { // The thread got mutex ownership. case WAIT_OBJECT_0: //printf( "WAIT_OBJECT_0!\n" ); break;
// Cannot get mutex ownership due to time-out. case WAIT_TIMEOUT: printf( "WAIT_TIMEOUT!\n" ); break;
// Got ownership of the abandoned mutex object. case WAIT_ABANDONED: printf( "WAIT_ABANDONED!\n" ); break; } } __finally { if (timerHandle) CloseHandle(timerHandle); } }
It may be hard work but: Its cool to be cross platform - you reach all people around we count on you ;)
Thomas
------------------------------------------------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org <mailto:freeswitch-users-bounces@lists.freeswitch.org> [mailto:freeswitch-users-bounces@lists.freeswitch.org <mailto:freeswitch-users-bounces@lists.freeswitch.org>] *Im Auftrag von *Anthony Minessale *Gesendet:* Dienstag, 6. Mai 2008 15:08
*An:* freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org> *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60msinsteadof1 packet/20ms
if switch_yield for windows is not working properly maybe if we fix that the code will work as planned.
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.
This is one of the many joys of being cross platform. =D
On Tue, May 6, 2008 at 7:37 AM, Sluschny, Thomas <Thomas.Sluschny@siemens.com <mailto:Thomas.Sluschny@siemens.com>> wrote:
Anthony seams to be right. I tested around a little bit and i see: - the main problem is the soundcard (-driver), it gives 480 frames all 60 ms - 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 ...) - i get really good results if i store the last timestamp when ReadAudioStream() returns, and if current timestamp is less than 20ms from last i wait 20 ms, so the packet difference went from 60-0-0-60-0-0 ms to 20-20-20-20-20-20 - i use HighPerformanceCounter to measure the time in WinXP
I thought we could use switch_core_timer_check() to do that timestamp work, but it doesn't work as expected, seams we have to synchronize to the 60ms clock from soundcard, at least at the beginning, which means the delay increase.
Thomas
PS: i attach a patch for better understanding
------------------------------------------------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org <mailto:freeswitch-users-bounces@lists.freeswitch.org> [mailto:freeswitch-users-bounces@lists.freeswitch.org <mailto:freeswitch-users-bounces@lists.freeswitch.org>] *Im Auftrag von *Anthony Minessale *Gesendet:* Dienstag, 6. Mai 2008 00:38
*An:* freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org> *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms insteadof1 packet/20ms
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.
I appreciate the suggestion and I understand you are not trying to be a smart ass.
On Mon, May 5, 2008 at 4:35 PM, Michael Jerris <mike@jerris.com <mailto:mike@jerris.com>> wrote:
The place this is trickiest is when you are in a loop where you want to wait for audio, AND do something every x ms or so. You can't do a blocking read, and a read with timeout tends to be quite expensive. There are some ways around this, but sometimes its just the most efficient, even if not preferred method.
Mike
On May 5, 2008, at 5:26 PM, ?ukasz Zwierko wrote:
> Hi, > > Just a thought here: using calls like delay(), sleep() etc. for very > short amount of time (like in this case a couple of miliseconds) > should in my opinion be really discouraged. It is often a symptom of > bad programming even in an embedded enviroment, not mentioning > platforms like Windows or Linux where you can't really tell what > priority does your task have, and will it not be starved for a long > time by other tasks. I should be avoided whenever possible. > Don't want to sound like a smart ass here, but isn't there any other > way? From what I understood you wait until some amount of voice > samples is collected? If that's the case than perhaps you can measure > an amount of data collected not the time... If these are PCM samples > than the correlation is straightforward. > Again, sorry if I'm being a smart ass here but I've seen some really > bad code with sleep() calls and such like, and I can tell you that it > only worked fine in specific conditions, and had a tendency to work > very poorly when for example CPU was under heavy load. > > Luaksz > > 2008/5/5 Anthony Minessale <anthony.minessale@gmail.com <mailto:anthony.minessale@gmail.com>>: >> did you try setting the ptime on the rtp to 30 or 60ms >> >> when you choose a codec in your sip settings on FS in vars.xml, >> instead of >> PCMU try PCMU@30i or PCMU@60i >> it may be that the other side is doing 30 or 60 ms and not telling >> us. >> >> also in pablio.c in the portaudio_mod directory in ReadAudioStream >> func, >> there is a sleep 1 ms too >> if the windows is really sleeping a lot longer than that, try >> omitting line >> 158. >> 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. >> >> >> >> >> >> On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei >> <csaba.zelei@gmail.com <mailto:csaba.zelei@gmail.com>> wrote: >>> >>> >>> >>> >>> 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) >>> However on windows the delta between rtp packets is 15-32 ms >>> randomly, >> with occasionally high 70-100ms delta. >>> I also tried to tweak the windows timer without success. >>> Does anybody has any idea how to make windows xp more accurate? >>> >>> Sluschny, Thomas wrote: >>> >>> >>> >>> >>> as you can see here: >>> >>> >>> http://jira.freeswitch.org/browse/MODENDP-40 >>> >>> i have this problem all the time (the error mentioned in this >>> issue was >> only related with this). >>> >>> It has to do with windows handle sleep() method, you has say >>> sleep(1) for >> 1ms but on my >>> >>> machine it waits 15ms (it depends on your hardware, other PCs behave >> different!). So i tested around with high performance counters. >>> >>> For now i ignore that problem an set jitterbuffers on other device >>> big >> enough. >>> >>> Thomas >>> >>> ________________________________ >> Von: freeswitch-users-bounces@lists.freeswitch.org <mailto:freeswitch-users-bounces@lists.freeswitch.org> >> [mailto:freeswitch-users-bounces@lists.freeswitch.org <mailto:freeswitch-users-bounces@lists.freeswitch.org>] Im Auftrag >> von Zelei >> Csaba >>> Gesendet: Donnerstag, 24. April 2008 19:05 >>> An: freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org> >>> Betreff: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms >>> instead >> of1 packet/20ms >>> >>> Dear all, >>> >>> I tried to use FS in client mode, starting calls with >>> mod_portaudio to our >> providers gateway ( a Cirpack softswitch ) >>> I experienced that there is 2-3 sec delay in the call, its choppy >>> and >> robot like. >>> 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. >>> >>> Here is an rtp statistic from a call: (see >> http://pastebin.freeswitch.org/4307 for the complete list and sip >> trace) >>> >>> Packet Sequence Delta (ms) >>> 42 26138 0.00 >>> 43 26139 0.02 >>> 46 26140 45.69 >>> 47 26141 0.02 >>> 48 26142 2.96 >>> 52 26143 56.31 >>> 53 26144 5.75 >>> 54 26145 0.02 >>> 58 26146 51.99 >>> 59 26147 0.03 >>> 60 26148 2.96 >>> 63 26149 42.95 >>> 65 26150 17.06 >>> 66 26151 0.02 >>> 67 26152 2.90 >>> 71 26153 56.99 >>> 72 26154 0.03 >>> 73 26155 0.02 >>> >>> Did anyone else experience similar problems? >>> Is this the desired behaviour, because portaudio get data in 60ms >>> interval >> or can I set it to 20ms somehow? >>> >>> Thanks, >>> >>> Csaba Zelei >>> >>> >>> ________________________________ >> >>> _______________________________________________ >>> Freeswitch-users mailing list >>> Freeswitch-users@lists.freeswitch.org <mailto:Freeswitch-users@lists.freeswitch.org> >>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users >>> http://www.freeswitch.org >>> >>> >>> >>> Index: mod_portaudio.c >>> =================================================================== >>> --- mod_portaudio.c (revision 8260) >>> +++ mod_portaudio.c (working copy) >>> @@ -121,6 +121,7 @@ >>> int ring_interval; >>> GFLAGS flags; >>> switch_timer_t timer; >>> + switch_timer_t sync_timer; >>> } globals; >>> >>> >>> @@ -282,7 +283,15 @@ >>> } >>> >>> switch_set_flag_locked(tech_pvt, TFLAG_IO); >>> + >>> + /* Start Synchronization Timer */ >>> + //Is it ok to always use 20ms? What about the 160 sample???? >>> + if ( >> switch_core_timer_init(&globals.sync_timer,"soft", >> 20,160,switch_core_session_get_pool(session)) >> != SWITCH_STATUS_SUCCESS) >>> + { >>> + switch_log_printf(SWITCH_CHANNEL_LOG, >>> SWITCH_LOG_DEBUG, >> "Sync Timer failed!!\n"); >>> + } >>> >>> + >>> /* Move Channel's State Machine to RING */ >>> switch_channel_set_state(channel, CS_RING); >>> >>> @@ -412,6 +421,8 @@ >>> } >>> >>> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s >>> CHANNEL >> HANGUP\n", >> switch_channel_get_name(switch_core_session_get_channel(session))); >>> + /* Destroy timer */ >>> + switch_core_timer_destroy(&globals.sync_timer); >>> >>> return SWITCH_STATUS_SUCCESS; >>> } >>> @@ -542,12 +553,17 @@ >>> switch_mutex_lock(globals.device_lock); >>> >>> get_samples: >>> - >>> + >>> if ((samples = ReadAudioStream(globals.audio_stream, >> globals.read_frame.data, >>> >> globals.read_codec.implementation->samples_per_frame, >>> >> &globals.timer)) == 0) { >>> + >>> + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, >>> "No data >> reset timer\n"); >>> + switch_core_timer_sync(&globals.sync_timer); >>> switch_yield(1000); >>> + >>> goto get_samples; >>> + >>> } else { >>> globals.read_frame.datalen = samples * 2; >>> globals.read_frame.samples = samples; >>> @@ -562,7 +578,9 @@ >>> status = SWITCH_STATUS_SUCCESS; >>> } >>> switch_mutex_unlock(globals.device_lock); >>> - >>> + >>> + switch_core_timer_next(&globals.sync_timer); >>> + >>> return status; >>> >>> } >>> >>> >>> _______________________________________________ >>> Freeswitch-users mailing list >>> Freeswitch-users@lists.freeswitch.org <mailto:Freeswitch-users@lists.freeswitch.org> >>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users >>> http://www.freeswitch.org >>> >>> >> >> >> >> -- >> Anthony Minessale II >> >> FreeSWITCH http://www.freeswitch.org/ >> ClueCon http://www.cluecon.com/ >> >> AIM: anthm >> MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> >> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> >> IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch >> >> FreeSWITCH Developer Conference >> sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> >> iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> >> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> >> pstn:213-799-1400 >> _______________________________________________ >> Freeswitch-users mailing list >> Freeswitch-users@lists.freeswitch.org <mailto:Freeswitch-users@lists.freeswitch.org> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users >> http://www.freeswitch.org >> >> > > _______________________________________________ > Freeswitch-users mailing list > Freeswitch-users@lists.freeswitch.org <mailto:Freeswitch-users@lists.freeswitch.org> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users > http://www.freeswitch.org
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org <mailto:Freeswitch-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org <mailto:Freeswitch-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org <mailto:Freeswitch-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400 ------------------------------------------------------------------------
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
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. On Tue, May 6, 2008 at 10:59 AM, Csaba Zelei <csaba.zelei@gmail.com> wrote:
Hi Anthony,
I tried your suggestions (the PCMU@30i 60i and omitting line 158 in pablio.c) but none solve the problem. I also tried the latest trunk but its the same. I reached the best performance with the latest trunk and the patch Thomas wrote.(~20ms rtp packet delta, rarely 100+ms) 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.
If I am correct we have 2 problem here. The first is windows timer isnt very accurate. The second is that mod_portaudio dont have any delay when it can return audio data immadiately . Let me explain:
1. call for channel_read_frame 2. waiting for audio data (~60ms) 3. got 60ms audio data 4. get 20ms (remaining 40ms) audio data, return (and send rtp frame) 5. call for channel_read_frame 6. get 20ms, return(and send rtp frame) within ~1ms 7. call for channel_read_frame 8. get 20ms, return(and send rtp frame) within ~1ms go back to 1 and start again
That's what I tried to solve with my patch, but because of the windows timer it failed. I hope I could help, and dont misunderstand something.
Csaba
Anthony Minessale írta:
I added a small patch to turn up the resolution of Sleep to 1ms. Can you see if that helps?
On Tue, May 6, 2008 at 8:38 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
i already tried to implement such a routine, but as i remember i had problems to compile, anyway this may be help you:
// sleep with smaller tick time, wait in µs void betterSleep(long wait) { LARGE_INTEGER lElapse; BOOL succ; HANDLE timerHandle = 0; DWORD dwWaitResult;
__try {
// return on 0 if (wait < 1) return;
// create the timer timerHandle = (HANDLE) CreateWaitableTimerA(NULL, FALSE, NULL);
// set the timer lElapse.QuadPart = 2500LL - (wait * 10000LL); succ = SetWaitableTimer(timerHandle, &lElapse, 0, NULL, NULL, FALSE);
if (!succ) { printf( "set timer not successful!\n" ); }
dwWaitResult = WaitForSingleObject( timerHandle, wait // fall back timeout with 15ms granularity );
switch (dwWaitResult) { // The thread got mutex ownership. case WAIT_OBJECT_0: //printf( "WAIT_OBJECT_0!\n" ); break;
// Cannot get mutex ownership due to time-out. case WAIT_TIMEOUT: printf( "WAIT_TIMEOUT!\n" ); break;
// Got ownership of the abandoned mutex object. case WAIT_ABANDONED: printf( "WAIT_ABANDONED!\n" ); break; } } __finally { if (timerHandle) CloseHandle(timerHandle); } }
It may be hard work but: Its cool to be cross platform - you reach all people around we count on you ;)
Thomas
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Anthony Minessale *Gesendet:* Dienstag, 6. Mai 2008 15:08 *An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60msinsteadof1 packet/20ms
if switch_yield for windows is not working properly maybe if we fix that the code will work as planned.
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.
This is one of the many joys of being cross platform. =D
On Tue, May 6, 2008 at 7:37 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
Anthony seams to be right. I tested around a little bit and i see: - the main problem is the soundcard (-driver), it gives 480 frames all 60 ms - 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 ...) - i get really good results if i store the last timestamp when ReadAudioStream() returns, and if current timestamp is less than 20ms from last i wait 20 ms, so the packet difference went from 60-0-0-60-0-0 ms to 20-20-20-20-20-20 - i use HighPerformanceCounter to measure the time in WinXP
I thought we could use switch_core_timer_check() to do that timestamp work, but it doesn't work as expected, seams we have to synchronize to the 60ms clock from soundcard, at least at the beginning, which means the delay increase.
Thomas
PS: i attach a patch for better understanding
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Anthony Minessale *Gesendet:* Dienstag, 6. Mai 2008 00:38 *An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms insteadof1 packet/20ms
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.
I appreciate the suggestion and I understand you are not trying to be a smart ass.
On Mon, May 5, 2008 at 4:35 PM, Michael Jerris <mike@jerris.com> wrote:
The place this is trickiest is when you are in a loop where you want to wait for audio, AND do something every x ms or so. You can't do a blocking read, and a read with timeout tends to be quite expensive. There are some ways around this, but sometimes its just the most efficient, even if not preferred method.
Mike
On May 5, 2008, at 5:26 PM, ?ukasz Zwierko wrote:
Hi,
Just a thought here: using calls like delay(), sleep() etc. for very short amount of time (like in this case a couple of miliseconds) should in my opinion be really discouraged. It is often a symptom of bad programming even in an embedded enviroment, not mentioning platforms like Windows or Linux where you can't really tell what priority does your task have, and will it not be starved for a long time by other tasks. I should be avoided whenever possible. Don't want to sound like a smart ass here, but isn't there any other way? From what I understood you wait until some amount of voice samples is collected? If that's the case than perhaps you can measure an amount of data collected not the time... If these are PCM samples than the correlation is straightforward. Again, sorry if I'm being a smart ass here but I've seen some really bad code with sleep() calls and such like, and I can tell you that it only worked fine in specific conditions, and had a tendency to work very poorly when for example CPU was under heavy load.
Luaksz
2008/5/5 Anthony Minessale <anthony.minessale@gmail.com>:
did you try setting the ptime on the rtp to 30 or 60ms
when you choose a codec in your sip settings on FS in vars.xml, instead of PCMU try PCMU@30i or PCMU@60i it may be that the other side is doing 30 or 60 ms and not telling us.
also in pablio.c in the portaudio_mod directory in ReadAudioStream func, there is a sleep 1 ms too if the windows is really sleeping a lot longer than that, try omitting line 158. 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.
On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei <csaba.zelei@gmail.com> wrote: > > > > > 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) > However on windows the delta between rtp packets is 15-32 ms > randomly, with occasionally high 70-100ms delta. > I also tried to tweak the windows timer without success. > Does anybody has any idea how to make windows xp more accurate? > > Sluschny, Thomas wrote: > > > > > as you can see here: > > > http://jira.freeswitch.org/browse/MODENDP-40 > > i have this problem all the time (the error mentioned in this > issue was only related with this). > > It has to do with windows handle sleep() method, you has say > sleep(1) for 1ms but on my > > machine it waits 15ms (it depends on your hardware, other PCs behave different!). So i tested around with high performance counters. > > For now i ignore that problem an set jitterbuffers on other device > big enough. > > Thomas > > ________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Zelei Csaba > Gesendet: Donnerstag, 24. April 2008 19:05 > An: freeswitch-users@lists.freeswitch.org > Betreff: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms > instead of1 packet/20ms > > Dear all, > > I tried to use FS in client mode, starting calls with > mod_portaudio to our providers gateway ( a Cirpack softswitch ) > I experienced that there is 2-3 sec delay in the call, its choppy > and robot like. > 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. > > Here is an rtp statistic from a call: (see http://pastebin.freeswitch.org/4307 for the complete list and sip trace) > > Packet Sequence Delta (ms) > 42 26138 0.00 > 43 26139 0.02 > 46 26140 45.69 > 47 26141 0.02 > 48 26142 2.96 > 52 26143 56.31 > 53 26144 5.75 > 54 26145 0.02 > 58 26146 51.99 > 59 26147 0.03 > 60 26148 2.96 > 63 26149 42.95 > 65 26150 17.06 > 66 26151 0.02 > 67 26152 2.90 > 71 26153 56.99 > 72 26154 0.03 > 73 26155 0.02 > > Did anyone else experience similar problems? > Is this the desired behaviour, because portaudio get data in 60ms > interval or can I set it to 20ms somehow? > > Thanks, > > Csaba Zelei > > > ________________________________
> _______________________________________________ > Freeswitch-users mailing list > Freeswitch-users@lists.freeswitch.org > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users > UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users > http://www.freeswitch.org > > > > Index: mod_portaudio.c > =================================================================== > --- mod_portaudio.c (revision 8260) > +++ mod_portaudio.c (working copy) > @@ -121,6 +121,7 @@ > int ring_interval; > GFLAGS flags; > switch_timer_t timer; > + switch_timer_t sync_timer; > } globals; > > > @@ -282,7 +283,15 @@ > } > > switch_set_flag_locked(tech_pvt, TFLAG_IO); > + > + /* Start Synchronization Timer */ > + //Is it ok to always use 20ms? What about the 160 sample???? > + if ( switch_core_timer_init(&globals.sync_timer,"soft", 20,160,switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) > + { > + switch_log_printf(SWITCH_CHANNEL_LOG, > SWITCH_LOG_DEBUG, "Sync Timer failed!!\n"); > + } > > + > /* Move Channel's State Machine to RING */ > switch_channel_set_state(channel, CS_RING); > > @@ -412,6 +421,8 @@ > } > > switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s > CHANNEL HANGUP\n",
switch_channel_get_name(switch_core_session_get_channel(session)));
> + /* Destroy timer */ > + switch_core_timer_destroy(&globals.sync_timer); > > return SWITCH_STATUS_SUCCESS; > } > @@ -542,12 +553,17 @@ > switch_mutex_lock(globals.device_lock); > > get_samples: > - > + > if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data, > globals.read_codec.implementation->samples_per_frame, > &globals.timer)) == 0) { > + > + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, > "No data reset timer\n"); > + switch_core_timer_sync(&globals.sync_timer); > switch_yield(1000); > + > goto get_samples; > + > } else { > globals.read_frame.datalen = samples * 2; > globals.read_frame.samples = samples; > @@ -562,7 +578,9 @@ > status = SWITCH_STATUS_SUCCESS; > } > switch_mutex_unlock(globals.device_lock); > - > + > + switch_core_timer_next(&globals.sync_timer); > + > return status; > > } > > > _______________________________________________ > Freeswitch-users mailing list > Freeswitch-users@lists.freeswitch.org > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users > UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users > http://www.freeswitch.org > >
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com<MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org<sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400 _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com<MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org<sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
------------------------------
_______________________________________________ Freeswitch-users mailing listFreeswitch-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.frees...
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
Yes, but it didnt help with portaudio (just together with the patch) What else do you need to test it with? Please tell me, and i will do it for you tomorrow. I also found a test code for timeBeginPeriod on this site: http://www.geisswerks.com/ryan/FAQS/timing.html and experienced that sleep(1) is usually 2 ms long (sometimes 4) 2008/5/6 Anthony Minessale <anthony.minessale@gmail.com>:
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.
On Tue, May 6, 2008 at 10:59 AM, Csaba Zelei <csaba.zelei@gmail.com> wrote:
Hi Anthony,
I tried your suggestions (the PCMU@30i 60i and omitting line 158 in pablio.c) but none solve the problem. I also tried the latest trunk but its the same. I reached the best performance with the latest trunk and the patch Thomas wrote.(~20ms rtp packet delta, rarely 100+ms) 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.
If I am correct we have 2 problem here. The first is windows timer isnt very accurate. The second is that mod_portaudio dont have any delay when it can return audio data immadiately . Let me explain:
1. call for channel_read_frame 2. waiting for audio data (~60ms) 3. got 60ms audio data 4. get 20ms (remaining 40ms) audio data, return (and send rtp frame) 5. call for channel_read_frame 6. get 20ms, return(and send rtp frame) within ~1ms 7. call for channel_read_frame 8. get 20ms, return(and send rtp frame) within ~1ms go back to 1 and start again
That's what I tried to solve with my patch, but because of the windows timer it failed. I hope I could help, and dont misunderstand something.
Csaba
Anthony Minessale írta:
I added a small patch to turn up the resolution of Sleep to 1ms. Can you see if that helps?
On Tue, May 6, 2008 at 8:38 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
i already tried to implement such a routine, but as i remember i had problems to compile, anyway this may be help you:
// sleep with smaller tick time, wait in µs void betterSleep(long wait) { LARGE_INTEGER lElapse; BOOL succ; HANDLE timerHandle = 0; DWORD dwWaitResult;
__try {
// return on 0 if (wait < 1) return;
// create the timer timerHandle = (HANDLE) CreateWaitableTimerA(NULL, FALSE, NULL);
// set the timer lElapse.QuadPart = 2500LL - (wait * 10000LL); succ = SetWaitableTimer(timerHandle, &lElapse, 0, NULL, NULL, FALSE);
if (!succ) { printf( "set timer not successful!\n" ); }
dwWaitResult = WaitForSingleObject( timerHandle, wait // fall back timeout with 15ms granularity );
switch (dwWaitResult) { // The thread got mutex ownership. case WAIT_OBJECT_0: //printf( "WAIT_OBJECT_0!\n" ); break;
// Cannot get mutex ownership due to time-out. case WAIT_TIMEOUT: printf( "WAIT_TIMEOUT!\n" ); break;
// Got ownership of the abandoned mutex object. case WAIT_ABANDONED: printf( "WAIT_ABANDONED!\n" ); break; } } __finally { if (timerHandle) CloseHandle(timerHandle); } }
It may be hard work but: Its cool to be cross platform - you reach all people around we count on you ;)
Thomas
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Anthony Minessale *Gesendet:* Dienstag, 6. Mai 2008 15:08 *An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60msinsteadof1 packet/20ms
if switch_yield for windows is not working properly maybe if we fix that the code will work as planned.
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.
This is one of the many joys of being cross platform. =D
On Tue, May 6, 2008 at 7:37 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
Anthony seams to be right. I tested around a little bit and i see: - the main problem is the soundcard (-driver), it gives 480 frames all 60 ms - 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 ...) - i get really good results if i store the last timestamp when ReadAudioStream() returns, and if current timestamp is less than 20ms from last i wait 20 ms, so the packet difference went from 60-0-0-60-0-0 ms to 20-20-20-20-20-20 - i use HighPerformanceCounter to measure the time in WinXP
I thought we could use switch_core_timer_check() to do that timestamp work, but it doesn't work as expected, seams we have to synchronize to the 60ms clock from soundcard, at least at the beginning, which means the delay increase.
Thomas
PS: i attach a patch for better understanding
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Anthony Minessale *Gesendet:* Dienstag, 6. Mai 2008 00:38 *An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms insteadof1 packet/20ms
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.
I appreciate the suggestion and I understand you are not trying to be a smart ass.
On Mon, May 5, 2008 at 4:35 PM, Michael Jerris <mike@jerris.com> wrote:
The place this is trickiest is when you are in a loop where you want to wait for audio, AND do something every x ms or so. You can't do a blocking read, and a read with timeout tends to be quite expensive. There are some ways around this, but sometimes its just the most efficient, even if not preferred method.
Mike
On May 5, 2008, at 5:26 PM, ?ukasz Zwierko wrote:
Hi,
Just a thought here: using calls like delay(), sleep() etc. for very short amount of time (like in this case a couple of miliseconds) should in my opinion be really discouraged. It is often a symptom of bad programming even in an embedded enviroment, not mentioning platforms like Windows or Linux where you can't really tell what priority does your task have, and will it not be starved for a long time by other tasks. I should be avoided whenever possible. Don't want to sound like a smart ass here, but isn't there any other way? From what I understood you wait until some amount of voice samples is collected? If that's the case than perhaps you can measure an amount of data collected not the time... If these are PCM samples than the correlation is straightforward. Again, sorry if I'm being a smart ass here but I've seen some really bad code with sleep() calls and such like, and I can tell you that it only worked fine in specific conditions, and had a tendency to work very poorly when for example CPU was under heavy load.
Luaksz
2008/5/5 Anthony Minessale <anthony.minessale@gmail.com>: > did you try setting the ptime on the rtp to 30 or 60ms > > when you choose a codec in your sip settings on FS in vars.xml, > instead of > PCMU try PCMU@30i or PCMU@60i > it may be that the other side is doing 30 or 60 ms and not telling > us. > > also in pablio.c in the portaudio_mod directory in ReadAudioStream > func, > there is a sleep 1 ms too > if the windows is really sleeping a lot longer than that, try > omitting line > 158. > 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. > > > > > > On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei > <csaba.zelei@gmail.com> wrote: >> >> >> >> >> 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) >> However on windows the delta between rtp packets is 15-32 ms >> randomly, > with occasionally high 70-100ms delta. >> I also tried to tweak the windows timer without success. >> Does anybody has any idea how to make windows xp more accurate? >> >> Sluschny, Thomas wrote: >> >> >> >> >> as you can see here: >> >> >> http://jira.freeswitch.org/browse/MODENDP-40 >> >> i have this problem all the time (the error mentioned in this >> issue was > only related with this). >> >> It has to do with windows handle sleep() method, you has say >> sleep(1) for > 1ms but on my >> >> machine it waits 15ms (it depends on your hardware, other PCs behave > different!). So i tested around with high performance counters. >> >> For now i ignore that problem an set jitterbuffers on other device >> big > enough. >> >> Thomas >> >> ________________________________ > Von: freeswitch-users-bounces@lists.freeswitch.org > [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag > von Zelei > Csaba >> Gesendet: Donnerstag, 24. April 2008 19:05 >> An: freeswitch-users@lists.freeswitch.org >> Betreff: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms >> instead > of1 packet/20ms >> >> Dear all, >> >> I tried to use FS in client mode, starting calls with >> mod_portaudio to our > providers gateway ( a Cirpack softswitch ) >> I experienced that there is 2-3 sec delay in the call, its choppy >> and > robot like. >> 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. >> >> Here is an rtp statistic from a call: (see > http://pastebin.freeswitch.org/4307 for the complete list and sip > trace) >> >> Packet Sequence Delta (ms) >> 42 26138 0.00 >> 43 26139 0.02 >> 46 26140 45.69 >> 47 26141 0.02 >> 48 26142 2.96 >> 52 26143 56.31 >> 53 26144 5.75 >> 54 26145 0.02 >> 58 26146 51.99 >> 59 26147 0.03 >> 60 26148 2.96 >> 63 26149 42.95 >> 65 26150 17.06 >> 66 26151 0.02 >> 67 26152 2.90 >> 71 26153 56.99 >> 72 26154 0.03 >> 73 26155 0.02 >> >> Did anyone else experience similar problems? >> Is this the desired behaviour, because portaudio get data in 60ms >> interval > or can I set it to 20ms somehow? >> >> Thanks, >> >> Csaba Zelei >> >> >> ________________________________ > >> _______________________________________________ >> Freeswitch-users mailing list >> Freeswitch-users@lists.freeswitch.org >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >> UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users >> http://www.freeswitch.org >> >> >> >> Index: mod_portaudio.c >> =================================================================== >> --- mod_portaudio.c (revision 8260) >> +++ mod_portaudio.c (working copy) >> @@ -121,6 +121,7 @@ >> int ring_interval; >> GFLAGS flags; >> switch_timer_t timer; >> + switch_timer_t sync_timer; >> } globals; >> >> >> @@ -282,7 +283,15 @@ >> } >> >> switch_set_flag_locked(tech_pvt, TFLAG_IO); >> + >> + /* Start Synchronization Timer */ >> + //Is it ok to always use 20ms? What about the 160 sample???? >> + if ( > switch_core_timer_init(&globals.sync_timer,"soft", > 20,160,switch_core_session_get_pool(session)) > != SWITCH_STATUS_SUCCESS) >> + { >> + switch_log_printf(SWITCH_CHANNEL_LOG, >> SWITCH_LOG_DEBUG, > "Sync Timer failed!!\n"); >> + } >> >> + >> /* Move Channel's State Machine to RING */ >> switch_channel_set_state(channel, CS_RING); >> >> @@ -412,6 +421,8 @@ >> } >> >> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s >> CHANNEL > HANGUP\n", > switch_channel_get_name(switch_core_session_get_channel(session))); >> + /* Destroy timer */ >> + switch_core_timer_destroy(&globals.sync_timer); >> >> return SWITCH_STATUS_SUCCESS; >> } >> @@ -542,12 +553,17 @@ >> switch_mutex_lock(globals.device_lock); >> >> get_samples: >> - >> + >> if ((samples = ReadAudioStream(globals.audio_stream, > globals.read_frame.data, >> > globals.read_codec.implementation->samples_per_frame, >> > &globals.timer)) == 0) { >> + >> + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, >> "No data > reset timer\n"); >> + switch_core_timer_sync(&globals.sync_timer); >> switch_yield(1000); >> + >> goto get_samples; >> + >> } else { >> globals.read_frame.datalen = samples * 2; >> globals.read_frame.samples = samples; >> @@ -562,7 +578,9 @@ >> status = SWITCH_STATUS_SUCCESS; >> } >> switch_mutex_unlock(globals.device_lock); >> - >> + >> + switch_core_timer_next(&globals.sync_timer); >> + >> return status; >> >> } >> >> >> _______________________________________________ >> Freeswitch-users mailing list >> Freeswitch-users@lists.freeswitch.org >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >> UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users >> http://www.freeswitch.org >> >> > > > > -- > Anthony Minessale II > > FreeSWITCH http://www.freeswitch.org/ > ClueCon http://www.cluecon.com/ > > AIM: anthm > MSN:anthony_minessale@hotmail.com<MSN%3Aanthony_minessale@hotmail.com> > GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> > IRC: irc.freenode.net #freeswitch > > FreeSWITCH Developer Conference > sip:888@conference.freeswitch.org<sip%3A888@conference.freeswitch.org> > iax:guest@conference.freeswitch.org/888 > googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> > pstn:213-799-1400 > _______________________________________________ > Freeswitch-users mailing list > Freeswitch-users@lists.freeswitch.org > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users > UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users > http://www.freeswitch.org > >
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com<MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org<sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com<MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org<sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
------------------------------
_______________________________________________ Freeswitch-users mailing listFreeswitch-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.frees...
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hi Anthony, i also tested your patch with no success. As i already described below, the problem with all 60ms 3 packets comes from the soundcard. The hardware delivers its samples all 60 ms. Our problem is (like Csaba said) that we read out the buffer after 60ms, 3 times, each with samples for 20ms, AND WITH NO DELAY! 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. In my patch i wait appr.20 ms if last method call was no longer than 4ms ago, but i think we can do better with switch_core_timer_check() method, but i don't know exactly how. You are absolutly right with your demand for a better timing resolution under Windows, but this 60ms mystery is caused by the soundcard. Thomas ________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Zelei Csaba Gesendet: Dienstag, 6. Mai 2008 20:22 An: freeswitch-users@lists.freeswitch.org Betreff: Re: [Freeswitch-users] mod_portaudio send 3 rtppacket/60msinsteadof1 packet/20ms Yes, but it didnt help with portaudio (just together with the patch) What else do you need to test it with? Please tell me, and i will do it for you tomorrow. I also found a test code for timeBeginPeriod on this site: http://www.geisswerks.com/ryan/FAQS/timing.html and experienced that sleep(1) is usually 2 ms long (sometimes 4) 2008/5/6 Anthony Minessale <anthony.minessale@gmail.com>: 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. On Tue, May 6, 2008 at 10:59 AM, Csaba Zelei <csaba.zelei@gmail.com> wrote: Hi Anthony, I tried your suggestions (the PCMU@30i 60i and omitting line 158 in pablio.c) but none solve the problem. I also tried the latest trunk but its the same. I reached the best performance with the latest trunk and the patch Thomas wrote.(~20ms rtp packet delta, rarely 100+ms) 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. If I am correct we have 2 problem here. The first is windows timer isnt very accurate. The second is that mod_portaudio dont have any delay when it can return audio data immadiately . Let me explain: 1. call for channel_read_frame 2. waiting for audio data (~60ms) 3. got 60ms audio data 4. get 20ms (remaining 40ms) audio data, return (and send rtp frame) 5. call for channel_read_frame 6. get 20ms, return(and send rtp frame) within ~1ms 7. call for channel_read_frame 8. get 20ms, return(and send rtp frame) within ~1ms go back to 1 and start again That's what I tried to solve with my patch, but because of the windows timer it failed. I hope I could help, and dont misunderstand something. Csaba Anthony Minessale írta: I added a small patch to turn up the resolution of Sleep to 1ms. Can you see if that helps? On Tue, May 6, 2008 at 8:38 AM, Sluschny, Thomas <Thomas.Sluschny@siemens.com> wrote: i already tried to implement such a routine, but as i remember i had problems to compile, anyway this may be help you: // sleep with smaller tick time, wait in µs void betterSleep(long wait) { LARGE_INTEGER lElapse; BOOL succ; HANDLE timerHandle = 0; DWORD dwWaitResult; __try { // return on 0 if (wait < 1) return; // create the timer timerHandle = (HANDLE) CreateWaitableTimerA(NULL, FALSE, NULL); // set the timer lElapse.QuadPart = 2500LL - (wait * 10000LL); succ = SetWaitableTimer(timerHandle, &lElapse, 0, NULL, NULL, FALSE); if (!succ) { printf( "set timer not successful!\n" ); } dwWaitResult = WaitForSingleObject( timerHandle, wait // fall back timeout with 15ms granularity ); switch (dwWaitResult) { // The thread got mutex ownership. case WAIT_OBJECT_0: //printf( "WAIT_OBJECT_0!\n" ); break; // Cannot get mutex ownership due to time-out. case WAIT_TIMEOUT: printf( "WAIT_TIMEOUT!\n" ); break; // Got ownership of the abandoned mutex object. case WAIT_ABANDONED: printf( "WAIT_ABANDONED!\n" ); break; } } __finally { if (timerHandle) CloseHandle(timerHandle); } } It may be hard work but: Its cool to be cross platform - you reach all people around we count on you ;) Thomas ________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Anthony Minessale Gesendet: Dienstag, 6. Mai 2008 15:08 An: freeswitch-users@lists.freeswitch.org Betreff: Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60msinsteadof1 packet/20ms if switch_yield for windows is not working properly maybe if we fix that the code will work as planned. 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. This is one of the many joys of being cross platform. =D On Tue, May 6, 2008 at 7:37 AM, Sluschny, Thomas <Thomas.Sluschny@siemens.com> wrote: Anthony seams to be right. I tested around a little bit and i see: - the main problem is the soundcard (-driver), it gives 480 frames all 60 ms - 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 ...) - i get really good results if i store the last timestamp when ReadAudioStream() returns, and if current timestamp is less than 20ms from last i wait 20 ms, so the packet difference went from 60-0-0-60-0-0 ms to 20-20-20-20-20-20 - i use HighPerformanceCounter to measure the time in WinXP I thought we could use switch_core_timer_check() to do that timestamp work, but it doesn't work as expected, seams we have to synchronize to the 60ms clock from soundcard, at least at the beginning, which means the delay increase. Thomas PS: i attach a patch for better understanding ________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Anthony Minessale Gesendet: Dienstag, 6. Mai 2008 00:38 An: freeswitch-users@lists.freeswitch.org Betreff: Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms insteadof1 packet/20ms 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. I appreciate the suggestion and I understand you are not trying to be a smart ass. On Mon, May 5, 2008 at 4:35 PM, Michael Jerris <mike@jerris.com> wrote: The place this is trickiest is when you are in a loop where you want to wait for audio, AND do something every x ms or so. You can't do a blocking read, and a read with timeout tends to be quite expensive. There are some ways around this, but sometimes its just the most efficient, even if not preferred method. Mike On May 5, 2008, at 5:26 PM, ?ukasz Zwierko wrote: > Hi, > > Just a thought here: using calls like delay(), sleep() etc. for very > short amount of time (like in this case a couple of miliseconds) > should in my opinion be really discouraged. It is often a symptom of > bad programming even in an embedded enviroment, not mentioning > platforms like Windows or Linux where you can't really tell what > priority does your task have, and will it not be starved for a long > time by other tasks. I should be avoided whenever possible. > Don't want to sound like a smart ass here, but isn't there any other > way? From what I understood you wait until some amount of voice > samples is collected? If that's the case than perhaps you can measure > an amount of data collected not the time... If these are PCM samples > than the correlation is straightforward. > Again, sorry if I'm being a smart ass here but I've seen some really > bad code with sleep() calls and such like, and I can tell you that it > only worked fine in specific conditions, and had a tendency to work > very poorly when for example CPU was under heavy load. > > Luaksz > > 2008/5/5 Anthony Minessale <anthony.minessale@gmail.com>: >> did you try setting the ptime on the rtp to 30 or 60ms >> >> when you choose a codec in your sip settings on FS in vars.xml, >> instead of >> PCMU try PCMU@30i or PCMU@60i >> it may be that the other side is doing 30 or 60 ms and not telling >> us. >> >> also in pablio.c in the portaudio_mod directory in ReadAudioStream >> func, >> there is a sleep 1 ms too >> if the windows is really sleeping a lot longer than that, try >> omitting line >> 158. >> 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. >> >> >> >> >> >> On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei >> <csaba.zelei@gmail.com> wrote: >>> >>> >>> >>> >>> 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) >>> However on windows the delta between rtp packets is 15-32 ms >>> randomly, >> with occasionally high 70-100ms delta. >>> I also tried to tweak the windows timer without success. >>> Does anybody has any idea how to make windows xp more accurate? >>> >>> Sluschny, Thomas wrote: >>> >>> >>> >>> >>> as you can see here: >>> >>> >>> http://jira.freeswitch.org/browse/MODENDP-40 >>> >>> i have this problem all the time (the error mentioned in this >>> issue was >> only related with this). >>> >>> It has to do with windows handle sleep() method, you has say >>> sleep(1) for >> 1ms but on my >>> >>> machine it waits 15ms (it depends on your hardware, other PCs behave >> different!). So i tested around with high performance counters. >>> >>> For now i ignore that problem an set jitterbuffers on other device >>> big >> enough. >>> >>> Thomas >>> >>> ________________________________ >> Von: freeswitch-users-bounces@lists.freeswitch.org >> [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag >> von Zelei >> Csaba >>> Gesendet: Donnerstag, 24. April 2008 19:05 >>> An: freeswitch-users@lists.freeswitch.org >>> Betreff: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms >>> instead >> of1 packet/20ms >>> >>> Dear all, >>> >>> I tried to use FS in client mode, starting calls with >>> mod_portaudio to our >> providers gateway ( a Cirpack softswitch ) >>> I experienced that there is 2-3 sec delay in the call, its choppy >>> and >> robot like. >>> 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. >>> >>> Here is an rtp statistic from a call: (see >> http://pastebin.freeswitch.org/4307 for the complete list and sip >> trace) >>> >>> Packet Sequence Delta (ms) >>> 42 26138 0.00 >>> 43 26139 0.02 >>> 46 26140 45.69 >>> 47 26141 0.02 >>> 48 26142 2.96 >>> 52 26143 56.31 >>> 53 26144 5.75 >>> 54 26145 0.02 >>> 58 26146 51.99 >>> 59 26147 0.03 >>> 60 26148 2.96 >>> 63 26149 42.95 >>> 65 26150 17.06 >>> 66 26151 0.02 >>> 67 26152 2.90 >>> 71 26153 56.99 >>> 72 26154 0.03 >>> 73 26155 0.02 >>> >>> Did anyone else experience similar problems? >>> Is this the desired behaviour, because portaudio get data in 60ms >>> interval >> or can I set it to 20ms somehow? >>> >>> Thanks, >>> >>> Csaba Zelei >>> >>> >>> ________________________________ >> >>> _______________________________________________ >>> Freeswitch-users mailing list >>> Freeswitch-users@lists.freeswitch.org >>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users >>> http://www.freeswitch.org >>> >>> >>> >>> Index: mod_portaudio.c >>> =================================================================== >>> --- mod_portaudio.c (revision 8260) >>> +++ mod_portaudio.c (working copy) >>> @@ -121,6 +121,7 @@ >>> int ring_interval; >>> GFLAGS flags; >>> switch_timer_t timer; >>> + switch_timer_t sync_timer; >>> } globals; >>> >>> >>> @@ -282,7 +283,15 @@ >>> } >>> >>> switch_set_flag_locked(tech_pvt, TFLAG_IO); >>> + >>> + /* Start Synchronization Timer */ >>> + //Is it ok to always use 20ms? What about the 160 sample???? >>> + if ( >> switch_core_timer_init(&globals.sync_timer,"soft", >> 20,160,switch_core_session_get_pool(session)) >> != SWITCH_STATUS_SUCCESS) >>> + { >>> + switch_log_printf(SWITCH_CHANNEL_LOG, >>> SWITCH_LOG_DEBUG, >> "Sync Timer failed!!\n"); >>> + } >>> >>> + >>> /* Move Channel's State Machine to RING */ >>> switch_channel_set_state(channel, CS_RING); >>> >>> @@ -412,6 +421,8 @@ >>> } >>> >>> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s >>> CHANNEL >> HANGUP\n", >> switch_channel_get_name(switch_core_session_get_channel(session))); >>> + /* Destroy timer */ >>> + switch_core_timer_destroy(&globals.sync_timer); >>> >>> return SWITCH_STATUS_SUCCESS; >>> } >>> @@ -542,12 +553,17 @@ >>> switch_mutex_lock(globals.device_lock); >>> >>> get_samples: >>> - >>> + >>> if ((samples = ReadAudioStream(globals.audio_stream, >> globals.read_frame.data, >>> >> globals.read_codec.implementation->samples_per_frame, >>> >> &globals.timer)) == 0) { >>> + >>> + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, >>> "No data >> reset timer\n"); >>> + switch_core_timer_sync(&globals.sync_timer); >>> switch_yield(1000); >>> + >>> goto get_samples; >>> + >>> } else { >>> globals.read_frame.datalen = samples * 2; >>> globals.read_frame.samples = samples; >>> @@ -562,7 +578,9 @@ >>> status = SWITCH_STATUS_SUCCESS; >>> } >>> switch_mutex_unlock(globals.device_lock); >>> - >>> + >>> + switch_core_timer_next(&globals.sync_timer); >>> + >>> return status; >>> >>> } >>> >>> >>> _______________________________________________ >>> Freeswitch-users mailing list >>> Freeswitch-users@lists.freeswitch.org >>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users >>> http://www.freeswitch.org >>> >>> >> >> >> >> -- >> Anthony Minessale II >> >> FreeSWITCH http://www.freeswitch.org/ >> ClueCon http://www.cluecon.com/ >> >> AIM: anthm >> MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> >> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> >> IRC: irc.freenode.net #freeswitch >> >> FreeSWITCH Developer Conference >> sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> >> iax:guest@conference.freeswitch.org/888 >> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> >> pstn:213-799-1400 >> _______________________________________________ >> Freeswitch-users mailing list >> Freeswitch-users@lists.freeswitch.org >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users >> http://www.freeswitch.org >> >> > > _______________________________________________ > Freeswitch-users mailing list > Freeswitch-users@lists.freeswitch.org > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users > http://www.freeswitch.org _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org -- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400 _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org -- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400 _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org -- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400 ________________________________ _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org -- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400 _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Have you tried setting the codec-ms in the portaudio.conf.xml to 60 or 120 ms? Maybe the soundcard is not able to do 20ms intervals and portaudio is doing the least common multiple and chopping it up for us. I think what's happening is the timer in the module is set to the interval from the config file (20ms) and during every 60ms period there is no audio until the last ms. so in each 60 ms: 20ms (timeout..... flush buffer) 20ms (timeout..... flush buffer) 20ms (get 60ms worth of audio at once [3 20ms packets] but we have already read 2 filler frames from the timeouts) So now we have read 5 packets instead of 3 and erased some of our buffer because of perceived timeouts. The code is using the assumption that if the device will obey the chosen frame size and sample rate requests down to the interval. If you find and edit conf/autoload_configs/portaudio.conf.xml look for this: <param name="codec-ms" value="20"/> and change 20 to 60 Setting this to 60 will change the frame size of all the packets from 320 to 960 and set the timer to clock at an interval of 60ms Since the card seems to be able to reliably produce 3 20ms packets every 60ms it should also be able to produce 1 60ms packet. FreeSWITCH should then buffer the audio and still deliver it over SIP at 20ms if you want but you can opt to set the codec PCMU@60i to disable buffering if you are in a reliable network. The same should be true for setting the codec-ms to 120 On Wed, May 7, 2008 at 3:27 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
Hi Anthony,
i also tested your patch with no success. As i already described below, the problem with all 60ms 3 packets comes from the soundcard. The hardware delivers its samples all 60 ms. Our problem is (like Csaba said) that we read out the buffer after 60ms, 3 times, each with samples for 20ms, AND WITH NO DELAY! 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.
In my patch i wait appr.20 ms if last method call was no longer than 4ms ago, but i think we can do better with switch_core_timer_check() method, but i don't know exactly how.
You are absolutly right with your demand for a better timing resolution under Windows, but this 60ms mystery is caused by the soundcard.
Thomas
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Zelei Csaba *Gesendet:* Dienstag, 6. Mai 2008 20:22
*An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3 rtppacket/60msinsteadof1 packet/20ms
Yes, but it didnt help with portaudio (just together with the patch) What else do you need to test it with? Please tell me, and i will do it for you tomorrow. I also found a test code for timeBeginPeriod on this site: http://www.geisswerks.com/ryan/FAQS/timing.html and experienced that sleep(1) is usually 2 ms long (sometimes 4)
2008/5/6 Anthony Minessale <anthony.minessale@gmail.com>:
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.
On Tue, May 6, 2008 at 10:59 AM, Csaba Zelei <csaba.zelei@gmail.com> wrote:
Hi Anthony,
I tried your suggestions (the PCMU@30i 60i and omitting line 158 in pablio.c) but none solve the problem. I also tried the latest trunk but its the same. I reached the best performance with the latest trunk and the patch Thomas wrote.(~20ms rtp packet delta, rarely 100+ms) 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.
If I am correct we have 2 problem here. The first is windows timer isnt very accurate. The second is that mod_portaudio dont have any delay when it can return audio data immadiately . Let me explain:
1. call for channel_read_frame 2. waiting for audio data (~60ms) 3. got 60ms audio data 4. get 20ms (remaining 40ms) audio data, return (and send rtp frame) 5. call for channel_read_frame 6. get 20ms, return(and send rtp frame) within ~1ms 7. call for channel_read_frame 8. get 20ms, return(and send rtp frame) within ~1ms go back to 1 and start again
That's what I tried to solve with my patch, but because of the windows timer it failed. I hope I could help, and dont misunderstand something.
Csaba
Anthony Minessale írta:
I added a small patch to turn up the resolution of Sleep to 1ms. Can you see if that helps?
On Tue, May 6, 2008 at 8:38 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
i already tried to implement such a routine, but as i remember i had problems to compile, anyway this may be help you:
// sleep with smaller tick time, wait in µs void betterSleep(long wait) { LARGE_INTEGER lElapse; BOOL succ; HANDLE timerHandle = 0; DWORD dwWaitResult;
__try {
// return on 0 if (wait < 1) return;
// create the timer timerHandle = (HANDLE) CreateWaitableTimerA(NULL, FALSE, NULL);
// set the timer lElapse.QuadPart = 2500LL - (wait * 10000LL); succ = SetWaitableTimer(timerHandle, &lElapse, 0, NULL, NULL, FALSE);
if (!succ) { printf( "set timer not successful!\n" ); }
dwWaitResult = WaitForSingleObject( timerHandle, wait // fall back timeout with 15ms granularity );
switch (dwWaitResult) { // The thread got mutex ownership. case WAIT_OBJECT_0: //printf( "WAIT_OBJECT_0!\n" ); break;
// Cannot get mutex ownership due to time-out. case WAIT_TIMEOUT: printf( "WAIT_TIMEOUT!\n" ); break;
// Got ownership of the abandoned mutex object. case WAIT_ABANDONED: printf( "WAIT_ABANDONED!\n" ); break; } } __finally { if (timerHandle) CloseHandle(timerHandle); } }
It may be hard work but: Its cool to be cross platform - you reach all people around we count on you ;)
Thomas
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Anthony Minessale *Gesendet:* Dienstag, 6. Mai 2008 15:08 *An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60msinsteadof1 packet/20ms
if switch_yield for windows is not working properly maybe if we fix that the code will work as planned.
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.
This is one of the many joys of being cross platform. =D
On Tue, May 6, 2008 at 7:37 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
Anthony seams to be right. I tested around a little bit and i see: - the main problem is the soundcard (-driver), it gives 480 frames all 60 ms - 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 ...) - i get really good results if i store the last timestamp when ReadAudioStream() returns, and if current timestamp is less than 20ms from last i wait 20 ms, so the packet difference went from 60-0-0-60-0-0 ms to 20-20-20-20-20-20 - i use HighPerformanceCounter to measure the time in WinXP
I thought we could use switch_core_timer_check() to do that timestamp work, but it doesn't work as expected, seams we have to synchronize to the 60ms clock from soundcard, at least at the beginning, which means the delay increase.
Thomas
PS: i attach a patch for better understanding
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Anthony Minessale *Gesendet:* Dienstag, 6. Mai 2008 00:38 *An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms insteadof1 packet/20ms
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.
I appreciate the suggestion and I understand you are not trying to be a smart ass.
On Mon, May 5, 2008 at 4:35 PM, Michael Jerris <mike@jerris.com> wrote:
The place this is trickiest is when you are in a loop where you want to wait for audio, AND do something every x ms or so. You can't do a blocking read, and a read with timeout tends to be quite expensive. There are some ways around this, but sometimes its just the most efficient, even if not preferred method.
Mike
On May 5, 2008, at 5:26 PM, ?ukasz Zwierko wrote:
> Hi, > > Just a thought here: using calls like delay(), sleep() etc. for very > short amount of time (like in this case a couple of miliseconds) > should in my opinion be really discouraged. It is often a symptom of > bad programming even in an embedded enviroment, not mentioning > platforms like Windows or Linux where you can't really tell what > priority does your task have, and will it not be starved for a long > time by other tasks. I should be avoided whenever possible. > Don't want to sound like a smart ass here, but isn't there any other > way? From what I understood you wait until some amount of voice > samples is collected? If that's the case than perhaps you can measure > an amount of data collected not the time... If these are PCM samples > than the correlation is straightforward. > Again, sorry if I'm being a smart ass here but I've seen some really > bad code with sleep() calls and such like, and I can tell you that it > only worked fine in specific conditions, and had a tendency to work > very poorly when for example CPU was under heavy load. > > Luaksz > > 2008/5/5 Anthony Minessale <anthony.minessale@gmail.com>: >> did you try setting the ptime on the rtp to 30 or 60ms >> >> when you choose a codec in your sip settings on FS in vars.xml, >> instead of >> PCMU try PCMU@30i or PCMU@60i >> it may be that the other side is doing 30 or 60 ms and not telling >> us. >> >> also in pablio.c in the portaudio_mod directory in ReadAudioStream >> func, >> there is a sleep 1 ms too >> if the windows is really sleeping a lot longer than that, try >> omitting line >> 158. >> 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. >> >> >> >> >> >> On Mon, May 5, 2008 at 11:38 AM, Csaba Zelei >> <csaba.zelei@gmail.com> wrote: >>> >>> >>> >>> >>> 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) >>> However on windows the delta between rtp packets is 15-32 ms >>> randomly, >> with occasionally high 70-100ms delta. >>> I also tried to tweak the windows timer without success. >>> Does anybody has any idea how to make windows xp more accurate? >>> >>> Sluschny, Thomas wrote: >>> >>> >>> >>> >>> as you can see here: >>> >>> >>> http://jira.freeswitch.org/browse/MODENDP-40 >>> >>> i have this problem all the time (the error mentioned in this >>> issue was >> only related with this). >>> >>> It has to do with windows handle sleep() method, you has say >>> sleep(1) for >> 1ms but on my >>> >>> machine it waits 15ms (it depends on your hardware, other PCs behave >> different!). So i tested around with high performance counters. >>> >>> For now i ignore that problem an set jitterbuffers on other device >>> big >> enough. >>> >>> Thomas >>> >>> ________________________________ >> Von: freeswitch-users-bounces@lists.freeswitch.org >> [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag >> von Zelei >> Csaba >>> Gesendet: Donnerstag, 24. April 2008 19:05 >>> An: freeswitch-users@lists.freeswitch.org >>> Betreff: [Freeswitch-users] mod_portaudio send 3 rtp packet/60ms >>> instead >> of1 packet/20ms >>> >>> Dear all, >>> >>> I tried to use FS in client mode, starting calls with >>> mod_portaudio to our >> providers gateway ( a Cirpack softswitch ) >>> I experienced that there is 2-3 sec delay in the call, its choppy >>> and >> robot like. >>> 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. >>> >>> Here is an rtp statistic from a call: (see >> http://pastebin.freeswitch.org/4307 for the complete list and sip >> trace) >>> >>> Packet Sequence Delta (ms) >>> 42 26138 0.00 >>> 43 26139 0.02 >>> 46 26140 45.69 >>> 47 26141 0.02 >>> 48 26142 2.96 >>> 52 26143 56.31 >>> 53 26144 5.75 >>> 54 26145 0.02 >>> 58 26146 51.99 >>> 59 26147 0.03 >>> 60 26148 2.96 >>> 63 26149 42.95 >>> 65 26150 17.06 >>> 66 26151 0.02 >>> 67 26152 2.90 >>> 71 26153 56.99 >>> 72 26154 0.03 >>> 73 26155 0.02 >>> >>> Did anyone else experience similar problems? >>> Is this the desired behaviour, because portaudio get data in 60ms >>> interval >> or can I set it to 20ms somehow? >>> >>> Thanks, >>> >>> Csaba Zelei >>> >>> >>> ________________________________ >> >>> _______________________________________________ >>> Freeswitch-users mailing list >>> Freeswitch-users@lists.freeswitch.org >>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >>> UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users >>> http://www.freeswitch.org >>> >>> >>> >>> Index: mod_portaudio.c >>> =================================================================== >>> --- mod_portaudio.c (revision 8260) >>> +++ mod_portaudio.c (working copy) >>> @@ -121,6 +121,7 @@ >>> int ring_interval; >>> GFLAGS flags; >>> switch_timer_t timer; >>> + switch_timer_t sync_timer; >>> } globals; >>> >>> >>> @@ -282,7 +283,15 @@ >>> } >>> >>> switch_set_flag_locked(tech_pvt, TFLAG_IO); >>> + >>> + /* Start Synchronization Timer */ >>> + //Is it ok to always use 20ms? What about the 160 sample???? >>> + if ( >> switch_core_timer_init(&globals.sync_timer,"soft", >> 20,160,switch_core_session_get_pool(session)) >> != SWITCH_STATUS_SUCCESS) >>> + { >>> + switch_log_printf(SWITCH_CHANNEL_LOG, >>> SWITCH_LOG_DEBUG, >> "Sync Timer failed!!\n"); >>> + } >>> >>> + >>> /* Move Channel's State Machine to RING */ >>> switch_channel_set_state(channel, CS_RING); >>> >>> @@ -412,6 +421,8 @@ >>> } >>> >>> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s >>> CHANNEL >> HANGUP\n", >> switch_channel_get_name(switch_core_session_get_channel(session))); >>> + /* Destroy timer */ >>> + switch_core_timer_destroy(&globals.sync_timer); >>> >>> return SWITCH_STATUS_SUCCESS; >>> } >>> @@ -542,12 +553,17 @@ >>> switch_mutex_lock(globals.device_lock); >>> >>> get_samples: >>> - >>> + >>> if ((samples = ReadAudioStream(globals.audio_stream, >> globals.read_frame.data, >>> >> globals.read_codec.implementation->samples_per_frame, >>> >> &globals.timer)) == 0) { >>> + >>> + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, >>> "No data >> reset timer\n"); >>> + switch_core_timer_sync(&globals.sync_timer); >>> switch_yield(1000); >>> + >>> goto get_samples; >>> + >>> } else { >>> globals.read_frame.datalen = samples * 2; >>> globals.read_frame.samples = samples; >>> @@ -562,7 +578,9 @@ >>> status = SWITCH_STATUS_SUCCESS; >>> } >>> switch_mutex_unlock(globals.device_lock); >>> - >>> + >>> + switch_core_timer_next(&globals.sync_timer); >>> + >>> return status; >>> >>> } >>> >>> >>> _______________________________________________ >>> Freeswitch-users mailing list >>> Freeswitch-users@lists.freeswitch.org >>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >>> UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users >>> http://www.freeswitch.org >>> >>> >> >> >> >> -- >> Anthony Minessale II >> >> FreeSWITCH http://www.freeswitch.org/ >> ClueCon http://www.cluecon.com/ >> >> AIM: anthm >> MSN:anthony_minessale@hotmail.com<MSN%3Aanthony_minessale@hotmail.com> >> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> >> IRC: irc.freenode.net #freeswitch >> >> FreeSWITCH Developer Conference >> sip:888@conference.freeswitch.org<sip%3A888@conference.freeswitch.org> >> iax:guest@conference.freeswitch.org/888 >> googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> >> pstn:213-799-1400 >> _______________________________________________ >> Freeswitch-users mailing list >> Freeswitch-users@lists.freeswitch.org >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >> UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users >> http://www.freeswitch.org >> >> > > _______________________________________________ > Freeswitch-users mailing list > Freeswitch-users@lists.freeswitch.org > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users > UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users > http://www.freeswitch.org
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com<MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org<sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com<MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org<sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com<MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org<sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
------------------------------
_______________________________________________ Freeswitch-users mailing listFreeswitch-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.frees...
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
I tried it with the latest trunk. If I set it to 60ms sometimes I still get <1ms rtp packet delta, if I set it to 120ms then there is none The rtp packet delta is still random within 50-70ms with sometimes too low 15-30ms, sometimes too high 100-150ms delta (with codec-ms = 60ms), and with 15-20ms jitter. Anthony Minessale wrote:
Have you tried setting the codec-ms in the portaudio.conf.xml to 60 or 120 ms? Maybe the soundcard is not able to do 20ms intervals and portaudio is doing the least common multiple and chopping it up for us. I think what's happening is the timer in the module is set to the interval from the config file (20ms) and during every 60ms period there is no audio until the last ms. so in each 60 ms:
20ms (timeout..... flush buffer) 20ms (timeout..... flush buffer) 20ms (get 60ms worth of audio at once [3 20ms packets] but we have already read 2 filler frames from the timeouts)
So now we have read 5 packets instead of 3 and erased some of our buffer because of perceived timeouts. The code is using the assumption that if the device will obey the chosen frame size and sample rate requests down to the interval.
If you find and edit conf/autoload_configs/portaudio.conf.xml
look for this:
<param name="codec-ms" value="20"/>
and change 20 to 60
Setting this to 60 will change the frame size of all the packets from 320 to 960 and set the timer to clock at an interval of 60ms Since the card seems to be able to reliably produce 3 20ms packets every 60ms it should also be able to produce 1 60ms packet.
FreeSWITCH should then buffer the audio and still deliver it over SIP at 20ms if you want but you can opt to set the codec PCMU@60i to disable buffering if you are in a reliable network.
The same should be true for setting the codec-ms to 120
On Wed, May 7, 2008 at 3:27 AM, Sluschny, Thomas <Thomas.Sluschny@siemens.com <mailto:Thomas.Sluschny@siemens.com>> wrote:
Hi Anthony,
i also tested your patch with no success. As i already described below, the problem with all 60ms 3 packets comes from the soundcard. The hardware delivers its samples all 60 ms. Our problem is (like Csaba said) that we read out the buffer after 60ms, 3 times, each with samples for 20ms, AND WITH NO DELAY! 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.
In my patch i wait appr.20 ms if last method call was no longer than 4ms ago, but i think we can do better with switch_core_timer_check() method, but i don't know exactly how.
You are absolutly right with your demand for a better timing resolution under Windows, but this 60ms mystery is caused by the soundcard.
Thomas
------------------------------------------------------------------------
I get always 3 RTP packets at once with 60ms setting, i also test with PCMU@60i in vars.xml but i always get 20ms packets with 160byres packet size. Anthony, you are right with you "timeout assumption". To illustrate, here a log from my patch without waiting, i. e. no functional difference: 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594577 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594577 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594577 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594579 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594579 ms : after Wait... (960 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594581 ms : all 320 Bytes read (640 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (640 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594582 ms : all 320 Bytes read (320 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (320 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594582 ms : all 320 Bytes read (0 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594582 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594582 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594583 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594583 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594585 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594585 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594587 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594587 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594589 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594589 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594591 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594593 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594593 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594593 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594595 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594595 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594597 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594597 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594599 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594599 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594601 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594601 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594603 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594603 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594605 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594605 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594607 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594609 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594609 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594609 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594611 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594611 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594613 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594613 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594615 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594615 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594617 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594617 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594618 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594618 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594620 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594620 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594622 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594624 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594624 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594624 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594626 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594626 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594628 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594628 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594630 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594630 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594632 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594632 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594634 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594634 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594636 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594636 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594638 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594638 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594640 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594640 ms : after Wait... (960 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (640 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (640 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (320 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (320 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (0 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594642 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594642 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594644 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594644 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594646 ms : before Wait... So i want use the timer to prevent these buffer read bursts all 60ms. All 3 x 320 bytes are used for RTP packets, so samples are not lost (only during the first 2 timeouts, but this is irrelevant). And if you like logs ;), here are the behavior with 60ms in portaudio.xml: 2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511260 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511260 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511260 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511262 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511262 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511264 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511264 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511266 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511266 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511268 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511268 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511270 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511270 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511272 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511272 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511274 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511274 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511276 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511276 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511278 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511278 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511279 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511279 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511281 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511281 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511283 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511283 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511285 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511285 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511287 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511287 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511289 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511289 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511291 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511291 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511293 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511293 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:167 ReadAudioStream() 116511295 ms : timer timed out (0 Bytes readable)! 2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511297 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511297 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511297 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511299 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511299 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511301 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511301 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511303 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511303 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511305 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511305 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511307 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511307 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511309 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511309 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511311 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511311 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511313 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511313 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511315 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511315 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511317 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511317 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511318 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511318 ms : after Wait... (960 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:184 ReadAudioStream() 116511321 ms : all 960 Bytes read (0 Bytes readable), exit. 2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511321 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511321 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511321 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511322 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511322 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511324 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511324 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511326 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511326 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511328 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511328 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511330 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511330 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511332 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511332 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511334 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511334 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511336 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511336 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511338 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511338 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511340 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511340 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511342 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511342 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511344 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511344 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511346 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511346 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511348 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511348 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511350 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511350 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511352 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511352 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511354 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511354 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511356 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511356 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:167 ReadAudioStream() 116511358 ms : timer timed out (0 Bytes readable)! 2008-05-07 17:09:05 [DEBUG] pablio.c:156 ReadAudioStream() 116511359 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511360 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511360 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511361 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511361 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511363 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511363 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511365 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511365 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511367 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511367 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511369 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511369 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511371 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511371 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511373 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511373 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511375 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511375 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511377 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511377 ms : after Wait... (960 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:184 ReadAudioStream() 116511379 ms : all 960 Bytes read (0 Bytes readable), exit. Strange timeout after 35...40ms, or should it be? Thomas ________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Csaba Zelei Gesendet: Mittwoch, 7. Mai 2008 16:46 An: freeswitch-users@lists.freeswitch.org Betreff: Re: [Freeswitch-users] mod_portaudio send 3 rtppacket/60msinsteadof1 packet/20ms I tried it with the latest trunk. If I set it to 60ms sometimes I still get <1ms rtp packet delta, if I set it to 120ms then there is none The rtp packet delta is still random within 50-70ms with sometimes too low 15-30ms, sometimes too high 100-150ms delta (with codec-ms = 60ms), and with 15-20ms jitter. Anthony Minessale wrote: Have you tried setting the codec-ms in the portaudio.conf.xml to 60 or 120 ms? Maybe the soundcard is not able to do 20ms intervals and portaudio is doing the least common multiple and chopping it up for us. I think what's happening is the timer in the module is set to the interval from the config file (20ms) and during every 60ms period there is no audio until the last ms. so in each 60 ms: 20ms (timeout..... flush buffer) 20ms (timeout..... flush buffer) 20ms (get 60ms worth of audio at once [3 20ms packets] but we have already read 2 filler frames from the timeouts) So now we have read 5 packets instead of 3 and erased some of our buffer because of perceived timeouts. The code is using the assumption that if the device will obey the chosen frame size and sample rate requests down to the interval. If you find and edit conf/autoload_configs/portaudio.conf.xml look for this: <param name="codec-ms" value="20"/> and change 20 to 60 Setting this to 60 will change the frame size of all the packets from 320 to 960 and set the timer to clock at an interval of 60ms Since the card seems to be able to reliably produce 3 20ms packets every 60ms it should also be able to produce 1 60ms packet. FreeSWITCH should then buffer the audio and still deliver it over SIP at 20ms if you want but you can opt to set the codec PCMU@60i to disable buffering if you are in a reliable network. The same should be true for setting the codec-ms to 120 On Wed, May 7, 2008 at 3:27 AM, Sluschny, Thomas <Thomas.Sluschny@siemens.com> wrote: Hi Anthony, i also tested your patch with no success. As i already described below, the problem with all 60ms 3 packets comes from the soundcard. The hardware delivers its samples all 60 ms. Our problem is (like Csaba said) that we read out the buffer after 60ms, 3 times, each with samples for 20ms, AND WITH NO DELAY! 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. In my patch i wait appr.20 ms if last method call was no longer than 4ms ago, but i think we can do better with switch_core_timer_check() method, but i don't know exactly how. You are absolutly right with your demand for a better timing resolution under Windows, but this 60ms mystery is caused by the soundcard. Thomas ________________________________
ok, please try 8295 at all combinations of codec-ms etc. I changed the code to snoop the ringbuffer and make sure 2 frames worth of audio as accumulated before i read from it. On Wed, May 7, 2008 at 10:13 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
I get always 3 RTP packets at once with 60ms setting, i also test with PCMU@60i in vars.xml but i always get 20ms packets with 160byres packet size.
Anthony, you are right with you "timeout assumption". To illustrate, here a log from my patch without waiting, i. e. no functional difference:
2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594577 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594577 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594577 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594579 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594579 ms : after Wait... (960 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594581 ms : all 320 Bytes read (640 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (640 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594582 ms : all 320 Bytes read (320 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (320 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594582 ms : all 320 Bytes read (0 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594582 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594582 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594583 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594583 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594585 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594585 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594587 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594587 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594589 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594589 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594591 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594593 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594593 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594593 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594595 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594595 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594597 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594597 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594599 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594599 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594601 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594601 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594603 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594603 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594605 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594605 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594607 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594609 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594609 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594609 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594611 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594611 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594613 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594613 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594615 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594615 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594617 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594617 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594618 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594618 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594620 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594620 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594622 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594624 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594624 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594624 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594626 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594626 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594628 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594628 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594630 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594630 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594632 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594632 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594634 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594634 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594636 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594636 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594638 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594638 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594640 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594640 ms : after Wait... (960 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (640 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (640 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (320 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (320 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (0 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594642 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594642 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594644 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594644 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594646 ms : before Wait... So i want use the timer to prevent these buffer read bursts all 60ms. All 3 x 320 bytes are used for RTP packets, so samples are not lost (only during the first 2 timeouts, but this is irrelevant).
And if you like logs ;), here are the behavior with 60ms in portaudio.xml:
2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511260 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511260 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511260 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511262 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511262 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511264 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511264 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511266 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511266 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511268 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511268 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511270 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511270 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511272 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511272 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511274 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511274 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511276 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511276 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511278 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511278 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511279 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511279 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511281 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511281 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511283 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511283 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511285 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511285 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511287 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511287 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511289 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511289 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511291 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511291 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511293 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511293 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:167 ReadAudioStream() 116511295 ms : timer timed out (0 Bytes readable)! 2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511297 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511297 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511297 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511299 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511299 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511301 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511301 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511303 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511303 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511305 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511305 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511307 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511307 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511309 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511309 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511311 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511311 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511313 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511313 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511315 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511315 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511317 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511317 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511318 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511318 ms : after Wait... (960 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:184 ReadAudioStream() 116511321 ms : all 960 Bytes read (0 Bytes readable), exit. 2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511321 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511321 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511321 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511322 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511322 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511324 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511324 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511326 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511326 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511328 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511328 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511330 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511330 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511332 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511332 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511334 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511334 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511336 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511336 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511338 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511338 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511340 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511340 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511342 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511342 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511344 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511344 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511346 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511346 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511348 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511348 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511350 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511350 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511352 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511352 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511354 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511354 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511356 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511356 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:167 ReadAudioStream() 116511358 ms : timer timed out (0 Bytes readable)! 2008-05-07 17:09:05 [DEBUG] pablio.c:156 ReadAudioStream() 116511359 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511360 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511360 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511361 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511361 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511363 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511363 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511365 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511365 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511367 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511367 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511369 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511369 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511371 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511371 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511373 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511373 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511375 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511375 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511377 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511377 ms : after Wait... (960 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:184 ReadAudioStream() 116511379 ms : all 960 Bytes read (0 Bytes readable), exit. Strange timeout after 35...40ms, or should it be?
Thomas
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Csaba Zelei *Gesendet:* Mittwoch, 7. Mai 2008 16:46 *An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3 rtppacket/60msinsteadof1 packet/20ms
I tried it with the latest trunk. If I set it to 60ms sometimes I still get <1ms rtp packet delta, if I set it to 120ms then there is none The rtp packet delta is still random within 50-70ms with sometimes too low 15-30ms, sometimes too high 100-150ms delta (with codec-ms = 60ms), and with 15-20ms jitter.
Anthony Minessale wrote:
Have you tried setting the codec-ms in the portaudio.conf.xml to 60 or 120 ms? Maybe the soundcard is not able to do 20ms intervals and portaudio is doing the least common multiple and chopping it up for us. I think what's happening is the timer in the module is set to the interval from the config file (20ms) and during every 60ms period there is no audio until the last ms. so in each 60 ms:
20ms (timeout..... flush buffer) 20ms (timeout..... flush buffer) 20ms (get 60ms worth of audio at once [3 20ms packets] but we have already read 2 filler frames from the timeouts)
So now we have read 5 packets instead of 3 and erased some of our buffer because of perceived timeouts. The code is using the assumption that if the device will obey the chosen frame size and sample rate requests down to the interval.
If you find and edit conf/autoload_configs/portaudio.conf.xml
look for this:
<param name="codec-ms" value="20"/>
and change 20 to 60
Setting this to 60 will change the frame size of all the packets from 320 to 960 and set the timer to clock at an interval of 60ms Since the card seems to be able to reliably produce 3 20ms packets every 60ms it should also be able to produce 1 60ms packet.
FreeSWITCH should then buffer the audio and still deliver it over SIP at 20ms if you want but you can opt to set the codec PCMU@60i to disable buffering if you are in a reliable network.
The same should be true for setting the codec-ms to 120
On Wed, May 7, 2008 at 3:27 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
Hi Anthony,
i also tested your patch with no success. As i already described below, the problem with all 60ms 3 packets comes from the soundcard. The hardware delivers its samples all 60 ms. Our problem is (like Csaba said) that we read out the buffer after 60ms, 3 times, each with samples for 20ms, AND WITH NO DELAY! 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.
In my patch i wait appr.20 ms if last method call was no longer than 4ms ago, but i think we can do better with switch_core_timer_check() method, but i don't know exactly how.
You are absolutly right with your demand for a better timing resolution under Windows, but this 60ms mystery is caused by the soundcard.
Thomas
------------------------------
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
i tested with 8296 now in all combinations, but allways the same as before, 3 RTP packets all 60ms: now 2 frames accumulated (1 frame = 320 bytes always readable), but switch_core_timer_sync() is not waiting 20ms. I think its because at the beginning we get late by 2 frames, as you described (2 timeouts at the beginning), so the timer is lag behind the buffer. there the log for 20ms in portaudio.xml and vars.xml: 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664138 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664138 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664139 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664139 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664141 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664141 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664143 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664143 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664145 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664145 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664147 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664147 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664149 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664149 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664151 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664151 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664153 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664153 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664155 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664155 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664157 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664157 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664159 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664159 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664161 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664161 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664163 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664163 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664165 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664165 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664167 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664167 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664169 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664169 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664171 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664171 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664173 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664173 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664175 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:174 ReadAudioStream() 177664175 ms : timer timed out (320 Bytes readable)! 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664175 ms : Return with 0 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664176 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664177 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664178 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664178 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664180 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664180 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664182 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664182 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664184 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664184 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664186 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664186 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664188 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664188 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664190 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664190 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664192 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664192 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664194 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664194 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664196 ms : after Wait... (1280 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664196 ms : after switch_core_timer_sync()... (960 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664196 ms : Return with 160 Bytes read (960 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664196 ms : Beginning (960 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664196 ms : after switch_core_timer_sync()... (640 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664196 ms : Return with 160 Bytes read (640 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664197 ms : Beginning (640 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664197 ms : after switch_core_timer_sync()... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664197 ms : Return with 160 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664197 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664197 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664198 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664198 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664200 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664200 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664202 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664202 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664204 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664204 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664206 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664206 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664208 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664208 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664210 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664210 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664212 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664212 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664214 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664214 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664216 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664216 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664217 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664218 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664219 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664220 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664221 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664221 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664223 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664223 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664225 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664225 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664227 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664227 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664229 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664229 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664231 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664231 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664233 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664233 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664235 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664235 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664237 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:174 ReadAudioStream() 177664237 ms : timer timed out (320 Bytes readable)! 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664237 ms : Return with 0 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664239 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664239 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664241 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664241 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664243 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664243 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664245 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664245 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664247 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664247 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664249 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664249 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664251 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664251 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664253 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664253 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664255 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664255 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664257 ms : after Wait... (1280 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664257 ms : after switch_core_timer_sync()... (960 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664257 ms : Return with 160 Bytes read (960 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664257 ms : Beginning (960 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664257 ms : after switch_core_timer_sync()... (640 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664257 ms : Return with 160 Bytes read (640 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664257 ms : Beginning (640 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664257 ms : after switch_core_timer_sync()... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664257 ms : Return with 160 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664257 ms : Beginning (320 Bytes readable) ... Thomas ________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Anthony Minessale Gesendet: Mittwoch, 7. Mai 2008 18:50 An: freeswitch-users@lists.freeswitch.org Betreff: Re: [Freeswitch-users] mod_portaudio send 3rtppacket/60msinsteadof1 packet/20ms ok, please try 8295 at all combinations of codec-ms etc. I changed the code to snoop the ringbuffer and make sure 2 frames worth of audio as accumulated before i read from it. On Wed, May 7, 2008 at 10:13 AM, Sluschny, Thomas <Thomas.Sluschny@siemens.com> wrote: I get always 3 RTP packets at once with 60ms setting, i also test with PCMU@60i in vars.xml but i always get 20ms packets with 160byres packet size. Anthony, you are right with you "timeout assumption". To illustrate, here a log from my patch without waiting, i. e. no functional difference: 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594577 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594577 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594577 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594579 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594579 ms : after Wait... (960 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594581 ms : all 320 Bytes read (640 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (640 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594582 ms : all 320 Bytes read (320 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (320 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594582 ms : all 320 Bytes read (0 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594582 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594582 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594583 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594583 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594585 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594585 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594587 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594587 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594589 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594589 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594591 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594593 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594593 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594593 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594595 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594595 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594597 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594597 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594599 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594599 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594601 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594601 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594603 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594603 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594605 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594605 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594607 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594609 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594609 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594609 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594611 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594611 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594613 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594613 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594615 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594615 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594617 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594617 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594618 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594618 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594620 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594620 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594622 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594624 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594624 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594624 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594626 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594626 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594628 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594628 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594630 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594630 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594632 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594632 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594634 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594634 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594636 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594636 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594638 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594638 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594640 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594640 ms : after Wait... (960 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (640 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (640 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (320 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (320 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (0 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594642 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594642 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594644 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594644 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594646 ms : before Wait... So i want use the timer to prevent these buffer read bursts all 60ms. All 3 x 320 bytes are used for RTP packets, so samples are not lost (only during the first 2 timeouts, but this is irrelevant). And if you like logs ;), here are the behavior with 60ms in portaudio.xml: 2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511260 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511260 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511260 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511262 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511262 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511264 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511264 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511266 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511266 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511268 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511268 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511270 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511270 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511272 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511272 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511274 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511274 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511276 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511276 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511278 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511278 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511279 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511279 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511281 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511281 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511283 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511283 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511285 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511285 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511287 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511287 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511289 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511289 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511291 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511291 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511293 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511293 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:167 ReadAudioStream() 116511295 ms : timer timed out (0 Bytes readable)! 2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511297 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511297 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511297 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511299 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511299 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511301 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511301 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511303 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511303 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511305 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511305 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511307 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511307 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511309 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511309 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511311 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511311 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511313 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511313 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511315 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511315 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511317 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511317 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511318 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511318 ms : after Wait... (960 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:184 ReadAudioStream() 116511321 ms : all 960 Bytes read (0 Bytes readable), exit. 2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511321 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511321 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511321 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511322 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511322 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511324 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511324 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511326 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511326 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511328 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511328 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511330 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511330 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511332 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511332 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511334 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511334 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511336 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511336 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511338 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511338 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511340 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511340 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511342 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511342 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511344 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511344 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511346 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511346 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511348 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511348 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511350 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511350 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511352 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511352 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511354 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511354 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511356 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511356 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:167 ReadAudioStream() 116511358 ms : timer timed out (0 Bytes readable)! 2008-05-07 17:09:05 [DEBUG] pablio.c:156 ReadAudioStream() 116511359 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511360 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511360 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511361 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511361 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511363 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511363 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511365 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511365 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511367 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511367 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511369 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511369 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511371 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511371 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511373 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511373 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511375 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511375 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511377 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511377 ms : after Wait... (960 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:184 ReadAudioStream() 116511379 ms : all 960 Bytes read (0 Bytes readable), exit. Strange timeout after 35...40ms, or should it be? Thomas ________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Csaba Zelei Gesendet: Mittwoch, 7. Mai 2008 16:46 An: freeswitch-users@lists.freeswitch.org Betreff: Re: [Freeswitch-users] mod_portaudio send 3 rtppacket/60msinsteadof1 packet/20ms I tried it with the latest trunk. If I set it to 60ms sometimes I still get <1ms rtp packet delta, if I set it to 120ms then there is none The rtp packet delta is still random within 50-70ms with sometimes too low 15-30ms, sometimes too high 100-150ms delta (with codec-ms = 60ms), and with 15-20ms jitter. Anthony Minessale wrote: Have you tried setting the codec-ms in the portaudio.conf.xml to 60 or 120 ms? Maybe the soundcard is not able to do 20ms intervals and portaudio is doing the least common multiple and chopping it up for us. I think what's happening is the timer in the module is set to the interval from the config file (20ms) and during every 60ms period there is no audio until the last ms. so in each 60 ms: 20ms (timeout..... flush buffer) 20ms (timeout..... flush buffer) 20ms (get 60ms worth of audio at once [3 20ms packets] but we have already read 2 filler frames from the timeouts) So now we have read 5 packets instead of 3 and erased some of our buffer because of perceived timeouts. The code is using the assumption that if the device will obey the chosen frame size and sample rate requests down to the interval. If you find and edit conf/autoload_configs/portaudio.conf.xml look for this: <param name="codec-ms" value="20"/> and change 20 to 60 Setting this to 60 will change the frame size of all the packets from 320 to 960 and set the timer to clock at an interval of 60ms Since the card seems to be able to reliably produce 3 20ms packets every 60ms it should also be able to produce 1 60ms packet. FreeSWITCH should then buffer the audio and still deliver it over SIP at 20ms if you want but you can opt to set the codec PCMU@60i to disable buffering if you are in a reliable network. The same should be true for setting the codec-ms to 120 On Wed, May 7, 2008 at 3:27 AM, Sluschny, Thomas <Thomas.Sluschny@siemens.com> wrote: Hi Anthony, i also tested your patch with no success. As i already described below, the problem with all 60ms 3 packets comes from the soundcard. The hardware delivers its samples all 60 ms. Our problem is (like Csaba said) that we read out the buffer after 60ms, 3 times, each with samples for 20ms, AND WITH NO DELAY! 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. In my patch i wait appr.20 ms if last method call was no longer than 4ms ago, but i think we can do better with switch_core_timer_check() method, but i don't know exactly how. You are absolutly right with your demand for a better timing resolution under Windows, but this 60ms mystery is caused by the soundcard. Thomas ________________________________ _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org -- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
r8305 is now exclusively using the timer to clock the audio stream. This is silly because you would think the darn sound card could at least provide timing at a lousy 8khz. please tell me this fixes it..... if the thread gets any bigger my client will crash..... On Thu, May 8, 2008 at 3:12 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
i tested with 8296 now in all combinations, but allways the same as before, 3 RTP packets all 60ms: now 2 frames accumulated (1 frame = 320 bytes always readable), but switch_core_timer_sync() is not waiting 20ms. I think its because at the beginning we get late by 2 frames, as you described (2 timeouts at the beginning), so the timer is lag behind the buffer.
there the log for 20ms in portaudio.xml and vars.xml:
2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664138 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664138 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664139 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664139 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664141 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664141 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664143 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664143 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664145 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664145 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664147 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664147 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664149 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664149 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664151 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664151 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664153 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664153 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664155 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664155 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664157 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664157 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664159 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664159 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664161 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664161 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664163 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664163 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664165 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664165 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664167 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664167 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664169 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664169 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664171 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664171 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664173 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664173 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664175 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:174 ReadAudioStream() 177664175 ms : timer timed out (320 Bytes readable)! 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664175 ms : Return with 0 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664176 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664177 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664178 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664178 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664180 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664180 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664182 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664182 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664184 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664184 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664186 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664186 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664188 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664188 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664190 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664190 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664192 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664192 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664194 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664194 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664196 ms : after Wait... (1280 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664196 ms : after switch_core_timer_sync()... (960 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664196 ms : Return with 160 Bytes read (960 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664196 ms : Beginning (960 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664196 ms : after switch_core_timer_sync()... (640 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664196 ms : Return with 160 Bytes read (640 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664197 ms : Beginning (640 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664197 ms : after switch_core_timer_sync()... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664197 ms : Return with 160 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664197 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664197 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664198 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664198 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664200 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664200 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664202 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664202 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664204 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664204 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664206 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664206 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664208 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664208 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664210 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664210 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664212 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664212 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664214 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664214 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664216 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664216 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664217 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664218 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664219 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664220 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664221 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664221 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664223 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664223 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664225 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664225 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664227 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664227 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664229 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664229 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664231 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664231 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664233 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664233 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664235 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664235 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664237 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:174 ReadAudioStream() 177664237 ms : timer timed out (320 Bytes readable)! 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664237 ms : Return with 0 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664239 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664239 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664241 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664241 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664243 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664243 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664245 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664245 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664247 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664247 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664249 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664249 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664251 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664251 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664253 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664253 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664255 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664255 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664257 ms : after Wait... (1280 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664257 ms : after switch_core_timer_sync()... (960 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664257 ms : Return with 160 Bytes read (960 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664257 ms : Beginning (960 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664257 ms : after switch_core_timer_sync()... (640 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664257 ms : Return with 160 Bytes read (640 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664257 ms : Beginning (640 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664257 ms : after switch_core_timer_sync()... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664257 ms : Return with 160 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664257 ms : Beginning (320 Bytes readable) ... Thomas
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Anthony Minessale *Gesendet:* Mittwoch, 7. Mai 2008 18:50
*An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3rtppacket/60msinsteadof1 packet/20ms
ok, please try 8295 at all combinations of codec-ms etc. I changed the code to snoop the ringbuffer and make sure 2 frames worth of audio as accumulated before i read from it.
On Wed, May 7, 2008 at 10:13 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
I get always 3 RTP packets at once with 60ms setting, i also test with PCMU@60i in vars.xml but i always get 20ms packets with 160byres packet size.
Anthony, you are right with you "timeout assumption". To illustrate, here a log from my patch without waiting, i. e. no functional difference:
2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594577 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594577 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594577 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594579 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594579 ms : after Wait... (960 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594581 ms : all 320 Bytes read (640 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (640 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594582 ms : all 320 Bytes read (320 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (320 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594582 ms : all 320 Bytes read (0 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594582 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594582 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594583 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594583 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594585 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594585 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594587 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594587 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594589 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594589 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594591 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594593 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594593 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594593 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594595 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594595 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594597 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594597 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594599 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594599 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594601 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594601 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594603 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594603 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594605 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594605 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594607 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594609 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594609 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594609 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594611 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594611 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594613 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594613 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594615 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594615 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594617 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594617 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594618 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594618 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594620 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594620 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594622 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594624 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594624 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594624 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594626 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594626 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594628 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594628 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594630 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594630 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594632 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594632 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594634 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594634 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594636 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594636 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594638 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594638 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594640 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594640 ms : after Wait... (960 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (640 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (640 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (320 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (320 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (0 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594642 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594642 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594644 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594644 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594646 ms : before Wait... So i want use the timer to prevent these buffer read bursts all 60ms. All 3 x 320 bytes are used for RTP packets, so samples are not lost (only during the first 2 timeouts, but this is irrelevant).
And if you like logs ;), here are the behavior with 60ms in portaudio.xml:
2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511260 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511260 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511260 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511262 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511262 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511264 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511264 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511266 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511266 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511268 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511268 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511270 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511270 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511272 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511272 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511274 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511274 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511276 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511276 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511278 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511278 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511279 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511279 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511281 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511281 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511283 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511283 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511285 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511285 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511287 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511287 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511289 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511289 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511291 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511291 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511293 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511293 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:167 ReadAudioStream() 116511295 ms : timer timed out (0 Bytes readable)! 2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511297 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511297 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511297 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511299 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511299 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511301 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511301 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511303 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511303 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511305 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511305 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511307 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511307 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511309 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511309 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511311 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511311 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511313 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511313 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511315 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511315 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511317 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511317 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511318 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511318 ms : after Wait... (960 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:184 ReadAudioStream() 116511321 ms : all 960 Bytes read (0 Bytes readable), exit. 2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511321 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511321 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511321 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511322 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511322 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511324 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511324 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511326 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511326 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511328 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511328 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511330 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511330 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511332 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511332 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511334 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511334 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511336 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511336 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511338 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511338 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511340 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511340 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511342 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511342 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511344 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511344 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511346 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511346 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511348 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511348 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511350 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511350 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511352 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511352 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511354 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511354 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511356 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511356 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:167 ReadAudioStream() 116511358 ms : timer timed out (0 Bytes readable)! 2008-05-07 17:09:05 [DEBUG] pablio.c:156 ReadAudioStream() 116511359 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511360 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511360 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511361 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511361 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511363 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511363 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511365 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511365 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511367 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511367 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511369 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511369 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511371 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511371 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511373 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511373 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511375 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511375 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511377 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511377 ms : after Wait... (960 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:184 ReadAudioStream() 116511379 ms : all 960 Bytes read (0 Bytes readable), exit. Strange timeout after 35...40ms, or should it be?
Thomas
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Csaba Zelei *Gesendet:* Mittwoch, 7. Mai 2008 16:46 *An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3 rtppacket/60msinsteadof1 packet/20ms
I tried it with the latest trunk. If I set it to 60ms sometimes I still get <1ms rtp packet delta, if I set it to 120ms then there is none The rtp packet delta is still random within 50-70ms with sometimes too low 15-30ms, sometimes too high 100-150ms delta (with codec-ms = 60ms), and with 15-20ms jitter.
Anthony Minessale wrote:
Have you tried setting the codec-ms in the portaudio.conf.xml to 60 or 120 ms? Maybe the soundcard is not able to do 20ms intervals and portaudio is doing the least common multiple and chopping it up for us. I think what's happening is the timer in the module is set to the interval from the config file (20ms) and during every 60ms period there is no audio until the last ms. so in each 60 ms:
20ms (timeout..... flush buffer) 20ms (timeout..... flush buffer) 20ms (get 60ms worth of audio at once [3 20ms packets] but we have already read 2 filler frames from the timeouts)
So now we have read 5 packets instead of 3 and erased some of our buffer because of perceived timeouts. The code is using the assumption that if the device will obey the chosen frame size and sample rate requests down to the interval.
If you find and edit conf/autoload_configs/portaudio.conf.xml
look for this:
<param name="codec-ms" value="20"/>
and change 20 to 60
Setting this to 60 will change the frame size of all the packets from 320 to 960 and set the timer to clock at an interval of 60ms Since the card seems to be able to reliably produce 3 20ms packets every 60ms it should also be able to produce 1 60ms packet.
FreeSWITCH should then buffer the audio and still deliver it over SIP at 20ms if you want but you can opt to set the codec PCMU@60i to disable buffering if you are in a reliable network.
The same should be true for setting the codec-ms to 120
On Wed, May 7, 2008 at 3:27 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
Hi Anthony,
i also tested your patch with no success. As i already described below, the problem with all 60ms 3 packets comes from the soundcard. The hardware delivers its samples all 60 ms. Our problem is (like Csaba said) that we read out the buffer after 60ms, 3 times, each with samples for 20ms, AND WITH NO DELAY! 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.
In my patch i wait appr.20 ms if last method call was no longer than 4ms ago, but i think we can do better with switch_core_timer_check() method, but i don't know exactly how.
You are absolutly right with your demand for a better timing resolution under Windows, but this 60ms mystery is caused by the soundcard.
Thomas
------------------------------
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
ok, now it looks better, i. e. the switch_core_timer_check() times the ReadAudioStream function, but not perfect, now i see packets with differences of 15, 30, 45, 0 ms, e. g. 15, 15, 30, 15, 15, 15, 31, 16, 15, 31, 15, 16, 16, 29 ms and so on Looks like we already stuck with time resolution, but the switch_yield(1000) in ReadAudioStream() seems to work properly, strange ... I don't have the time to go deeper into and i next read my emails on tuesday :( I don't want to hijack this thread from Csaba, should we make a jira entry, Csaba? (for Anthonys clients sake :) ) Thomas ________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Anthony Minessale Gesendet: Donnerstag, 8. Mai 2008 18:22 An: freeswitch-users@lists.freeswitch.org Betreff: Re: [Freeswitch-users] mod_portaudio send 3rtppacket/60msinsteadof1packet/20ms r8305 is now exclusively using the timer to clock the audio stream. This is silly because you would think the darn sound card could at least provide timing at a lousy 8khz. please tell me this fixes it..... if the thread gets any bigger my client will crash..... On Thu, May 8, 2008 at 3:12 AM, Sluschny, Thomas <Thomas.Sluschny@siemens.com> wrote: i tested with 8296 now in all combinations, but allways the same as before, 3 RTP packets all 60ms: now 2 frames accumulated (1 frame = 320 bytes always readable), but switch_core_timer_sync() is not waiting 20ms. I think its because at the beginning we get late by 2 frames, as you described (2 timeouts at the beginning), so the timer is lag behind the buffer. there the log for 20ms in portaudio.xml and vars.xml: 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664138 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664138 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664139 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664139 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664141 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664141 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664143 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664143 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664145 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664145 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664147 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664147 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664149 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664149 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664151 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664151 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664153 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664153 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664155 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664155 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664157 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664157 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664159 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664159 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664161 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664161 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664163 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664163 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664165 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664165 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664167 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664167 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664169 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664169 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664171 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664171 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664173 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664173 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664175 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:174 ReadAudioStream() 177664175 ms : timer timed out (320 Bytes readable)! 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664175 ms : Return with 0 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664176 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664177 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664178 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664178 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664180 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664180 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664182 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664182 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664184 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664184 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664186 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664186 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664188 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664188 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664190 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664190 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664192 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664192 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664194 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664194 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664196 ms : after Wait... (1280 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664196 ms : after switch_core_timer_sync()... (960 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664196 ms : Return with 160 Bytes read (960 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664196 ms : Beginning (960 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664196 ms : after switch_core_timer_sync()... (640 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664196 ms : Return with 160 Bytes read (640 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664197 ms : Beginning (640 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664197 ms : after switch_core_timer_sync()... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664197 ms : Return with 160 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664197 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664197 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664198 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664198 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664200 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664200 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664202 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664202 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664204 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664204 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664206 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664206 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664208 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664208 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664210 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664210 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664212 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664212 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664214 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664214 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664216 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664216 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664217 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664218 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664219 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664220 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664221 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664221 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664223 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664223 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664225 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664225 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664227 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664227 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664229 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664229 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664231 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664231 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664233 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664233 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664235 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664235 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664237 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:174 ReadAudioStream() 177664237 ms : timer timed out (320 Bytes readable)! 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664237 ms : Return with 0 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664239 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664239 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664241 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664241 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664243 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664243 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664245 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664245 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664247 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664247 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664249 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664249 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664251 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664251 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664253 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664253 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664255 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664255 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664257 ms : after Wait... (1280 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664257 ms : after switch_core_timer_sync()... (960 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664257 ms : Return with 160 Bytes read (960 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664257 ms : Beginning (960 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664257 ms : after switch_core_timer_sync()... (640 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664257 ms : Return with 160 Bytes read (640 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664257 ms : Beginning (640 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664257 ms : after switch_core_timer_sync()... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664257 ms : Return with 160 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664257 ms : Beginning (320 Bytes readable) ... Thomas ________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Anthony Minessale Gesendet: Mittwoch, 7. Mai 2008 18:50 An: freeswitch-users@lists.freeswitch.org Betreff: Re: [Freeswitch-users] mod_portaudio send 3rtppacket/60msinsteadof1 packet/20ms ok, please try 8295 at all combinations of codec-ms etc. I changed the code to snoop the ringbuffer and make sure 2 frames worth of audio as accumulated before i read from it. On Wed, May 7, 2008 at 10:13 AM, Sluschny, Thomas <Thomas.Sluschny@siemens.com> wrote: I get always 3 RTP packets at once with 60ms setting, i also test with PCMU@60i in vars.xml but i always get 20ms packets with 160byres packet size. Anthony, you are right with you "timeout assumption". To illustrate, here a log from my patch without waiting, i. e. no functional difference: 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594577 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594577 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594577 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594579 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594579 ms : after Wait... (960 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594581 ms : all 320 Bytes read (640 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (640 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594582 ms : all 320 Bytes read (320 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (320 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594582 ms : all 320 Bytes read (0 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594582 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594582 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594583 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594583 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594585 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594585 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594587 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594587 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594589 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594589 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594591 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594593 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594593 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594593 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594595 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594595 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594597 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594597 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594599 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594599 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594601 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594601 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594603 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594603 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594605 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594605 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594607 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594609 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594609 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594609 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594611 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594611 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594613 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594613 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594615 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594615 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594617 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594617 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594618 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594618 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594620 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594620 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594622 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594624 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594624 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594624 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594626 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594626 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594628 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594628 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594630 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594630 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594632 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594632 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594634 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594634 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594636 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594636 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594638 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594638 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594640 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594640 ms : after Wait... (960 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (640 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (640 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (320 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (320 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (0 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594642 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594642 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594644 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594644 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594646 ms : before Wait... So i want use the timer to prevent these buffer read bursts all 60ms. All 3 x 320 bytes are used for RTP packets, so samples are not lost (only during the first 2 timeouts, but this is irrelevant). And if you like logs ;), here are the behavior with 60ms in portaudio.xml: 2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511260 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511260 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511260 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511262 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511262 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511264 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511264 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511266 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511266 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511268 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511268 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511270 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511270 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511272 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511272 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511274 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511274 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511276 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511276 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511278 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511278 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511279 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511279 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511281 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511281 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511283 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511283 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511285 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511285 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511287 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511287 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511289 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511289 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511291 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511291 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511293 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511293 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:167 ReadAudioStream() 116511295 ms : timer timed out (0 Bytes readable)! 2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511297 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511297 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511297 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511299 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511299 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511301 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511301 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511303 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511303 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511305 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511305 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511307 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511307 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511309 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511309 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511311 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511311 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511313 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511313 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511315 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511315 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511317 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511317 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511318 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511318 ms : after Wait... (960 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:184 ReadAudioStream() 116511321 ms : all 960 Bytes read (0 Bytes readable), exit. 2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511321 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511321 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511321 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511322 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511322 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511324 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511324 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511326 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511326 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511328 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511328 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511330 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511330 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511332 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511332 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511334 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511334 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511336 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511336 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511338 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511338 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511340 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511340 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511342 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511342 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511344 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511344 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511346 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511346 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511348 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511348 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511350 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511350 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511352 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511352 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511354 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511354 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511356 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511356 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:167 ReadAudioStream() 116511358 ms : timer timed out (0 Bytes readable)! 2008-05-07 17:09:05 [DEBUG] pablio.c:156 ReadAudioStream() 116511359 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511360 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511360 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511361 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511361 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511363 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511363 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511365 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511365 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511367 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511367 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511369 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511369 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511371 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511371 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511373 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511373 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511375 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511375 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511377 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511377 ms : after Wait... (960 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:184 ReadAudioStream() 116511379 ms : all 960 Bytes read (0 Bytes readable), exit. Strange timeout after 35...40ms, or should it be? Thomas ________________________________ Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Csaba Zelei Gesendet: Mittwoch, 7. Mai 2008 16:46 An: freeswitch-users@lists.freeswitch.org Betreff: Re: [Freeswitch-users] mod_portaudio send 3 rtppacket/60msinsteadof1 packet/20ms I tried it with the latest trunk. If I set it to 60ms sometimes I still get <1ms rtp packet delta, if I set it to 120ms then there is none The rtp packet delta is still random within 50-70ms with sometimes too low 15-30ms, sometimes too high 100-150ms delta (with codec-ms = 60ms), and with 15-20ms jitter. Anthony Minessale wrote: Have you tried setting the codec-ms in the portaudio.conf.xml to 60 or 120 ms? Maybe the soundcard is not able to do 20ms intervals and portaudio is doing the least common multiple and chopping it up for us. I think what's happening is the timer in the module is set to the interval from the config file (20ms) and during every 60ms period there is no audio until the last ms. so in each 60 ms: 20ms (timeout..... flush buffer) 20ms (timeout..... flush buffer) 20ms (get 60ms worth of audio at once [3 20ms packets] but we have already read 2 filler frames from the timeouts) So now we have read 5 packets instead of 3 and erased some of our buffer because of perceived timeouts. The code is using the assumption that if the device will obey the chosen frame size and sample rate requests down to the interval. If you find and edit conf/autoload_configs/portaudio.conf.xml look for this: <param name="codec-ms" value="20"/> and change 20 to 60 Setting this to 60 will change the frame size of all the packets from 320 to 960 and set the timer to clock at an interval of 60ms Since the card seems to be able to reliably produce 3 20ms packets every 60ms it should also be able to produce 1 60ms packet. FreeSWITCH should then buffer the audio and still deliver it over SIP at 20ms if you want but you can opt to set the codec PCMU@60i to disable buffering if you are in a reliable network. The same should be true for setting the codec-ms to 120 On Wed, May 7, 2008 at 3:27 AM, Sluschny, Thomas <Thomas.Sluschny@siemens.com> wrote: Hi Anthony, i also tested your patch with no success. As i already described below, the problem with all 60ms 3 packets comes from the soundcard. The hardware delivers its samples all 60 ms. Our problem is (like Csaba said) that we read out the buffer after 60ms, 3 times, each with samples for 20ms, AND WITH NO DELAY! 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. In my patch i wait appr.20 ms if last method call was no longer than 4ms ago, but i think we can do better with switch_core_timer_check() method, but i don't know exactly how. You are absolutly right with your demand for a better timing resolution under Windows, but this 60ms mystery is caused by the soundcard. Thomas ________________________________ _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org -- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400 _______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org -- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
I think that is where i have to draw the line and say get some better hardware........ I did my best but if the box sucks that badly at timing i am not sure what else to do because it's working flawlessly on mine which proves it depends on the box and i dont 'even like portaudio On Fri, May 9, 2008 at 6:34 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
ok, now it looks better, i. e. the switch_core_timer_check() times the ReadAudioStream function, but not perfect, now i see packets with differences of 15, 30, 45, 0 ms, e. g. 15, 15, 30, 15, 15, 15, 31, 16, 15, 31, 15, 16, 16, 29 ms and so on
Looks like we already stuck with time resolution, but the switch_yield(1000) in ReadAudioStream() seems to work properly, strange ... I don't have the time to go deeper into and i next read my emails on tuesday :(
I don't want to hijack this thread from Csaba, should we make a jira entry, Csaba? (for Anthonys clients sake :) )
Thomas
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Anthony Minessale *Gesendet:* Donnerstag, 8. Mai 2008 18:22
*An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3rtppacket/60msinsteadof1packet/20ms
r8305 is now exclusively using the timer to clock the audio stream. This is silly because you would think the darn sound card could at least provide timing at a lousy 8khz.
please tell me this fixes it..... if the thread gets any bigger my client will crash.....
On Thu, May 8, 2008 at 3:12 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
i tested with 8296 now in all combinations, but allways the same as before, 3 RTP packets all 60ms: now 2 frames accumulated (1 frame = 320 bytes always readable), but switch_core_timer_sync() is not waiting 20ms. I think its because at the beginning we get late by 2 frames, as you described (2 timeouts at the beginning), so the timer is lag behind the buffer.
there the log for 20ms in portaudio.xml and vars.xml:
2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664138 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664138 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664139 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664139 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664141 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664141 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664143 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664143 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664145 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664145 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664147 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664147 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664149 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664149 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664151 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664151 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664153 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664153 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664155 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664155 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664157 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664157 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664159 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664159 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664161 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664161 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664163 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664163 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664165 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664165 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664167 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664167 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664169 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664169 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664171 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664171 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664173 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664173 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664175 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:174 ReadAudioStream() 177664175 ms : timer timed out (320 Bytes readable)! 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664175 ms : Return with 0 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664176 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664177 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664178 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664178 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664180 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664180 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664182 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664182 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664184 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664184 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664186 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664186 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664188 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664188 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664190 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664190 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664192 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664192 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664194 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664194 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664196 ms : after Wait... (1280 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664196 ms : after switch_core_timer_sync()... (960 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664196 ms : Return with 160 Bytes read (960 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664196 ms : Beginning (960 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664196 ms : after switch_core_timer_sync()... (640 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664196 ms : Return with 160 Bytes read (640 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664197 ms : Beginning (640 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664197 ms : after switch_core_timer_sync()... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664197 ms : Return with 160 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664197 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664197 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664198 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664198 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664200 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664200 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664202 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664202 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664204 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664204 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664206 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664206 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664208 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664208 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664210 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664210 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664212 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664212 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664214 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664214 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664216 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664216 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664217 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664218 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664219 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664220 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664221 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664221 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664223 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664223 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664225 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664225 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664227 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664227 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664229 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664229 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664231 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664231 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664233 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664233 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664235 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664235 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664237 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:174 ReadAudioStream() 177664237 ms : timer timed out (320 Bytes readable)! 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664237 ms : Return with 0 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664239 ms : Beginning (320 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664239 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664241 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664241 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664243 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664243 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664245 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664245 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664247 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664247 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664249 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664249 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664251 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664251 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664253 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664253 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664255 ms : after Wait... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:177 ReadAudioStream() 177664255 ms : before Wait... 2008-05-08 10:08:18 [DEBUG] pablio.c:180 ReadAudioStream() 177664257 ms : after Wait... (1280 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664257 ms : after switch_core_timer_sync()... (960 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664257 ms : Return with 160 Bytes read (960 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664257 ms : Beginning (960 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664257 ms : after switch_core_timer_sync()... (640 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664257 ms : Return with 160 Bytes read (640 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664257 ms : Beginning (640 Bytes readable) ... 2008-05-08 10:08:18 [DEBUG] pablio.c:188 ReadAudioStream() 177664257 ms : after switch_core_timer_sync()... (320 Bytes readable) 2008-05-08 10:08:18 [DEBUG] pablio.c:192 ReadAudioStream() 177664257 ms : Return with 160 Bytes read (320 Bytes readable), exit. 2008-05-08 10:08:18 [DEBUG] pablio.c:155 ReadAudioStream() 177664257 ms : Beginning (320 Bytes readable) ... Thomas
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Anthony Minessale *Gesendet:* Mittwoch, 7. Mai 2008 18:50
*An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3rtppacket/60msinsteadof1 packet/20ms
ok, please try 8295 at all combinations of codec-ms etc. I changed the code to snoop the ringbuffer and make sure 2 frames worth of audio as accumulated before i read from it.
On Wed, May 7, 2008 at 10:13 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
I get always 3 RTP packets at once with 60ms setting, i also test with PCMU@60i in vars.xml but i always get 20ms packets with 160byres packet size.
Anthony, you are right with you "timeout assumption". To illustrate, here a log from my patch without waiting, i. e. no functional difference:
2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594577 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594577 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594577 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594579 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594579 ms : after Wait... (960 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594581 ms : all 320 Bytes read (640 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (640 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594582 ms : all 320 Bytes read (320 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (320 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594582 ms : all 320 Bytes read (0 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594582 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594582 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594582 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594583 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594583 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594585 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594585 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594587 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594587 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594589 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594589 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594591 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594593 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594593 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594593 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594595 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594595 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594597 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594597 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594599 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594599 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594601 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594601 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594603 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594603 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594605 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594605 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594607 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594609 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594609 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594609 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594611 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594611 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594613 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594613 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594615 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594615 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594617 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594617 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594618 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594618 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594620 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594620 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:167 ReadAudioStream() 115594622 ms : timer timed out (0 Bytes readable)! 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594624 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594624 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594624 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594626 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594626 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594628 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594628 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594630 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594630 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594632 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594632 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594634 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594634 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594636 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594636 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594638 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594638 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594640 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594640 ms : after Wait... (960 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (640 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (640 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (320 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (320 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:184 ReadAudioStream() 115594642 ms : all 320 Bytes read (0 Bytes readable), exit. 2008-05-07 16:53:48 [DEBUG] pablio.c:156 ReadAudioStream() 115594642 ms : Beginning (0 Bytes readable) ... 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594642 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594642 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594644 ms : before Wait... 2008-05-07 16:53:48 [DEBUG] pablio.c:172 ReadAudioStream() 115594644 ms : after Wait... (0 Bytes readable) 2008-05-07 16:53:48 [DEBUG] pablio.c:170 ReadAudioStream() 115594646 ms : before Wait... So i want use the timer to prevent these buffer read bursts all 60ms. All 3 x 320 bytes are used for RTP packets, so samples are not lost (only during the first 2 timeouts, but this is irrelevant).
And if you like logs ;), here are the behavior with 60ms in portaudio.xml:
2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511260 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511260 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511260 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511262 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511262 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511264 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511264 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511266 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511266 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511268 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511268 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511270 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511270 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511272 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511272 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511274 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511274 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511276 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511276 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511278 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511278 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511279 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511279 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511281 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511281 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511283 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511283 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511285 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511285 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511287 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511287 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511289 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511289 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511291 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511291 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511293 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511293 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:167 ReadAudioStream() 116511295 ms : timer timed out (0 Bytes readable)! 2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511297 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511297 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511297 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511299 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511299 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511301 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511301 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511303 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511303 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511305 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511305 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511307 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511307 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511309 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511309 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511311 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511311 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511313 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511313 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511315 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511315 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511317 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511317 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511318 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511318 ms : after Wait... (960 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:184 ReadAudioStream() 116511321 ms : all 960 Bytes read (0 Bytes readable), exit. 2008-05-07 17:09:04 [DEBUG] pablio.c:156 ReadAudioStream() 116511321 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511321 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511321 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511322 ms : before Wait... 2008-05-07 17:09:04 [DEBUG] pablio.c:172 ReadAudioStream() 116511322 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:04 [DEBUG] pablio.c:170 ReadAudioStream() 116511324 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511324 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511326 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511326 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511328 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511328 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511330 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511330 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511332 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511332 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511334 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511334 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511336 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511336 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511338 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511338 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511340 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511340 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511342 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511342 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511344 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511344 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511346 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511346 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511348 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511348 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511350 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511350 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511352 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511352 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511354 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511354 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511356 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511356 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:167 ReadAudioStream() 116511358 ms : timer timed out (0 Bytes readable)! 2008-05-07 17:09:05 [DEBUG] pablio.c:156 ReadAudioStream() 116511359 ms : Beginning (0 Bytes readable) ... 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511360 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511360 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511361 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511361 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511363 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511363 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511365 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511365 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511367 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511367 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511369 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511369 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511371 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511371 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511373 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511373 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511375 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511375 ms : after Wait... (0 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:170 ReadAudioStream() 116511377 ms : before Wait... 2008-05-07 17:09:05 [DEBUG] pablio.c:172 ReadAudioStream() 116511377 ms : after Wait... (960 Bytes readable) 2008-05-07 17:09:05 [DEBUG] pablio.c:184 ReadAudioStream() 116511379 ms : all 960 Bytes read (0 Bytes readable), exit. Strange timeout after 35...40ms, or should it be?
Thomas
------------------------------ *Von:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *Im Auftrag von *Csaba Zelei *Gesendet:* Mittwoch, 7. Mai 2008 16:46 *An:* freeswitch-users@lists.freeswitch.org *Betreff:* Re: [Freeswitch-users] mod_portaudio send 3 rtppacket/60msinsteadof1 packet/20ms
I tried it with the latest trunk. If I set it to 60ms sometimes I still get <1ms rtp packet delta, if I set it to 120ms then there is none The rtp packet delta is still random within 50-70ms with sometimes too low 15-30ms, sometimes too high 100-150ms delta (with codec-ms = 60ms), and with 15-20ms jitter.
Anthony Minessale wrote:
Have you tried setting the codec-ms in the portaudio.conf.xml to 60 or 120 ms? Maybe the soundcard is not able to do 20ms intervals and portaudio is doing the least common multiple and chopping it up for us. I think what's happening is the timer in the module is set to the interval from the config file (20ms) and during every 60ms period there is no audio until the last ms. so in each 60 ms:
20ms (timeout..... flush buffer) 20ms (timeout..... flush buffer) 20ms (get 60ms worth of audio at once [3 20ms packets] but we have already read 2 filler frames from the timeouts)
So now we have read 5 packets instead of 3 and erased some of our buffer because of perceived timeouts. The code is using the assumption that if the device will obey the chosen frame size and sample rate requests down to the interval.
If you find and edit conf/autoload_configs/portaudio.conf.xml
look for this:
<param name="codec-ms" value="20"/>
and change 20 to 60
Setting this to 60 will change the frame size of all the packets from 320 to 960 and set the timer to clock at an interval of 60ms Since the card seems to be able to reliably produce 3 20ms packets every 60ms it should also be able to produce 1 60ms packet.
FreeSWITCH should then buffer the audio and still deliver it over SIP at 20ms if you want but you can opt to set the codec PCMU@60i to disable buffering if you are in a reliable network.
The same should be true for setting the codec-ms to 120
On Wed, May 7, 2008 at 3:27 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
Hi Anthony,
i also tested your patch with no success. As i already described below, the problem with all 60ms 3 packets comes from the soundcard. The hardware delivers its samples all 60 ms. Our problem is (like Csaba said) that we read out the buffer after 60ms, 3 times, each with samples for 20ms, AND WITH NO DELAY! 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.
In my patch i wait appr.20 ms if last method call was no longer than 4ms ago, but i think we can do better with switch_core_timer_check() method, but i don't know exactly how.
You are absolutly right with your demand for a better timing resolution under Windows, but this 60ms mystery is caused by the soundcard.
Thomas
------------------------------
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/
AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
Tony has a valid point here. Is there any way for you to try on different hardware? Portaudio, in the grand scheme of things, isn't very high on the food chain when it comes to FS development, especially with 1.0 only a few weeks away. Please see if you can reproduce these symptoms on other hardware, preferably better hardware, and then report back. Believe, if there is a problem with FS then Tony and Mike will definitely address it, but if it's just a hardware issue then it would be better for those guys to be spending their time frying the bigger fish. Thanks, MC ________________________________ From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Anthony Minessale Sent: Friday, May 09, 2008 10:51 AM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] mod_portaudio send3rtppacket/60msinsteadof1packet/20ms I think that is where i have to draw the line and say get some better hardware........ I did my best but if the box sucks that badly at timing i am not sure what else to do because it's working flawlessly on mine which proves it depends on the box and i dont 'even like portaudio On Fri, May 9, 2008 at 6:34 AM, Sluschny, Thomas <Thomas.Sluschny@siemens.com> wrote: ok, now it looks better, i. e. the switch_core_timer_check() times the ReadAudioStream function, but not perfect, now i see packets with differences of 15, 30, 45, 0 ms, e. g. 15, 15, 30, 15, 15, 15, 31, 16, 15, 31, 15, 16, 16, 29 ms and so on Looks like we already stuck with time resolution, but the switch_yield(1000) in ReadAudioStream() seems to work properly, strange ... I don't have the time to go deeper into and i next read my emails on tuesday :( I don't want to hijack this thread from Csaba, should we make a jira entry, Csaba? (for Anthonys clients sake :) ) Thomas
Hello, we have tried at least 3 different boxes, sound cards (also with external USB headset) and as Thomas had this issue too, maybe Tony's hardware is something excellent :) Tony, could you share your HW details, we could try to get the same one (or similar) to check and compare things. Csaba can make further tests on Tuesday. Regards, Tamas Michael Collins írta:
Tony has a valid point here. Is there any way for you to try on different hardware? Portaudio, in the grand scheme of things, isn’t very high on the food chain when it comes to FS development, especially with 1.0 only a few weeks away. Please see if you can reproduce these symptoms on other hardware, preferably better hardware, and then report back. Believe, if there is a problem with FS then Tony and Mike will definitely address it, but if it’s just a hardware issue then it would be better for those guys to be spending their time frying the bigger fish.
Thanks,
MC
------------------------------------------------------------------------
*From:* freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] *On Behalf Of *Anthony Minessale *Sent:* Friday, May 09, 2008 10:51 AM *To:* freeswitch-users@lists.freeswitch.org *Subject:* Re: [Freeswitch-users] mod_portaudio send3rtppacket/60msinsteadof1packet/20ms
I think that is where i have to draw the line and say get some better hardware........ I did my best but if the box sucks that badly at timing i am not sure what else to do because it's working flawlessly on mine which proves it depends on the box and i dont 'even like portaudio
On Fri, May 9, 2008 at 6:34 AM, Sluschny, Thomas <Thomas.Sluschny@siemens.com <mailto:Thomas.Sluschny@siemens.com>> wrote:
ok,
now it looks better, i. e. the switch_core_timer_check() times the ReadAudioStream function,
but not perfect, now i see packets with differences of 15, 30, 45, 0 ms,
e. g. 15, 15, 30, 15, 15, 15, 31, 16, 15, 31, 15, 16, 16, 29 ms and so on
Looks like we already stuck with time resolution, but the switch_yield(1000) in ReadAudioStream() seems to work properly, strange ...
I don't have the time to go deeper into and i next read my emails on tuesday :(
I don't want to hijack this thread from Csaba, should we make a jira entry, Csaba? (for Anthonys clients sake :) )
Thomas
------------------------------------------------------------------------
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
I have done it on my two mac's without a problem. /b On May 9, 2008, at 3:17 PM, Tamas wrote:
Hello,
we have tried at least 3 different boxes, sound cards (also with external USB headset) and as Thomas had this issue too, maybe Tony's hardware is something excellent :) Tony, could you share your HW details, we could try to get the same one (or similar) to check and compare things.
Csaba can make further tests on Tuesday.
Regards, Tamas
Brian West sip:brian@freeswitch.org
Tamas, Let me start by saying I don't applicate the humor............................... Have you tried the latest trunk before you made that comment? If you are still having this problem with the trunk from right now built fully from scratch I will be surprised if the audio does not sound clear. What are you talking to on the other side because I am out of ideas.... I have used: Mac desktops and Laptops Windows XP Toshiba laptop and oqo o2 hand held pc and run-of-the-mill p4 box. Maybe you should send me one of these sets of boxes that don't work together......... On Fri, May 9, 2008 at 3:31 PM, Brian West <brian@freeswitch.org> wrote:
I have done it on my two mac's without a problem.
/b
On May 9, 2008, at 3:17 PM, Tamas wrote:
Hello,
we have tried at least 3 different boxes, sound cards (also with external USB headset) and as Thomas had this issue too, maybe Tony's hardware is something excellent :) Tony, could you share your HW details, we could try to get the same one (or similar) to check and compare things.
Csaba can make further tests on Tuesday.
Regards, Tamas
Brian West sip:brian@freeswitch.org <sip%3Abrian@freeswitch.org>
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
Hi, I tested the latest trunk afternoon (r8378). The timing is not perfect, 16,16,31ms almost constant but we have done a lot of tests and the audio was good if not perfect. I am sure its going to be ok when we start to use it out of the test environment. Thanks for your time and help Anthony! Csaba ps: If I find a way to do better timing on windows i will surely share it with you Anthony Minessale wrote:
I think that is where i have to draw the line and say get some better hardware........ I did my best but if the box sucks that badly at timing i am not sure what else to do because it's working flawlessly on mine which proves it depends on the box and i dont 'even like portaudio
On Fri, May 9, 2008 at 6:34 AM, Sluschny, Thomas <Thomas.Sluschny@siemens.com <mailto:Thomas.Sluschny@siemens.com>> wrote:
ok, now it looks better, i. e. the switch_core_timer_check() times the ReadAudioStream function, but not perfect, now i see packets with differences of 15, 30, 45, 0 ms, e. g. 15, 15, 30, 15, 15, 15, 31, 16, 15, 31, 15, 16, 16, 29 ms and so on
Looks like we already stuck with time resolution, but the switch_yield(1000) in ReadAudioStream() seems to work properly, strange ... I don't have the time to go deeper into and i next read my emails on tuesday :(
I don't want to hijack this thread from Csaba, should we make a jira entry, Csaba? (for Anthonys clients sake :) )
Thomas
do you have any other sound hardware like a usb headset or anything you can compare it to. I really would like to know if that sound card sucks or something because I never see this in any of the stuff i am testing. I can't even lab it up to try to fix. On Wed, May 7, 2008 at 9:46 AM, Csaba Zelei <csaba.zelei@gmail.com> wrote:
I tried it with the latest trunk. If I set it to 60ms sometimes I still get <1ms rtp packet delta, if I set it to 120ms then there is none The rtp packet delta is still random within 50-70ms with sometimes too low 15-30ms, sometimes too high 100-150ms delta (with codec-ms = 60ms), and with 15-20ms jitter.
Anthony Minessale wrote:
Have you tried setting the codec-ms in the portaudio.conf.xml to 60 or 120 ms? Maybe the soundcard is not able to do 20ms intervals and portaudio is doing the least common multiple and chopping it up for us. I think what's happening is the timer in the module is set to the interval from the config file (20ms) and during every 60ms period there is no audio until the last ms. so in each 60 ms:
20ms (timeout..... flush buffer) 20ms (timeout..... flush buffer) 20ms (get 60ms worth of audio at once [3 20ms packets] but we have already read 2 filler frames from the timeouts)
So now we have read 5 packets instead of 3 and erased some of our buffer because of perceived timeouts. The code is using the assumption that if the device will obey the chosen frame size and sample rate requests down to the interval.
If you find and edit conf/autoload_configs/portaudio.conf.xml
look for this:
<param name="codec-ms" value="20"/>
and change 20 to 60
Setting this to 60 will change the frame size of all the packets from 320 to 960 and set the timer to clock at an interval of 60ms Since the card seems to be able to reliably produce 3 20ms packets every 60ms it should also be able to produce 1 60ms packet.
FreeSWITCH should then buffer the audio and still deliver it over SIP at 20ms if you want but you can opt to set the codec PCMU@60i to disable buffering if you are in a reliable network.
The same should be true for setting the codec-ms to 120
On Wed, May 7, 2008 at 3:27 AM, Sluschny, Thomas < Thomas.Sluschny@siemens.com> wrote:
Hi Anthony,
i also tested your patch with no success. As i already described below, the problem with all 60ms 3 packets comes from the soundcard. The hardware delivers its samples all 60 ms. Our problem is (like Csaba said) that we read out the buffer after 60ms, 3 times, each with samples for 20ms, AND WITH NO DELAY! 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.
In my patch i wait appr.20 ms if last method call was no longer than 4ms ago, but i think we can do better with switch_core_timer_check() method, but i don't know exactly how.
You are absolutly right with your demand for a better timing resolution under Windows, but this 60ms mystery is caused by the soundcard.
Thomas
------------------------------
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
participants (9)
-
Anthony Minessale
-
Brian West
-
Csaba Zelei
-
Michael Collins
-
Michael Jerris
-
Sluschny, Thomas
-
Tamas
-
Zelei Csaba
-
Łukasz Zwierko