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:
parent
cd31812dac
commit
69189034e3
|
@ -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++)
|
||||
|
|
|
@ -295,7 +295,7 @@ private:
|
|||
static const int videobufsize;
|
||||
static uint8_t* videobuf;
|
||||
|
||||
static QThread *coreThread;
|
||||
static QThread *coreThread, *audioThread;
|
||||
};
|
||||
|
||||
#endif // CORE_HPP
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user