[Freeswitch-svn] [commit] r11728 - freeswitch/branches/gmaruzz/mod_skypiax

FreeSWITCH SVN gmaruzz at freeswitch.org
Tue Feb 10 08:44:18 PST 2009


Author: gmaruzz
Date: Tue Feb 10 10:44:18 2009
New Revision: 11728

Log:
skypiax: better audio quality by keeping skype socket busy on *nix and cygwin

Modified:
   freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c

Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c	(original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c	Tue Feb 10 10:44:18 2009
@@ -565,16 +565,25 @@
 
       if (!running)
         break;
-      fdselect = fd;
       FD_ZERO(&fs);
-      FD_SET(fdselect, &fs);
-      to.tv_usec = 2000000;     //2000 msec
+      to.tv_usec = 60000;  //60msec
       to.tv_sec = 0;
+#if defined(WIN32) && !defined(__CYGWIN__)
+/* on win32 we cannot select from the apr "pipe", so we select on socket writability */
+      fdselect = fd;
+      FD_SET(fdselect, &fs);
 
       rt = select(fdselect + 1, NULL, &fs, NULL, &to);
+#else
+/* on *unix and cygwin we select from the real pipe */
+      fdselect = tech_pvt->audioskypepipe[0];
+      FD_SET(fdselect, &fs);
 
-      if (rt > 0) {
+      rt = select(fdselect + 1, &fs, NULL, NULL, &to);
+#endif
 
+
+      if (rt > 0) {
         /* read from the pipe the audio frame we are supposed to send out */
         got =
           skypiax_pipe_read(tech_pvt->audioskypepipe[0], cli_in,
@@ -622,9 +631,11 @@
                    (int)(SAMPLES_PER_FRAME * sizeof(short)));
         }
       } else {
-        if (rt)
+        //if (rt)
           ERRORA("CLI rt=%d\n", SKYPIAX_P_LOG, rt);
-        skypiax_sleep(10000);
+	  memset(cli_out, 0, sizeof(cli_out));
+          len = send(fd, (char *) cli_out, sizeof(cli_out), 0);
+        //skypiax_sleep(10000);
       }
 
     }



More information about the Freeswitch-svn mailing list