skypopen: added a second timer on read from Skype client (timer_read_srv), so not to depend anymore from select on that socket
This commit is contained in:
parent
34e44f92a1
commit
9350fb9626
|
@ -526,6 +526,10 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
|
||||||
switch_core_timer_destroy(&tech_pvt->timer_read);
|
switch_core_timer_destroy(&tech_pvt->timer_read);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tech_pvt->timer_read_srv.timer_interface && tech_pvt->timer_read_srv.timer_interface->timer_next) {
|
||||||
|
switch_core_timer_destroy(&tech_pvt->timer_read_srv);
|
||||||
|
}
|
||||||
|
|
||||||
if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) {
|
if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) {
|
||||||
switch_core_timer_destroy(&tech_pvt->timer_write);
|
switch_core_timer_destroy(&tech_pvt->timer_write);
|
||||||
}
|
}
|
||||||
|
@ -1121,6 +1125,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
||||||
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_sync(&tech_pvt->timer_read);
|
switch_core_timer_sync(&tech_pvt->timer_read);
|
||||||
}
|
}
|
||||||
|
if (tech_pvt->timer_read_srv.timer_interface && tech_pvt->timer_read_srv.timer_interface->timer_next) {
|
||||||
|
switch_core_timer_sync(&tech_pvt->timer_read_srv);
|
||||||
|
}
|
||||||
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1146,6 +1153,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
||||||
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_sync(&tech_pvt->timer_read);
|
switch_core_timer_sync(&tech_pvt->timer_read);
|
||||||
}
|
}
|
||||||
|
if (tech_pvt->timer_read_srv.timer_interface && tech_pvt->timer_read_srv.timer_interface->timer_next) {
|
||||||
|
switch_core_timer_sync(&tech_pvt->timer_read_srv);
|
||||||
|
}
|
||||||
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1168,6 +1178,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
||||||
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_sync(&tech_pvt->timer_read);
|
switch_core_timer_sync(&tech_pvt->timer_read);
|
||||||
}
|
}
|
||||||
|
if (tech_pvt->timer_read_srv.timer_interface && tech_pvt->timer_read_srv.timer_interface->timer_next) {
|
||||||
|
switch_core_timer_sync(&tech_pvt->timer_read_srv);
|
||||||
|
}
|
||||||
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2168,6 +2181,13 @@ int start_audio_threads(private_t *tech_pvt)
|
||||||
|
|
||||||
switch_core_timer_sync(&tech_pvt->timer_read);
|
switch_core_timer_sync(&tech_pvt->timer_read);
|
||||||
|
|
||||||
|
if (switch_core_timer_init(&tech_pvt->timer_read_srv, "soft", MS_SKYPOPEN, SAMPLES_PER_FRAME, skypopen_module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
ERRORA("setup timer failed\n", SKYPOPEN_P_LOG);
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_core_timer_sync(&tech_pvt->timer_read_srv);
|
||||||
|
|
||||||
if (switch_core_timer_init(&tech_pvt->timer_write, "soft", MS_SKYPOPEN, SAMPLES_PER_FRAME, skypopen_module_pool) != SWITCH_STATUS_SUCCESS) {
|
if (switch_core_timer_init(&tech_pvt->timer_write, "soft", MS_SKYPOPEN, SAMPLES_PER_FRAME, skypopen_module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||||
ERRORA("setup timer failed\n", SKYPOPEN_P_LOG);
|
ERRORA("setup timer failed\n", SKYPOPEN_P_LOG);
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
|
|
|
@ -76,8 +76,8 @@
|
||||||
|
|
||||||
#define SAMPLERATE_SKYPOPEN 16000
|
#define SAMPLERATE_SKYPOPEN 16000
|
||||||
#define MS_SKYPOPEN 20
|
#define MS_SKYPOPEN 20
|
||||||
#define SAMPLES_PER_FRAME SAMPLERATE_SKYPOPEN/(1000/MS_SKYPOPEN)
|
#define SAMPLES_PER_FRAME (SAMPLERATE_SKYPOPEN/(1000/MS_SKYPOPEN))
|
||||||
#define BYTES_PER_FRAME SAMPLES_PER_FRAME * sizeof(short)
|
#define BYTES_PER_FRAME (SAMPLES_PER_FRAME * sizeof(short))
|
||||||
|
|
||||||
#ifdef SKYPOPEN_C_VER
|
#ifdef SKYPOPEN_C_VER
|
||||||
#ifdef MODSKYPOPEN_C_VER
|
#ifdef MODSKYPOPEN_C_VER
|
||||||
|
@ -341,6 +341,7 @@ struct private_object {
|
||||||
chat_t chats[MAX_CHATS];
|
chat_t chats[MAX_CHATS];
|
||||||
uint32_t report_incoming_chatmessages;
|
uint32_t report_incoming_chatmessages;
|
||||||
switch_timer_t timer_read;
|
switch_timer_t timer_read;
|
||||||
|
switch_timer_t timer_read_srv;
|
||||||
switch_timer_t timer_write;
|
switch_timer_t timer_write;
|
||||||
int begin_to_write;
|
int begin_to_write;
|
||||||
int begin_to_read;
|
int begin_to_read;
|
||||||
|
|
|
@ -547,6 +547,9 @@ int skypopen_signaling_read(private_t *tech_pvt)
|
||||||
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_sync(&tech_pvt->timer_read);
|
switch_core_timer_sync(&tech_pvt->timer_read);
|
||||||
}
|
}
|
||||||
|
if (tech_pvt->timer_read_srv.timer_interface && tech_pvt->timer_read_srv.timer_interface->timer_next) {
|
||||||
|
switch_core_timer_sync(&tech_pvt->timer_read_srv);
|
||||||
|
}
|
||||||
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -878,7 +881,7 @@ void *skypopen_do_tcp_srv_thread_func(void *obj)
|
||||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) {
|
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) {
|
||||||
|
|
||||||
unsigned int fdselect;
|
unsigned int fdselect;
|
||||||
int rt;
|
int rt=1;
|
||||||
fd_set fs;
|
fd_set fs;
|
||||||
struct timeval to;
|
struct timeval to;
|
||||||
int nospace;
|
int nospace;
|
||||||
|
@ -891,7 +894,10 @@ void *skypopen_do_tcp_srv_thread_func(void *obj)
|
||||||
to.tv_usec = MS_SKYPOPEN * 1000 * 3;
|
to.tv_usec = MS_SKYPOPEN * 1000 * 3;
|
||||||
to.tv_sec = 0;
|
to.tv_sec = 0;
|
||||||
|
|
||||||
rt = select(fdselect + 1, &fs, NULL, NULL, &to);
|
if (tech_pvt->timer_read_srv.timer_interface && tech_pvt->timer_read_srv.timer_interface->timer_next) {
|
||||||
|
switch_core_timer_next(&tech_pvt->timer_read_srv);
|
||||||
|
}
|
||||||
|
//rt = select(fdselect + 1, &fs, NULL, NULL, &to);
|
||||||
if (rt > 0) {
|
if (rt > 0) {
|
||||||
|
|
||||||
if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
|
if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
|
||||||
|
|
Loading…
Reference in New Issue