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

Put group chats audio playing in its own thread

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-11-18 01:25:15 +01:00
parent cd31812dac
commit 69189034e3
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
3 changed files with 7 additions and 1 deletions

View File

@ -56,6 +56,9 @@ Core::Core(Camera* cam, QThread *CoreThread, QString loadPath) :
coreThread = CoreThread;
audioThread = new QThread();
audioThread->start();
videobuf = new uint8_t[videobufsize];
for (int i = 0; i < ptCounter; i++)

View File

@ -295,7 +295,7 @@ private:
static const int videobufsize;
static uint8_t* videobuf;
static QThread *coreThread;
static QThread *coreThread, *audioThread;
};
#endif // CORE_HPP

View File

@ -23,6 +23,7 @@
ToxCall Core::calls[TOXAV_MAX_CALLS];
const int Core::videobufsize{TOXAV_MAX_VIDEO_WIDTH * TOXAV_MAX_VIDEO_HEIGHT * 4};
uint8_t* Core::videobuf;
QThread* Core::audioThread{nullptr};
bool Core::anyActiveCalls()
{
@ -630,6 +631,7 @@ void Core::joinGroupCall(int groupId)
groupCalls[groupId].sendAudioTimer->setSingleShot(true);
connect(groupCalls[groupId].sendAudioTimer, &QTimer::timeout, [=](){sendGroupCallAudio(groupId,toxav);});
groupCalls[groupId].sendAudioTimer->start();
groupCalls[groupId].sendAudioTimer->moveToThread(audioThread);
}
void Core::leaveGroupCall(int groupId)
@ -640,6 +642,7 @@ void Core::leaveGroupCall(int groupId)
groupCalls[groupId].sendAudioTimer->stop();
groupCalls[groupId].alSources.clear();
Audio::unsuscribeInput();
delete groupCalls[groupId].sendAudioTimer;
}
void Core::sendGroupCallAudio(int groupId, ToxAv* toxav)