Revision
16670
Author
gmaruzz
Date
2010-02-16 20:20:17 -0600 (Tue, 16 Feb 2010)

Log Message

skypiax: tentative timing on windoz, let's see if still works on linux

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c (16669 => 16670)


--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c	2010-02-17 02:04:04 UTC (rev 16669)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c	2010-02-17 02:20:17 UTC (rev 16670)
@@ -688,6 +688,7 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
+tech_pvt->begin_to_read=1;
 	tech_pvt->read_frame.flags = SFF_NONE;
 	*frame = NULL;
 
@@ -1777,6 +1778,7 @@
 	switch_threadattr_t *thd_attr = NULL;
 
 tech_pvt->begin_to_write=0;
+tech_pvt->begin_to_read=0;
 
 	switch_threadattr_create(&thd_attr, skypiax_module_pool);
 	switch_threadattr_detach_set(thd_attr, 1);

Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h (16669 => 16670)


--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h	2010-02-17 02:04:04 UTC (rev 16669)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h	2010-02-17 02:20:17 UTC (rev 16670)
@@ -279,6 +279,7 @@
 	switch_timer_t timer_read;
 	switch_timer_t timer_write;
 int begin_to_write;
+int begin_to_read;
 };
 
 typedef struct private_object private_t;

Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (16669 => 16670)


--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c	2010-02-17 02:04:04 UTC (rev 16669)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c	2010-02-17 02:20:17 UTC (rev 16670)
@@ -813,10 +813,15 @@
 					to.tv_usec = 60000;	//60 msec
 					to.tv_sec = 0;
 
+if(tech_pvt->begin_to_read==0){
+skypiax_sleep(1000);
+continue;
+}
 					 if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) {
 	switch_core_timer_next(&tech_pvt->timer_read);
 					 }
-					rt = select(fdselect + 1, &fs, NULL, NULL, &to);
+					//rt = select(fdselect + 1, &fs, NULL, NULL, &to);
+rt=1;
 					if (rt > 0) {
 
 						if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
@@ -889,6 +894,7 @@
 							}
 
 						} else if (len == 640) {
+#if 0
 							int waitin;
 							int max_waitin=20;
 
@@ -897,12 +903,15 @@
 								switch_sleep(1000);	//1 millisec
 								waitin++;
 								if(waitin == max_waitin){
+								ERRORA("waitin is %d\n", SKYPIAX_P_LOG, waitin);
 									break;
 								}
 							}
 
-							if(waitin > 1)
+							if(waitin > 10){
 								ERRORA("waitin is %d\n", SKYPIAX_P_LOG, waitin);
+							}
+#endif//0
 							switch_mutex_lock(tech_pvt->mutex_audio_srv);
 							memcpy(tech_pvt->audiobuf_srv, srv_in, SAMPLES_PER_FRAME * sizeof(short));
 							tech_pvt->flag_audio_srv = 1;
@@ -1218,6 +1227,7 @@
 {
 	unsigned int samples;
 	int waitin;
+	int max_waitin=20;
 
 	waitin=0;
 	while (tech_pvt->flag_audio_srv == 0) {
@@ -1228,10 +1238,14 @@
 #endif //WIN32
 		waitin++;
 
+		if(waitin == max_waitin){
+		ERRORA("read is now %d\n", SKYPIAX_P_LOG, waitin);
+			break;
+		}
 		//WARNINGA("read now is 0\n", SKYPIAX_P_LOG);
 	}
-	if(waitin > 21){
-		ERRORA("read is now %d\n", SKYPIAX_P_LOG, waitin);
+	if(waitin > 10){
+		//ERRORA("read is now %d\n", SKYPIAX_P_LOG, waitin);
 	}
 	//samples = skypiax_pipe_read(tech_pvt->audiopipe_srv[0], tech_pvt->read_frame.data, SAMPLES_PER_FRAME * sizeof(short));
 			switch_mutex_lock(tech_pvt->mutex_audio_srv);