skypopen: refining oss driver, removing audio sync during call (was each 20 secs), audio sync at the tcp interfacing with the skype client (reading more than 20ms worth)

This commit is contained in:
Giovanni Maruzzelli 2011-07-12 05:50:46 -05:00
parent 4f90f8d0d1
commit 891015e67c
3 changed files with 7 additions and 9 deletions

View File

@ -1012,7 +1012,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
}
#endif
if (!tech_pvt->write_buffer) {
int32_t max_len = BYTES_PER_FRAME * 3;
int32_t max_len = BYTES_PER_FRAME * 4;
switch_buffer_create(skypopen_module_pool, &tech_pvt->write_buffer, max_len);
switch_assert(tech_pvt->write_buffer);

View File

@ -86,13 +86,11 @@ void my_timer_callback_outq( unsigned long data )
static enum hrtimer_restart my_hrtimer_callback_inq( struct hrtimer *timer_inq )
{
struct skypopen_dev *dev = container_of(timer_inq, struct skypopen_dev, timer_inq);
ktime_t now;
if(unload)
return HRTIMER_NORESTART;
now = ktime_get();
hrtimer_forward(&dev->timer_inq, now, ktime_set(0, SKYPOPEN_SLEEP * 1000000));
hrtimer_forward(&dev->timer_inq, timer_inq->_softexpires, ktime_set(0, SKYPOPEN_SLEEP * 1000000));
wake_up_interruptible(&dev->inq);
return HRTIMER_RESTART;
@ -100,13 +98,11 @@ static enum hrtimer_restart my_hrtimer_callback_inq( struct hrtimer *timer_inq )
static enum hrtimer_restart my_hrtimer_callback_outq( struct hrtimer *timer_outq )
{
struct skypopen_dev *dev = container_of(timer_outq, struct skypopen_dev, timer_outq);
ktime_t now;
if(unload)
return HRTIMER_NORESTART;
now = ktime_get();
hrtimer_forward(&dev->timer_outq, now, ktime_set(0, SKYPOPEN_SLEEP * 1000000));
hrtimer_forward(&dev->timer_outq, timer_outq->_softexpires, ktime_set(0, SKYPOPEN_SLEEP * 1000000));
wake_up_interruptible(&dev->outq);
return HRTIMER_RESTART;

View File

@ -539,6 +539,7 @@ int skypopen_signaling_read(private_t *tech_pvt)
if (!strcasecmp(prop, "FAILUREREASON")) {
DEBUGA_SKYPE("Skype FAILED on skype_call %s. Let's wait for the FAILED message.\n", SKYPOPEN_P_LOG, id);
}
#if 0
if (!strcasecmp(prop, "DURATION")) { /* each 20 seconds, we zero the buffers and sync the timers */
if (!((atoi(value) % 20))) {
if (tech_pvt->read_buffer) {
@ -564,6 +565,7 @@ int skypopen_signaling_read(private_t *tech_pvt)
DEBUGA_SKYPE("Synching audio on skype_call: %s.\n", SKYPOPEN_P_LOG, id);
}
}
#endif //0
if (!strcasecmp(prop, "DURATION") && (!strcasecmp(value, "1"))) {
if (strcasecmp(id, tech_pvt->skype_call_id)) {
skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
@ -901,7 +903,7 @@ void *skypopen_do_tcp_srv_thread_func(void *obj)
if (rt > 0) {
if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
len = recv(fd, (char *) srv_in, BYTES_PER_FRAME, 0);
len = recv(fd, (char *) srv_in, BYTES_PER_FRAME * 2, 0);
} else {
skypopen_sleep(10000);
continue;
@ -1073,7 +1075,7 @@ void *skypopen_do_tcp_cli_thread_func(void *obj)
}
switch_mutex_lock(tech_pvt->mutex_audio_cli);
if (tech_pvt->write_buffer && switch_buffer_inuse(tech_pvt->write_buffer)) {
bytes_to_write = switch_buffer_read(tech_pvt->write_buffer, cli_out, BYTES_PER_FRAME);
bytes_to_write = switch_buffer_read(tech_pvt->write_buffer, cli_out, BYTES_PER_FRAME * 2);
}
switch_mutex_unlock(tech_pvt->mutex_audio_cli);