<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][16633] </title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=16633">16633</a></dd>
<dt>Author</dt> <dd>gmaruzz</dd>
<dt>Date</dt> <dd>2010-02-13 10:54:24 -0600 (Sat, 13 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>skypiax: restored a previous wrong commit</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcmodendpointsmod_skypiaxmod_skypiaxc">freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_skypiaxskypiaxh">freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_skypiaxskypiax_protocolc">freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcmodendpointsmod_skypiaxmod_skypiaxc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c (16632 => 16633)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c        2010-02-13 11:10:30 UTC (rev 16632)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c        2010-02-13 16:54:24 UTC (rev 16633)
</span><span class="lines">@@ -36,12 +36,7 @@
</span><span class="cx">
</span><span class="cx"> #include "skypiax.h"
</span><span class="cx"> #define MDL_CHAT_PROTO "skype"
</span><del>-#define TIMERS_ON
-#ifdef TIMERS_ON
</del><span class="cx"> #define TIMER_WRITE
</span><del>-#else
-#undef TIMER_WRITE
-#endif
</del><span class="cx">
</span><span class="cx"> #ifdef WIN32
</span><span class="cx"> /***************/
</span><span class="lines">@@ -263,7 +258,6 @@
</span><span class="cx">                 return SWITCH_STATUS_FALSE;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-#ifdef TIMERS_ON
</del><span class="cx">         if (switch_core_timer_init(&tech_pvt->timer_read, "soft", 20, tech_pvt->read_codec.implementation->samples_per_packet, skypiax_module_pool) !=
</span><span class="cx">                 SWITCH_STATUS_SUCCESS) {
</span><span class="cx">                 ERRORA("setup timer failed\n", SKYPIAX_P_LOG);
</span><span class="lines">@@ -271,7 +265,6 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         switch_core_timer_sync(&tech_pvt->timer_read);
</span><del>-#endif// TIMERS_ON
</del><span class="cx">
</span><span class="cx"> #ifdef TIMER_WRITE
</span><span class="cx">         if (switch_core_timer_init(&tech_pvt->timer_write, "soft", 20, tech_pvt->write_codec.implementation->samples_per_packet, skypiax_module_pool) !=
</span><span class="lines">@@ -489,9 +482,7 @@
</span><span class="cx">                         switch_core_codec_destroy(&tech_pvt->write_codec);
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-#ifdef TIMERS_ON
</del><span class="cx">                 switch_core_timer_destroy(&tech_pvt->timer_read);
</span><del>-#endif// TIMERS_ON
</del><span class="cx"> #ifdef TIMER_WRITE
</span><span class="cx">
</span><span class="cx">                 switch_core_timer_destroy(&tech_pvt->timer_write);
</span><span class="lines">@@ -684,7 +675,6 @@
</span><span class="cx">         switch_channel_t *channel = NULL;
</span><span class="cx">         private_t *tech_pvt = NULL;
</span><span class="cx">         switch_byte_t *data;
</span><del>-//unsigned int len;
</del><span class="cx">
</span><span class="cx">         channel = switch_core_session_get_channel(session);
</span><span class="cx">         switch_assert(channel != NULL);
</span><span class="lines">@@ -703,15 +693,8 @@
</span><span class="cx">
</span><span class="cx">         //switch_core_timer_next(&tech_pvt->timer_read);
</span><span class="cx">
</span><del>-                                                if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
-                                                        tech_pvt->read_frame.datalen = recv(tech_pvt->readfd, (char *) tech_pvt->read_frame.data, 320, 0);        //seems that Skype only sends 320 bytes at time
-                                                } else {
-                                                        tech_pvt->read_frame.datalen = 0;
-                                                }
</del><ins>+        if (!skypiax_audio_read(tech_pvt)) {
</ins><span class="cx">
</span><del>-        //if (!skypiax_audio_read(tech_pvt)) {
-        if (!tech_pvt->read_frame.datalen) {
-
</del><span class="cx">                 ERRORA("skypiax_audio_read ERROR\n", SKYPIAX_P_LOG);
</span><span class="cx">
</span><span class="cx">         } else {
</span><span class="lines">@@ -736,9 +719,7 @@
</span><span class="cx">                                 DEBUGA_SKYPE("CHANNEL READ CONTINUE\n", SKYPIAX_P_LOG);
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><del>-#ifdef TIMERS_ON
</del><span class="cx">                         switch_core_timer_check(&tech_pvt->timer_read, SWITCH_TRUE);
</span><del>-#endif// TIMERS_ON
</del><span class="cx">                         *frame = &tech_pvt->read_frame;
</span><span class="cx"> #if SWITCH_BYTE_ORDER == __BIG_ENDIAN
</span><span class="cx">                         if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
</span><span class="lines">@@ -771,7 +752,7 @@
</span><span class="cx"> {
</span><span class="cx">         switch_channel_t *channel = NULL;
</span><span class="cx">         private_t *tech_pvt = NULL;
</span><del>-        unsigned int sent=0;
</del><ins>+        unsigned int sent;
</ins><span class="cx">
</span><span class="cx">         channel = switch_core_session_get_channel(session);
</span><span class="cx">         switch_assert(channel != NULL);
</span><span class="lines">@@ -790,50 +771,25 @@
</span><span class="cx">         }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-#if 0
</del><span class="cx">         sent = frame->datalen;
</span><span class="cx"> #ifdef WIN32
</span><span class="cx">         //switch_file_write(tech_pvt->audiopipe_cli[1], frame->data, &sent);
</span><span class="cx"> #else /* WIN32 */
</span><span class="cx">         //sent = write(tech_pvt->audiopipe_cli[1], frame->data, sent);
</span><span class="cx"> #endif /* WIN32 */
</span><del>-        //if (tech_pvt->flag_audio_cli == 0) {
</del><ins>+        if (tech_pvt->flag_audio_cli == 1) {
+                switch_sleep(1000);                //1 millisec
+        }
+        if (tech_pvt->flag_audio_cli == 0) {
</ins><span class="cx"> #ifdef TIMER_WRITE
</span><span class="cx">                 switch_core_timer_next(&tech_pvt->timer_write);
</span><span class="cx"> #endif // TIMER_WRITE
</span><span class="cx">
</span><del>-        //while (tech_pvt->flag_audio_cli == 1) {
-                //switch_sleep(1000);                //10 millisec
-                                                //WARNINGA("write now is 1\n", SKYPIAX_P_LOG);
-        //}
-        switch_mutex_lock(tech_pvt->flag_audio_cli_mutex);
</del><span class="cx">                 memcpy(tech_pvt->audiobuf_cli, frame->data, frame->datalen);
</span><span class="cx">                 tech_pvt->flag_audio_cli = 1;
</span><del>-        switch_mutex_unlock(tech_pvt->flag_audio_cli_mutex);
-        //}
</del><ins>+        }
</ins><span class="cx">         //NOTICA("write \n", SKYPIAX_P_LOG);
</span><del>-#endif //0
</del><span class="cx">
</span><del>-#ifdef TIMER_WRITE
-/* NONBLOCKING ? */
-                switch_core_timer_next(&tech_pvt->timer_write);
-                //switch_core_timer_check(&tech_pvt->timer_write, SWITCH_TRUE);
-#endif // TIMER_WRITE
-        /* send the 16khz frame to the Skype client waiting for incoming audio to be sent to the remote party */
-                                                                if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
-                                                                        sent = send(tech_pvt->writefd, (char *) frame->data, frame->datalen, 0);
-                                                                        if (sent == -1) {
-                                                                                ERRORA("EXIT? sent=%d\n", SKYPIAX_P_LOG, sent);
-                                                                        } else if (sent != frame->datalen) {
-                                                                                ERRORA("sent=%d\n", SKYPIAX_P_LOG, sent);
-                                                                        }
-                                                                }
-
-
-#ifdef TIMER_WRITE
-/* BLOCKING ? */
-                //switch_core_timer_check(&tech_pvt->timer_write, SWITCH_TRUE);
-#endif // TIMER_WRITE
</del><span class="cx">         if (sent != frame->datalen && sent != -1) {
</span><span class="cx">                 DEBUGA_SKYPE("CLI PIPE write %d\n", SKYPIAX_P_LOG, sent);
</span><span class="cx">         }
</span><span class="lines">@@ -874,9 +830,7 @@
</span><span class="cx">                 {
</span><span class="cx">                         DEBUGA_SKYPE("MSG_ID=%d, TO BE ANSWERED!\n", SKYPIAX_P_LOG, msg->message_id);
</span><span class="cx">
</span><del>-#ifdef TIMERS_ON
</del><span class="cx">                         switch_core_timer_sync(&tech_pvt->timer_read);
</span><del>-#endif// TIMERS_ON
</del><span class="cx"> #ifdef TIMER_WRITE
</span><span class="cx">                         switch_core_timer_sync(&tech_pvt->timer_write);
</span><span class="cx"> #endif // TIMER_WRITE
</span><span class="lines">@@ -887,9 +841,7 @@
</span><span class="cx">
</span><span class="cx">                 DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_AUDIO_SYNC\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
</span><span class="cx">
</span><del>-#ifdef TIMERS_ON
</del><span class="cx">                 switch_core_timer_sync(&tech_pvt->timer_read);
</span><del>-#endif// TIMERS_ON
</del><span class="cx"> #ifdef TIMER_WRITE
</span><span class="cx">                 switch_core_timer_sync(&tech_pvt->timer_write);
</span><span class="cx"> #endif // TIMER_WRITE
</span><span class="lines">@@ -897,9 +849,7 @@
</span><span class="cx">         default:
</span><span class="cx">                 {
</span><span class="cx">
</span><del>-#ifdef TIMERS_ON
</del><span class="cx">                         switch_core_timer_sync(&tech_pvt->timer_read);
</span><del>-#endif// TIMERS_ON
</del><span class="cx"> #ifdef TIMER_WRITE
</span><span class="cx">
</span><span class="cx">                         switch_core_timer_sync(&tech_pvt->timer_write);
</span><span class="lines">@@ -1444,8 +1394,6 @@
</span><span class="cx">
</span><span class="cx">                                 skypiax_audio_init(&globals.SKYPIAX_INTERFACES[interface_id]);
</span><span class="cx">
</span><del>-        switch_mutex_init(&globals.SKYPIAX_INTERFACES[interface_id].flag_audio_srv_mutex, SWITCH_MUTEX_NESTED, skypiax_module_pool);
-        switch_mutex_init(&globals.SKYPIAX_INTERFACES[interface_id].flag_audio_cli_mutex, SWITCH_MUTEX_NESTED, skypiax_module_pool);
</del><span class="cx">                                 NOTICA
</span><span class="cx">                                         ("WAITING roughly 10 seconds to find a running Skype client and connect to its SKYPE API for interface_id=%d\n",
</span><span class="cx">                                          SKYPIAX_P_LOG, interface_id);
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_skypiaxskypiaxh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h (16632 => 16633)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h        2010-02-13 11:10:30 UTC (rev 16632)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h        2010-02-13 16:54:24 UTC (rev 16633)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> * Further Contributors:
</span><span class="cx"> *
</span><span class="cx"> *
</span><del>- *
</del><span class="cx"> * mod_skypiax.c -- Skype compatible Endpoint Module
</span><span class="cx"> *
</span><span class="cx"> */
</span><span class="lines">@@ -192,8 +191,6 @@
</span><span class="cx">         switch_caller_profile_t *caller_profile;
</span><span class="cx">         switch_mutex_t *mutex;
</span><span class="cx">         switch_mutex_t *flag_mutex;
</span><del>-        switch_mutex_t *flag_audio_cli_mutex;
-        switch_mutex_t *flag_audio_srv_mutex;
</del><span class="cx">
</span><span class="cx">         char interface_id[80];
</span><span class="cx">         char name[80];
</span><span class="lines">@@ -281,8 +278,6 @@
</span><span class="cx">         uint32_t report_incoming_chatmessages;
</span><span class="cx">         switch_timer_t timer_read;
</span><span class="cx">         switch_timer_t timer_write;
</span><del>-unsigned int writefd;
-unsigned int readfd;
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> typedef struct private_object private_t;
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_skypiaxskypiax_protocolc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (16632 => 16633)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c        2010-02-13 11:10:30 UTC (rev 16632)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c        2010-02-13 16:54:24 UTC (rev 16633)
</span><span class="lines">@@ -55,9 +55,8 @@
</span><span class="cx">                 start_port = *which_port;
</span><span class="cx">
</span><span class="cx">         my_addr.sin_port = htons(start_port);
</span><del>-/* NONBLOCKING ? */
</del><span class="cx">         //fcntl(s, F_SETFL, O_NONBLOCK);
</span><del>-
</del><ins>+        //tech_pvt->tcp_cli_port = start_port;
</ins><span class="cx">         *which_port = start_port;
</span><span class="cx">         while (bind(s, (struct sockaddr *) &my_addr, sizeof(struct sockaddr)) < 0) {
</span><span class="cx">                 DEBUGA_SKYPE("*which_port=%d, tech_pvt->tcp_cli_port=%d, tech_pvt->tcp_srv_port=%d\n", SKYPIAX_P_LOG, *which_port, tech_pvt->tcp_cli_port,
</span><span class="lines">@@ -119,7 +118,6 @@
</span><span class="cx">         size = sizeof(int);
</span><span class="cx">         setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &sockbufsize, size);
</span><span class="cx">
</span><del>-
</del><span class="cx">         sockbufsize = 0;
</span><span class="cx">         size = sizeof(int);
</span><span class="cx">         getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &sockbufsize, &size);
</span><span class="lines">@@ -724,22 +722,22 @@
</span><span class="cx">         private_t *tech_pvt = obj;
</span><span class="cx">         int s;
</span><span class="cx">         unsigned int len;
</span><del>-        //unsigned int i;
-        //unsigned int a;
</del><ins>+        unsigned int i;
+        unsigned int a;
</ins><span class="cx"> #if defined(WIN32) && !defined(__CYGWIN__)
</span><span class="cx">         int sin_size;
</span><span class="cx"> #else /* WIN32 */
</span><span class="cx">         unsigned int sin_size;
</span><span class="cx"> #endif /* WIN32 */
</span><span class="cx">         unsigned int fd;
</span><del>-        //short srv_in[SAMPLES_PER_FRAME];
-        //short srv_out[SAMPLES_PER_FRAME / 2];
</del><ins>+        short srv_in[SAMPLES_PER_FRAME];
+        short srv_out[SAMPLES_PER_FRAME / 2];
</ins><span class="cx">         //struct sockaddr_in my_addr;
</span><span class="cx">         struct sockaddr_in remote_addr;
</span><span class="cx">         //int exit = 0;
</span><span class="cx">         unsigned int kill_cli_size;
</span><span class="cx">         short kill_cli_buff[SAMPLES_PER_FRAME];
</span><del>-        //short totalbuf[SAMPLES_PER_FRAME];
</del><ins>+        short totalbuf[SAMPLES_PER_FRAME];
</ins><span class="cx">         int sockbufsize = 0;
</span><span class="cx">         unsigned int size = sizeof(int);
</span><span class="cx">
</span><span class="lines">@@ -799,13 +797,6 @@
</span><span class="cx">                                                  || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
</span><span class="cx">                                                  || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
</span><span class="cx">
</span><del>-                                        tech_pvt->readfd = fd;
-                                                //WARNINGA("read HERE\n", SKYPIAX_P_LOG);
-                                                skypiax_sleep(100000);
-
-
-#ifdef NOLOOP
-
</del><span class="cx">                                         unsigned int fdselect;
</span><span class="cx">                                         int rt;
</span><span class="cx">                                         fd_set fs;
</span><span class="lines">@@ -875,16 +866,13 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx">                                                                 howmany = SAMPLES_PER_FRAME * sizeof(short);
</span><del>-                                                                //while (tech_pvt->flag_audio_srv == 1) {
-                                                                        //switch_sleep(1000);        //10 millisec
-                                                //WARNINGA("read now is 1\n", SKYPIAX_P_LOG);
-                                                                //}
-                                                                //if (tech_pvt->flag_audio_srv == 0) {
-        //switch_mutex_lock(tech_pvt->flag_audio_srv_mutex);
</del><ins>+                                                                if (tech_pvt->flag_audio_srv == 1) {
+                                                                        switch_sleep(1000);        //1 millisec
+                                                                }
+                                                                if (tech_pvt->flag_audio_srv == 0) {
</ins><span class="cx">                                                                         memcpy(tech_pvt->audiobuf_srv, totalbuf, SAMPLES_PER_FRAME * sizeof(short));
</span><span class="cx">                                                                         tech_pvt->flag_audio_srv = 1;
</span><del>-        //switch_mutex_unlock(tech_pvt->flag_audio_srv_mutex);
-                                                                //}
</del><ins>+                                                                }
</ins><span class="cx">                                                                 //NOTICA("read \n", SKYPIAX_P_LOG);
</span><span class="cx">                                                                 if (howmany != SAMPLES_PER_FRAME * sizeof(short)) {
</span><span class="cx">                                                                         ERRORA("howmany is %d, but was expected to be %d\n", SKYPIAX_P_LOG,
</span><span class="lines">@@ -906,7 +894,6 @@
</span><span class="cx">                                                 skypiax_sleep(10000);
</span><span class="cx">                                         }
</span><span class="cx">
</span><del>-#endif// NOLOOP
</del><span class="cx">                                 }
</span><span class="cx">
</span><span class="cx">                                 /* let's send some frame in the pipes, so both tcp_cli and tcp_srv will have an occasion to die */
</span><span class="lines">@@ -931,7 +918,6 @@
</span><span class="cx">                                 skypiax_sleep(2000);
</span><span class="cx">                                 DEBUGA_SKYPE("Skype incoming audio GONE\n", SKYPIAX_P_LOG);
</span><span class="cx">                                 skypiax_close_socket(fd);
</span><del>-                                break;
</del><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -948,15 +934,13 @@
</span><span class="cx">         int s;
</span><span class="cx">         //struct sockaddr_in my_addr;
</span><span class="cx">         struct sockaddr_in remote_addr;
</span><del>-#ifdef NOVARS
</del><span class="cx">         unsigned int got;
</span><span class="cx">         unsigned int len;
</span><span class="cx">         unsigned int i;
</span><span class="cx">         unsigned int a;
</span><ins>+        unsigned int fd;
</ins><span class="cx">         short cli_out[SAMPLES_PER_FRAME * 2];
</span><span class="cx">         short cli_in[SAMPLES_PER_FRAME];
</span><del>-#endif// NOVARS
-        unsigned int fd;
</del><span class="cx"> #ifdef WIN32
</span><span class="cx">         int sin_size;
</span><span class="cx"> #else
</span><span class="lines">@@ -1025,19 +1009,10 @@
</span><span class="cx">
</span><span class="cx">                                 if (!(running && tech_pvt->running))
</span><span class="cx">                                         break;
</span><del>-
-
-
-
</del><span class="cx">                                 while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
</span><span class="cx">                                          && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
</span><span class="cx">                                                  || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
</span><span class="cx">                                                  || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
</span><del>-                                        tech_pvt->writefd = fd;
-                                                //NOTICA("write HERE\n", SKYPIAX_P_LOG);
-                                                skypiax_sleep(100000);
-#if 0
-#ifdef NOVARS
</del><span class="cx">                                         unsigned int fdselect;
</span><span class="cx">                                         int rt;
</span><span class="cx">                                         fd_set fs;
</span><span class="lines">@@ -1064,46 +1039,32 @@
</span><span class="cx">                                         fdselect = fd;
</span><span class="cx">                                         FD_SET(fdselect, &fs);
</span><span class="cx">
</span><del>-#endif// NOVARS
-#if 0
-                                        rt = select(fdselect + 1, NULL, &fs, NULL, NULL);
</del><ins>+                                        //FIXME rt = select(fdselect + 1, NULL, &fs, NULL, &to);
</ins><span class="cx">                                         while (tech_pvt->flag_audio_cli == 0) {
</span><span class="cx"> #ifdef WIN32
</span><span class="cx">                                                 skypiax_sleep(100);        //0.1 millisec
</span><span class="cx"> #else
</span><del>-                                                skypiax_sleep(1000);        //10 millisec
</del><ins>+                                                skypiax_sleep(1000);        //1 millisec
</ins><span class="cx"> #endif //WIN32
</span><del>-                                                NOTICA("write now is 0\n", SKYPIAX_P_LOG);
</del><ins>+                                                //WARNINGA("write now is 0\n", SKYPIAX_P_LOG);
</ins><span class="cx">                                         }
</span><span class="cx">                                         //ERRORA("write is now 1\n", SKYPIAX_P_LOG);
</span><span class="cx">
</span><span class="cx">                                         rt = 1;
</span><del>-#endif //0
-                                        //rt = select(fdselect + 1, NULL, &fs, NULL, NULL);
</del><span class="cx">
</span><del>-#ifdef NOLOOP
</del><span class="cx">                                         if (rt > 0) {
</span><span class="cx">                                                 int counter;
</span><del>-#if 0
-                                        while (tech_pvt->flag_audio_cli == 0) {
-#ifdef WIN32
-                                                skypiax_sleep(100);        //0.1 millisec
-#else
-                                                skypiax_sleep(10000);        //10 millisec
-#endif //WIN32
-                                                WARNINGA("write now is 0\n", SKYPIAX_P_LOG);
-                                        }
-#endif //0
-        
</del><ins>+
</ins><span class="cx">                                                 /* until we drained the pipe to empty */
</span><ins>+                                                //for (counter = 0; counter < 10; counter++) {
</ins><span class="cx">                                                 for (counter = 0; counter < 1; counter++) {
</span><span class="cx">                                                         /* read from the pipe the audio frame we are supposed to send out */
</span><span class="cx">                                                         //got = skypiax_pipe_read(tech_pvt->audiopipe_cli[0], cli_in, SAMPLES_PER_FRAME * sizeof(short));
</span><span class="cx">
</span><span class="cx">
</span><span class="cx">                                                         got = SAMPLES_PER_FRAME * sizeof(short);
</span><del>-        switch_mutex_lock(tech_pvt->flag_audio_cli_mutex);
</del><span class="cx">                                                         memcpy(cli_in, tech_pvt->audiobuf_cli, SAMPLES_PER_FRAME * sizeof(short));
</span><ins>+                                                        tech_pvt->flag_audio_cli = 0;
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -1139,7 +1100,6 @@
</span><span class="cx">                                                                 /* send the 16khz frame to the Skype client waiting for incoming audio to be sent to the remote party */
</span><span class="cx">                                                                 if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
</span><span class="cx">                                                                         len = send(fd, (char *) cli_out, got, 0);
</span><del>-                                                        tech_pvt->flag_audio_cli = 0;
</del><span class="cx">                                                                         //skypiax_sleep(5000); //5 msec
</span><span class="cx">
</span><span class="cx">                                                                         if (len == -1) {
</span><span class="lines">@@ -1151,7 +1111,6 @@
</span><span class="cx">                                                                         }
</span><span class="cx">                                                                 }
</span><span class="cx">
</span><del>-        switch_mutex_unlock(tech_pvt->flag_audio_cli_mutex);
</del><span class="cx">                                                         } else {
</span><span class="cx">
</span><span class="cx">                                                                 WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got, (int) (SAMPLES_PER_FRAME * sizeof(short)));
</span><span class="lines">@@ -1174,12 +1133,9 @@
</span><span class="cx">                                                 skypiax_sleep(1000);
</span><span class="cx">                                         }
</span><span class="cx">
</span><del>-#endif// NOLOOP
-#endif// 0
</del><span class="cx">                                 }
</span><span class="cx">                                 DEBUGA_SKYPE("Skype outbound audio GONE\n", SKYPIAX_P_LOG);
</span><span class="cx">                                 skypiax_close_socket(fd);
</span><del>-                                break;
</del><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -1194,24 +1150,20 @@
</span><span class="cx"> {
</span><span class="cx">         unsigned int samples;
</span><span class="cx">
</span><del>-#if 0
</del><span class="cx">         while (tech_pvt->flag_audio_srv == 0) {
</span><span class="cx"> #ifdef WIN32
</span><span class="cx">                 skypiax_sleep(100);                //0.1 millisec
</span><span class="cx"> #else
</span><del>-                skypiax_sleep(1000);        //10 millisec
</del><ins>+                skypiax_sleep(1000);        //1 millisec
</ins><span class="cx"> #endif //WIN32
</span><span class="cx">
</span><del>-                WARNINGA("read now is 0\n", SKYPIAX_P_LOG);
</del><ins>+                //WARNINGA("read now is 0\n", SKYPIAX_P_LOG);
</ins><span class="cx">         }
</span><del>-#endif //0
</del><span class="cx">         //ERRORA("read is now 1\n", SKYPIAX_P_LOG);
</span><span class="cx">         //samples = skypiax_pipe_read(tech_pvt->audiopipe_srv[0], tech_pvt->read_frame.data, SAMPLES_PER_FRAME * sizeof(short));
</span><span class="cx">         samples = SAMPLES_PER_FRAME * sizeof(short);
</span><del>-        //switch_mutex_lock(tech_pvt->flag_audio_srv_mutex);
</del><span class="cx">         memcpy(tech_pvt->read_frame.data, tech_pvt->audiobuf_srv, SAMPLES_PER_FRAME * sizeof(short));
</span><span class="cx">         tech_pvt->flag_audio_srv = 0;
</span><del>-        //switch_mutex_unlock(tech_pvt->flag_audio_srv_mutex);
</del><span class="cx">
</span><span class="cx">         if (samples != SAMPLES_PER_FRAME * sizeof(short)) {
</span><span class="cx">                 if (samples)
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>