[Freeswitch-svn] [commit] r10599 - freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax

FreeSWITCH SVN gmaruzz at freeswitch.org
Thu Dec 4 12:42:17 PST 2008


Author: gmaruzz
Date: Thu Dec  4 15:42:15 2008
New Revision: 10599

Log:
skypiax: giving timeouts to pipes at least on linux seems to works well. Lets see on win32

Modified:
   freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c

Modified: freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c	(original)
+++ freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c	Thu Dec  4 15:42:15 2008
@@ -34,8 +34,8 @@
  *
  */
 
-#define WIN32_SKYPIAX
-#define __CYGWIN__
+#undef WIN32_SKYPIAX
+#undef __CYGWIN__
 #define MOD_SKYPIAX
 #ifdef MOD_SKYPIAX
 
@@ -689,7 +689,7 @@
   int i;
 
   if (option_debug > 10) {
-    DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
+    WARNINGA("ENTERING FUNC\n", SKYPIAX_P_LOG);
   }
   memset(&my_addr, 0, sizeof(my_addr));
   my_addr.sin_family = AF_INET;
@@ -799,7 +799,7 @@
       break;
   }
 
-  DEBUGA_SKYPE("server (I am it) GONE\n", SKYPIAX_P_LOG);
+  WARNINGA("server (I am it) GONE\n", SKYPIAX_P_LOG);
 #ifndef WIN32_SKYPIAX
   close(s);
 #endif
@@ -821,10 +821,10 @@
   int a;
   int i;
   unsigned int got;
-  int exit=0;
+  //int exit=0;
 
   if (option_debug > 10) {
-    DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
+    WARNINGA("ENTERING FUNC\n", SKYPIAX_P_LOG);
   }
   memset(&my_addr, 0, sizeof(my_addr));
   my_addr.sin_family = AF_INET;
@@ -864,7 +864,7 @@
   fd_set fs;
   struct timeval to;
 
-		exit=1;
+		//exit=1;
 
 
 
@@ -898,24 +898,25 @@
         len = send(fd, out, got * 2, 0);
 
         if (len == 0) {
-          DEBUGA_SKYPE("Skype server GONE\n", SKYPIAX_P_LOG);
+          ERRORA("Skype server GONE\n", SKYPIAX_P_LOG);
           break;
         }
       } else {
         switch_sleep(1000);
+    //ERRORA("Audio skype pipe give us: %u\n", SKYPIAX_P_LOG, got);
       }
   }
 
     }
-    DEBUGA_SKYPE("Skype server GONE\n", SKYPIAX_P_LOG);
+    ERRORA("Skype server GONE\n", SKYPIAX_P_LOG);
 #ifndef WIN32_SKYPIAX
     close(fd);
 #endif
-    if (exit)
+    //if (exit)
       break;
   }
 
-  DEBUGA_SKYPE("client (I am it) GONE\n", SKYPIAX_P_LOG);
+  WARNINGA("client (I am it) GONE\n", SKYPIAX_P_LOG);
 #ifndef WIN32_SKYPIAX
   close(s);
 #endif
@@ -936,6 +937,8 @@
 
     //rv = switch_file_pipe_create_ex(&readp, &writep, APR_FULL_NONBLOCK, module_pool);
     rv = switch_file_pipe_create_ex(&p->audiopipe[0], &p->audiopipe[1], 2, module_pool);
+	rv = switch_file_pipe_timeout_set(p->audiopipe[0], 100000);
+	//rv = switch_file_pipe_timeout_set(p->audiopipe[1], 10000);
     //rv = switch_file_pipe_create(&readp, &writep, module_pool);
 
 
@@ -968,6 +971,8 @@
 */
 
     rv = switch_file_pipe_create_ex(&p->audioskypepipe[0], &p->audioskypepipe[1], 2, module_pool);
+	rv = switch_file_pipe_timeout_set(p->audioskypepipe[0], 100);
+	//rv = switch_file_pipe_timeout_set(p->audioskypepipe[1], 10000);
 #ifdef NOTDEF_WIN32_SKYPIAX
   c = pipe(p->audioskypepipe);
   if (c) {
@@ -1021,9 +1026,9 @@
 
   //if ((samples = read(p->audiopipe[0], buf, SAMPLES_PER_FRAME * sizeof(short))) != 320) 
   if (samples != SAMPLES_PER_FRAME * sizeof(short)) {
-    DEBUGA_SKYPE("read=====> NOT GOOD samples=%d expected=%d\n", SKYPIAX_P_LOG, samples,
-                 SAMPLES_PER_FRAME * sizeof(short));
-    switch_sleep(1000);
+	  if(samples)
+		DEBUGA_SKYPE("read=====> NOT GOOD samples=%d expected=%d\n", SKYPIAX_P_LOG, samples, SAMPLES_PER_FRAME * sizeof(short));
+    //switch_sleep(1000);
     //do nothing
   } else {
 	  tech_pvt->read_frame.datalen=samples;
@@ -2124,7 +2129,7 @@
   if (option_debug > 100) {
     DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
   }
-    DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
+    //DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
 //switch_sleep(1000000);
 
   memset(read_from_pipe, 0, 4096);
@@ -2151,7 +2156,7 @@
 
       if (read_from_pipe[i] == '\0') {
 
-        //if (option_debug > 101)
+        if (option_debug > 101)
           DEBUGA_SKYPE("read_skype: howmany=%d, i=%d, a=%d, |||%s||| \n", SKYPIAX_P_LOG,
                        howmany, i, a, messaggio);
 
@@ -2656,7 +2661,7 @@
   if (option_debug > 100) {
     DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
   }
-    DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
+    //DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
   return 0;
 }
 



More information about the Freeswitch-svn mailing list