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

FreeSWITCH SVN gmaruzz at freeswitch.org
Mon Feb 9 07:49:57 PST 2009


Author: gmaruzz
Date: Mon Feb  9 09:49:56 2009
New Revision: 11701

Log:
skypiax: cleaning skypiax_protocol.c

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	Mon Feb  9 09:49:56 2009
@@ -306,32 +306,21 @@
     while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
            && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
                || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
-#ifdef WIN32
       unsigned int fdselect;
-#else
-      int fdselect;
-#endif /* WIN32 */
       int rt;
       fd_set fs;
       struct timeval to;
 
       if (!running)
         break;
-#ifdef WIN32
-      fdselect = fd;            //cannot select on audioskypepipe, let's select on socket write
-#else /* WIN32 */
-      fdselect = tech_pvt->audioskypepipe[0];
-#endif /* WIN32 */
+      fdselect = fd;   
       FD_ZERO(&fs);
       FD_SET(fdselect, &fs);
       to.tv_usec = 2000000;     //2000 msec
       to.tv_sec = 0;
 
-#ifdef WIN32
-      rt = select(fdselect + 1, NULL, &fs, NULL, &to);  //cannot select on audioskypepipe, let's select on socket write
-#else /* WIN32 */
-      rt = select(fdselect + 1, &fs, NULL, NULL, &to);
-#endif /* WIN32 */
+      rt = select(fdselect + 1, NULL, &fs, NULL, &to); 
+
       if (rt > 0) {
 
         /* read from the pipe the audio frame we are supposed to send out */
@@ -339,7 +328,7 @@
           skypiax_pipe_read(tech_pvt->audioskypepipe[0], cli_in,
                             SAMPLES_PER_FRAME * sizeof(short));
         if (got != SAMPLES_PER_FRAME * sizeof(short)) {
-          ERRORA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
+          WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
                  SAMPLES_PER_FRAME * sizeof(short));
         }
 
@@ -365,11 +354,7 @@
           }
 
           /* send the 16khz frame to the Skype client waiting for incoming audio */
-#ifdef WIN32
           len = send(fd, (char *) cli_out, got, 0);
-#else /* WIN32 */
-          len = send(fd, cli_out, got, 0);
-#endif /* WIN32 */
 
           if (len == -1) {
             break;
@@ -381,10 +366,8 @@
 
         } else {
 
-          ERRORA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
+          WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
                  SAMPLES_PER_FRAME * sizeof(short));
-          skypiax_sleep(10000);
-
         }
       } else {
         if (rt)
@@ -437,44 +420,19 @@
 int skypiax_skypeaudio_read(private_t * tech_pvt)
 {
   unsigned int samples;
-  int rt;
-#ifndef WIN32
-  int fdselect;
-  fd_set fs;
-  struct timeval to;
-#endif /* WIN32 */
 
-#ifdef WIN32
-  rt = 1;
-#else /* WIN32 */
-  fdselect = tech_pvt->audiopipe[0];
-  FD_ZERO(&fs);
-  FD_SET(fdselect, &fs);
-  to.tv_usec = 2000000;         //2000 msec
-  to.tv_sec = 0;
-  rt = select(fdselect + 1, &fs, NULL, NULL, &to);
-#endif /* WIN32 */
-  if (rt > 0) {
-    samples = SAMPLES_PER_FRAME * sizeof(short);
+    //samples = SAMPLES_PER_FRAME * sizeof(short);
     samples =
-      skypiax_pipe_read(tech_pvt->audiopipe[0], tech_pvt->read_frame.data, samples);
+      skypiax_pipe_read(tech_pvt->audiopipe[0], tech_pvt->read_frame.data, SAMPLES_PER_FRAME * sizeof(short));
 
-    //ERRORA("tech_pvt->audiopipe[0] = %d\n", SKYPIAX_P_LOG, tech_pvt->audiopipe[0]);
-    //ERRORA("tech_pvt->audiopipe[1] = %d\n", SKYPIAX_P_LOG, tech_pvt->audiopipe[1]);
     if (samples != SAMPLES_PER_FRAME * sizeof(short)) {
-      //if (samples)
-      //ERRORA("SRV PIPE READ=====> NOT GOOD samples=%u expected=%lu\n", SKYPIAX_P_LOG, samples, SAMPLES_PER_FRAME * sizeof(short));
-      //assert(samples == SAMPLES_PER_FRAME * sizeof(short)); //do a crash, please
+      if (samples)
+      WARNINGA("read samples=%u expected=%u\n", SKYPIAX_P_LOG, samples, SAMPLES_PER_FRAME * sizeof(short));
       return 0;
     } else {
       /* A real frame */
       tech_pvt->read_frame.datalen = samples;
     }
-  } else {
-    if (rt)
-      DEBUGA_SKYPE("select returned %d\n", SKYPIAX_P_LOG, rt);
-    //do nothing
-  }
   return 1;
 }
 



More information about the Freeswitch-svn mailing list