[Freeswitch-svn] [commit] r7408 - freeswitch/trunk/src/mod/endpoints/mod_portaudio

Freeswitch SVN anthm at freeswitch.org
Mon Jan 28 13:16:17 EST 2008


Author: anthm
Date: Mon Jan 28 13:16:17 2008
New Revision: 7408

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c

Log:
fix timing issue in portaudio

Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c	Mon Jan 28 13:16:17 2008
@@ -540,12 +540,14 @@
 	}
 
 	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_mutex_unlock(globals.device_lock);
-		goto cng;
+        switch_yield(1000);
+        goto get_samples;
 	} else {
 		globals.read_frame.datalen = samples * 2;
 		globals.read_frame.samples = samples;
@@ -731,7 +733,7 @@
 	globals.read_frame.buflen = sizeof(globals.databuf);
 	globals.cng_frame.data = globals.cngbuf;
 	globals.cng_frame.buflen = sizeof(globals.cngbuf);
-	globals.cng_frame.datalen = sizeof(globals.cngbuf);
+	globals.cng_frame.datalen = switch_bytes_per_frame(globals.sample_rate, globals.codec_ms) * 2;
 	switch_set_flag((&globals.cng_frame), SFF_CNG);
 
 	/* connect my internal structure to the blank pointer passed to me */



More information about the Freeswitch-svn mailing list