提交 5a050678 authored 作者: Giovanni Maruzzelli's avatar Giovanni Maruzzelli

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
上级 a835b4bc
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论