]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
skypiax: tentative timing on windoz, let's see if still works on linux
authorGiovanni Maruzzelli <gmaruzz@gmail.com>
Wed, 17 Feb 2010 02:20:17 +0000 (02:20 +0000)
committerGiovanni Maruzzelli <gmaruzz@gmail.com>
Wed, 17 Feb 2010 02:20:17 +0000 (02:20 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16670 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_skypiax/mod_skypiax.c
src/mod/endpoints/mod_skypiax/skypiax.h
src/mod/endpoints/mod_skypiax/skypiax_protocol.c

index d25acfa79f028f58d06c4d2e9c014fa7903ed9c7..59ce53c72a45f821a1360e490c0ce8932d96a253 100644 (file)
@@ -688,6 +688,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
                return SWITCH_STATUS_FALSE;
        }
 
+tech_pvt->begin_to_read=1;
        tech_pvt->read_frame.flags = SFF_NONE;
        *frame = NULL;
 
@@ -1777,6 +1778,7 @@ int start_audio_threads(private_t * tech_pvt)
        switch_threadattr_t *thd_attr = NULL;
 
 tech_pvt->begin_to_write=0;
+tech_pvt->begin_to_read=0;
 
        switch_threadattr_create(&thd_attr, skypiax_module_pool);
        switch_threadattr_detach_set(thd_attr, 1);
index f1425b71012aa669f190788442a4cae90e3cd7b0..a9c6916da5a363a3e895640132367d52313e7297 100644 (file)
@@ -279,6 +279,7 @@ struct private_object {
        switch_timer_t timer_read;
        switch_timer_t timer_write;
 int begin_to_write;
+int begin_to_read;
 };
 
 typedef struct private_object private_t;
index 9f76edb41cbae94f5b83e2c950455c96cc132eed..34c2be442816e2d4f13d2823dafeb61f05baa1f6 100644 (file)
@@ -813,10 +813,15 @@ void *skypiax_do_tcp_srv_thread_func(void *obj)
                                        to.tv_usec = 60000;     //60 msec
                                        to.tv_sec = 0;
 
+if(tech_pvt->begin_to_read==0){
+skypiax_sleep(1000);
+continue;
+}
                                         if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) {
        switch_core_timer_next(&tech_pvt->timer_read);
                                         }
-                                       rt = select(fdselect + 1, &fs, NULL, NULL, &to);
+                                       //rt = select(fdselect + 1, &fs, NULL, NULL, &to);
+rt=1;
                                        if (rt > 0) {
 
                                                if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
@@ -889,6 +894,7 @@ void *skypiax_do_tcp_srv_thread_func(void *obj)
                                                        }
 
                                                } else if (len == 640) {
+#if 0
                                                        int waitin;
                                                        int max_waitin=20;
 
@@ -897,12 +903,15 @@ void *skypiax_do_tcp_srv_thread_func(void *obj)
                                                                switch_sleep(1000);     //1 millisec
                                                                waitin++;
                                                                if(waitin == max_waitin){
+                                                               ERRORA("waitin is %d\n", SKYPIAX_P_LOG, waitin);
                                                                        break;
                                                                }
                                                        }
 
-                                                       if(waitin > 1)
+                                                       if(waitin > 10){
                                                                ERRORA("waitin is %d\n", SKYPIAX_P_LOG, waitin);
+                                                       }
+#endif//0
                                                        switch_mutex_lock(tech_pvt->mutex_audio_srv);
                                                        memcpy(tech_pvt->audiobuf_srv, srv_in, SAMPLES_PER_FRAME * sizeof(short));
                                                        tech_pvt->flag_audio_srv = 1;
@@ -1218,6 +1227,7 @@ int skypiax_audio_read(private_t * tech_pvt)
 {
        unsigned int samples;
        int waitin;
+       int max_waitin=20;
 
        waitin=0;
        while (tech_pvt->flag_audio_srv == 0) {
@@ -1228,10 +1238,14 @@ int skypiax_audio_read(private_t * tech_pvt)
 #endif //WIN32
                waitin++;
 
+               if(waitin == max_waitin){
+               ERRORA("read is now %d\n", SKYPIAX_P_LOG, waitin);
+                       break;
+               }
                //WARNINGA("read now is 0\n", SKYPIAX_P_LOG);
        }
-       if(waitin > 21){
-               ERRORA("read is now %d\n", SKYPIAX_P_LOG, waitin);
+       if(waitin > 10){
+               //ERRORA("read is now %d\n", SKYPIAX_P_LOG, waitin);
        }
        //samples = skypiax_pipe_read(tech_pvt->audiopipe_srv[0], tech_pvt->read_frame.data, SAMPLES_PER_FRAME * sizeof(short));
                        switch_mutex_lock(tech_pvt->mutex_audio_srv);