summaryrefslogtreecommitdiffstats
path: root/vbox.cpp
diff options
context:
space:
mode:
authorAndreas Eversberg2010-09-20 08:22:13 +0200
committerAndreas Eversberg2010-09-20 08:22:13 +0200
commit1e711b3a83867445c2ad7e7f84e4e3c024ad9572 (patch)
tree3849a79d06df9ae12ff1fafccb0d6c770e08b3c8 /vbox.cpp
parentFixed numbering plan in GSM MS support (diff)
downloadlcr-1e711b3a83867445c2ad7e7f84e4e3c024ad9572.tar.gz
lcr-1e711b3a83867445c2ad7e7f84e4e3c024ad9572.tar.xz
lcr-1e711b3a83867445c2ad7e7f84e4e3c024ad9572.zip
Fix of vbox announcing bug
Hi, here's a simple patch that makes the announcement work again when using the vbox in lcr. Bodo
Diffstat (limited to 'vbox.cpp')
-rw-r--r--vbox.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/vbox.cpp b/vbox.cpp
index 6eb0ce2..bc2c369 100644
--- a/vbox.cpp
+++ b/vbox.cpp
@@ -107,14 +107,14 @@ void VBoxPort::send_announcement(void)
class Endpoint *epoint;
int temp;
struct timeval current_time;
- long long now;
+ long long now; /* Time in samples */
/* don't restart timer, if announcement is played */
if (p_vbox_announce_fh < 0)
return;
gettimeofday(&current_time, NULL);
- now = current_time.tv_sec * MICRO_SECONDS + current_time.tv_usec;
+ now = (current_time.tv_sec * MICRO_SECONDS + current_time.tv_usec)/125;
/* set time the first time */
if (!p_vbox_audio_start)
@@ -122,6 +122,8 @@ void VBoxPort::send_announcement(void)
/* calculate the number of bytes */
tosend = (unsigned int)(now - p_vbox_audio_start) - p_vbox_audio_transferred;
+ if (tosend > sizeof(buffer))
+ tosend = sizeof(buffer);
/* schedule next event */
temp = ISDN_TRANSMIT + ISDN_TRANSMIT - tosend;
@@ -129,9 +131,6 @@ void VBoxPort::send_announcement(void)
temp = 0;
schedule_timer(&p_vbox_announce_timer, 0, temp*125);
- if (tosend > sizeof(buffer))
- tosend = sizeof(buffer);
-
/* add the number of samples elapsed */
p_vbox_audio_transferred += tosend;