[Freeswitch-svn] [commit] r8305 - freeswitch/trunk/src/mod/endpoints/mod_portaudio
Freeswitch SVN
anthm at freeswitch.org
Thu May 8 12:20:16 EDT 2008
Author: anthm
Date: Thu May 8 12:20:15 2008
New Revision: 8305
Modified:
freeswitch/trunk/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c
freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c
Log:
ok this has to fix the issue with crappy sound cards 100% soft timer
Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c Thu May 8 12:20:15 2008
@@ -70,7 +70,7 @@
* PaUtil_WriteMemoryBarrier()
*
****************/
-
+#define __VIA_HACK__
#if defined(__VIA_HACK__)
#define NO_BARRIER
#endif
Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c Thu May 8 12:20:15 2008
@@ -145,36 +145,35 @@
{
long bytesRead = 0;
char *p = (char *) data;
- long avail, readBytes = 0, numBytes = aStream->bytesPerFrame * numFrames;
+ long avail, totalBytes = 0, neededBytes = aStream->bytesPerFrame * numFrames;
- while (numBytes > 0) {
+ for(;;) {
avail = PaUtil_GetRingBufferReadAvailable(&aStream->inFIFO);
-
- if (avail >= numBytes * 10) {
+
+ if (switch_core_timer_check(timer, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
+ break;
+ }
+
+ if (avail >= neededBytes * 6) {
PaUtil_FlushRingBuffer(&aStream->inFIFO);
avail = 0;
}
- if (avail >= numBytes * 2) {
- bytesRead = PaUtil_ReadRingBuffer(&aStream->inFIFO, p, numBytes);
- numBytes -= bytesRead;
- readBytes += bytesRead;
+ bytesRead = 0;
+
+ if (totalBytes < neededBytes && avail >= neededBytes) {
+ bytesRead = PaUtil_ReadRingBuffer(&aStream->inFIFO, p, neededBytes);
+ totalBytes += bytesRead;
}
- if (numBytes > 0) {
- if (switch_core_timer_check(timer, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
- break;
- }
- switch_yield(1000);
+ if (bytesRead) {
p += bytesRead;
+ } else {
+ switch_yield(1000);
}
}
- if (readBytes) {
- switch_core_timer_sync(timer);
- }
-
- return readBytes / aStream->bytesPerFrame;
+ return totalBytes / aStream->bytesPerFrame;
}
/************************************************************
More information about the Freeswitch-svn
mailing list