1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix audio timers started from wrong thread

This timer never actually worked
This commit is contained in:
tux3 2015-12-19 17:07:19 +01:00
parent a0645d5cba
commit 2b8200aa30
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -65,11 +65,7 @@ Audio::Audio()
, inputVolume(1.0)
, alMainSource(0)
, alContext(nullptr)
, timer(new QTimer(this))
{
timer->setSingleShot(true);
connect(timer, &QTimer::timeout, this, &Audio::closeOutput);
audioThread->setObjectName("qTox Audio");
connect(audioThread, &QThread::finished, audioThread, &QThread::deleteLater);
}
@ -403,11 +399,6 @@ void Audio::playMono16Sound(const QByteArray& data)
ALint frequency;
alGetBufferi(buffer, AL_FREQUENCY, &frequency);
qreal duration = (lengthInSamples / static_cast<qreal>(frequency)) * 1000;
int remaining = timer->interval();
if (duration > remaining)
timer->start(duration);
alDeleteBuffers(1, &buffer);
}