X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=vbox.cpp;h=bc2c36915451f48172fd1af9adc36cac12a7513b;hp=6eb0ce20e0bf59ebbf9fdec060228f3357f231f8;hb=34598a346419f0e661526e6208dade4aff570008;hpb=b0bd74e35e935aa976b68c594def4e8d2c22ef95 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(¤t_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;