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

Fix audio calls on Windows

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-06-28 21:00:11 +02:00
parent 06d3f7fe34
commit 1e88fb519b
2 changed files with 10 additions and 1 deletions

View File

@ -1059,6 +1059,11 @@ void Core::prepareCall(int friendId, int callId, ToxAv* toxav)
{ {
calls[callId].audioOutput = new QAudioOutput(format); calls[callId].audioOutput = new QAudioOutput(format);
calls[callId].audioOutput->start(&calls[callId].audioBuffer); calls[callId].audioOutput->start(&calls[callId].audioBuffer);
int error = calls[callId].audioOutput->error();
if (error != QAudio::NoError)
{
qWarning() << QString("Core: Error %1 when starting audio output").arg(error);
}
} }
// Start input // Start input
@ -1119,12 +1124,14 @@ void Core::playCallAudio(int callId, ToxAv* toxav)
continue; continue;
} }
//qDebug() << QString("Core: Received %1 bytes, %2 audio bytes free, %3 core buffer size") //qDebug() << QString("Core: Received %1 bytes, %2 audio bytes free, %3 core buffer size")
//.arg(len*2).arg(calls[callId].audioOutput->bytesFree()).arg(calls[callId].audioBuffer.bufferSize()); // .arg(len*2).arg(calls[callId].audioOutput->bytesFree()).arg(calls[callId].audioBuffer.bufferSize());
calls[callId].audioBuffer.writeData((char*)buf, len*2); calls[callId].audioBuffer.writeData((char*)buf, len*2);
int state = calls[callId].audioOutput->state(); int state = calls[callId].audioOutput->state();
if (state != QAudio::ActiveState) if (state != QAudio::ActiveState)
{ {
qDebug() << QString("Core: Audio state is %1").arg(state); qDebug() << QString("Core: Audio state is %1").arg(state);
if (state == 3)
calls[callId].audioOutput->start(&calls[callId].audioBuffer);
} }
int error = calls[callId].audioOutput->error(); int error = calls[callId].audioOutput->error();
if (error != QAudio::NoError) if (error != QAudio::NoError)

View File

@ -19,6 +19,8 @@ int main(int argc, char *argv[])
/** TODO /** TODO
* ">using a dedicated tool to maintain a TODO list" edition * ">using a dedicated tool to maintain a TODO list" edition
* *
* Sending large files (~380MB) "restarts" after ~10MB. Goes back to 0%, consumes twice as much ram (reloads the file?)
* => Don't load the whole file at once, load small chunks (25MB?) when needed, then free them and load the next
* Notifications/ringing when a call is received * Notifications/ringing when a call is received
* Sort the friend list by status, online first then busy then offline * Sort the friend list by status, online first then busy then offline
* Don't do anything if a friend is disconnected, don't print to the chat * Don't do anything if a friend is disconnected, don't print to the chat