skypiax: tentative timing on windoz, let's see if still works on linux

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16670 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Giovanni Maruzzelli 2010-02-17 02:20:17 +00:00
parent a835b4bcea
commit 5a05067830
3 changed files with 21 additions and 4 deletions

View File

@ -688,6 +688,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
tech_pvt->begin_to_read=1;
tech_pvt->read_frame.flags = SFF_NONE; tech_pvt->read_frame.flags = SFF_NONE;
*frame = NULL; *frame = NULL;
@ -1777,6 +1778,7 @@ int start_audio_threads(private_t * tech_pvt)
switch_threadattr_t *thd_attr = NULL; switch_threadattr_t *thd_attr = NULL;
tech_pvt->begin_to_write=0; tech_pvt->begin_to_write=0;
tech_pvt->begin_to_read=0;
switch_threadattr_create(&thd_attr, skypiax_module_pool); switch_threadattr_create(&thd_attr, skypiax_module_pool);
switch_threadattr_detach_set(thd_attr, 1); switch_threadattr_detach_set(thd_attr, 1);

View File

@ -279,6 +279,7 @@ struct private_object {
switch_timer_t timer_read; switch_timer_t timer_read;
switch_timer_t timer_write; switch_timer_t timer_write;
int begin_to_write; int begin_to_write;
int begin_to_read;
}; };
typedef struct private_object private_t; typedef struct private_object private_t;

View File

@ -813,10 +813,15 @@ void *skypiax_do_tcp_srv_thread_func(void *obj)
to.tv_usec = 60000; //60 msec to.tv_usec = 60000; //60 msec
to.tv_sec = 0; 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) { if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) {
switch_core_timer_next(&tech_pvt->timer_read); 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 (rt > 0) {
if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) { 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) { } else if (len == 640) {
#if 0
int waitin; int waitin;
int max_waitin=20; int max_waitin=20;
@ -897,12 +903,15 @@ void *skypiax_do_tcp_srv_thread_func(void *obj)
switch_sleep(1000); //1 millisec switch_sleep(1000); //1 millisec
waitin++; waitin++;
if(waitin == max_waitin){ if(waitin == max_waitin){
ERRORA("waitin is %d\n", SKYPIAX_P_LOG, waitin);
break; break;
} }
} }
if(waitin > 1) if(waitin > 10){
ERRORA("waitin is %d\n", SKYPIAX_P_LOG, waitin); ERRORA("waitin is %d\n", SKYPIAX_P_LOG, waitin);
}
#endif//0
switch_mutex_lock(tech_pvt->mutex_audio_srv); switch_mutex_lock(tech_pvt->mutex_audio_srv);
memcpy(tech_pvt->audiobuf_srv, srv_in, SAMPLES_PER_FRAME * sizeof(short)); memcpy(tech_pvt->audiobuf_srv, srv_in, SAMPLES_PER_FRAME * sizeof(short));
tech_pvt->flag_audio_srv = 1; tech_pvt->flag_audio_srv = 1;
@ -1218,6 +1227,7 @@ int skypiax_audio_read(private_t * tech_pvt)
{ {
unsigned int samples; unsigned int samples;
int waitin; int waitin;
int max_waitin=20;
waitin=0; waitin=0;
while (tech_pvt->flag_audio_srv == 0) { while (tech_pvt->flag_audio_srv == 0) {
@ -1228,10 +1238,14 @@ int skypiax_audio_read(private_t * tech_pvt)
#endif //WIN32 #endif //WIN32
waitin++; 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); //WARNINGA("read now is 0\n", SKYPIAX_P_LOG);
} }
if(waitin > 21){ if(waitin > 10){
ERRORA("read is now %d\n", SKYPIAX_P_LOG, waitin); //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)); //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); switch_mutex_lock(tech_pvt->mutex_audio_srv);