mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 01:04:06 +02:00
Removed gettimeofday in AudioInjector
This commit is contained in:
parent
f61d72fcf0
commit
d34e6ff864
1 changed files with 3 additions and 3 deletions
|
@ -71,8 +71,8 @@ void AudioInjector::injectAudio() {
|
|||
quint8 volume = MAX_INJECTOR_VOLUME * _options.getVolume();
|
||||
packetStream << volume;
|
||||
|
||||
timeval startTime = {};
|
||||
gettimeofday(&startTime, NULL);
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
int nextFrame = 0;
|
||||
|
||||
int currentSendPosition = 0;
|
||||
|
@ -104,7 +104,7 @@ void AudioInjector::injectAudio() {
|
|||
if (currentSendPosition != bytesToCopy && currentSendPosition < soundByteArray.size()) {
|
||||
// not the first packet and not done
|
||||
// sleep for the appropriate time
|
||||
int usecToSleep = usecTimestamp(&startTime) + (++nextFrame * BUFFER_SEND_INTERVAL_USECS) - usecTimestampNow();
|
||||
int usecToSleep = (++nextFrame * BUFFER_SEND_INTERVAL_USECS) - timer.nsecsElapsed() / 1000;
|
||||
|
||||
if (usecToSleep > 0) {
|
||||
usleep(usecToSleep);
|
||||
|
|
Loading…
Reference in a new issue