[Freeswitch-svn] [commit] r11685 - in freeswitch/branches/gmaruzz/mod_skypiax: . asterisk

FreeSWITCH SVN gmaruzz at freeswitch.org
Sun Feb 8 03:43:41 PST 2009


Author: gmaruzz
Date: Sun Feb  8 05:43:41 2009
New Revision: 11685

Log:
skypiax: cleaning skypiax_protocol.c, will compile on win32?

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

Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/Makefile
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/Makefile	(original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/Makefile	Sun Feb  8 05:43:41 2009
@@ -49,7 +49,7 @@
 CFLAGS+=-fPIC
 endif
 
-SVNDEF := -D'SKYPIAX_SVN_VERSION="$(shell svnversion -n .)"'
+SVNDEF := -D'SKYPIAX_SVN_VERSION="$(shell svnversion -n ..)"'
 CFLAGS += $(SVNDEF)
 
 

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	Sun Feb  8 05:43:41 2009
@@ -4,15 +4,13 @@
 #define skypiax_sleep usleep
 #define tech_pvt p
 extern int skypiax_debug;
-//#define skypiax_file_write switch_file_write
-//#define skypiax_file_read switch_file_read
 extern char *skypiax_console_active;
 #else /* FREESWITCH */
 #define skypiax_sleep switch_sleep
-extern switch_memory_pool_t *skypiax_module_pool;
-extern switch_endpoint_interface_t *skypiax_endpoint_interface;
 #define skypiax_file_write switch_file_write
 #define skypiax_file_read switch_file_read
+extern switch_memory_pool_t *skypiax_module_pool;
+extern switch_endpoint_interface_t *skypiax_endpoint_interface;
 #endif /* ASTERISK */
 
 extern int option_debug;
@@ -29,23 +27,13 @@
 {
   private_t *tech_pvt = obj;
   int s;
-#ifdef WIN32
   unsigned int len;
   unsigned int i;
   unsigned int a;
-  int sin_size;
-  unsigned int fd;
-  short srv_in[SAMPLES_PER_FRAME];
-  short srv_out[SAMPLES_PER_FRAME / 2];
-#else
-  int len;
-  int i;
-  int a;
   unsigned int sin_size;
-  int fd;
+  unsigned int fd;
   short srv_in[SAMPLES_PER_FRAME];
   short srv_out[SAMPLES_PER_FRAME / 2];
-#endif /* WIN32 */
   struct sockaddr_in my_addr;
   struct sockaddr_in remote_addr;
   int exit = 0;
@@ -89,12 +77,7 @@
            && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
                || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
 
-#ifdef WIN32
       unsigned int fdselect;
-#else
-      int received = 0;
-      int fdselect;
-#endif /* WIN32 */
       int rt;
       fd_set fs;
       struct timeval to;
@@ -112,24 +95,11 @@
       rt = select(fdselect + 1, &fs, NULL, NULL, &to);
       if (rt > 0) {
 
-#ifdef WIN32
         len = recv(fd, (char *) srv_in, 320, 0);    //seems that Skype only sends 320 bytes at time
-#else /* WIN32 */
-        while (received < SAMPLES_PER_FRAME * sizeof(short)) {
-          len = recv(fd, srv_in + (received / sizeof(short)), (SAMPLES_PER_FRAME * sizeof(short)) - received, 0);   //seems that Skype only sends 320 bytes at time
-          received += len;
-          if (len == 0)
-            break;
-        }
-        if (len)
-          len = received;
-#endif /* WIN32 */
 
-        if ((SAMPLERATE_SKYPIAX - 8000) == 0) {
+        if (SAMPLERATE_SKYPIAX == 8000) {
 
-          //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 (len > 0) {
+          if (len == 320) {
             a = 0;
             for (i = 0; i < len / sizeof(short); i++) {
               srv_out[a] = srv_in[i];
@@ -175,19 +145,7 @@
           }
         } else if (SAMPLERATE_SKYPIAX == 16000) {
 
-          //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 (len > 0) {
-            if (len == SAMPLES_PER_FRAME * sizeof(short)) {
-#if defined(WIN32) && !defined(__CYGWIN__) 
-              unsigned int howmany;
-
-              howmany = len;
-              skypiax_file_write(tech_pvt->audiopipe[1], srv_in, &howmany);
-#else /* WIN32 */
-              len = write(tech_pvt->audiopipe[1], srv_in, len);
-#endif /* WIN32 */
-            } else if (len == SAMPLES_PER_FRAME * sizeof(short) / 2) {
+          if (len == 320) {
               if (!tech_pvt->audiobuf_is_loaded) {
                 for (i = 0; i < (len / sizeof(short)); i++) {
                   tech_pvt->audiobuf[i] = srv_in[i];
@@ -210,11 +168,6 @@
 #endif /* WIN32 */
                 tech_pvt->audiobuf_is_loaded = 0;
               }
-
-            } else {
-              ERRORA("SRV len=%d\n", SKYPIAX_P_LOG, len);
-            }
-
           } else if (len == 0) {
             DEBUGA_SKYPE("Skype client GONE\n", SKYPIAX_P_LOG);
             skypiax_sleep(1000);



More information about the Freeswitch-svn mailing list