]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
skypopen: refining oss driver, removing audio sync during call (was each 20 secs...
authorGiovanni Maruzzelli <gmaruzz@gmail.com>
Tue, 12 Jul 2011 10:50:46 +0000 (05:50 -0500)
committerGiovanni Maruzzelli <gmaruzz@gmail.com>
Tue, 12 Jul 2011 10:50:46 +0000 (05:50 -0500)
src/mod/endpoints/mod_skypopen/mod_skypopen.c
src/mod/endpoints/mod_skypopen/oss/main.c
src/mod/endpoints/mod_skypopen/skypopen_protocol.c

index e86c86dc11bc5e1a7ea9d2b4ac1774f232059d88..f19f3c943f60f11677c628615f5ebe0ac8f45790 100644 (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);
index 465480e055e43017be1131a4c601abd7a81bae92..72d82cb10c82648df55109b40328bea957dedba2 100644 (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;
index 4f5f129344818157e3bd409530f47b470599e939..1297278a9fc2dba7e96cd3c80a3c645e862a8da3 100644 (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);