From 1e88fb519bec5e7b6ef8280b655871b7492c99b0 Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Sat, 28 Jun 2014 21:00:11 +0200 Subject: [PATCH] Fix audio calls on Windows --- core.cpp | 9 ++++++++- main.cpp | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core.cpp b/core.cpp index 1d5a2fa05..761686b27 100644 --- a/core.cpp +++ b/core.cpp @@ -1059,6 +1059,11 @@ void Core::prepareCall(int friendId, int callId, ToxAv* toxav) { calls[callId].audioOutput = new QAudioOutput(format); 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 @@ -1119,12 +1124,14 @@ void Core::playCallAudio(int callId, ToxAv* toxav) continue; } //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); int state = calls[callId].audioOutput->state(); if (state != QAudio::ActiveState) { 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(); if (error != QAudio::NoError) diff --git a/main.cpp b/main.cpp index 0af919c1d..41fbdcc09 100644 --- a/main.cpp +++ b/main.cpp @@ -19,6 +19,8 @@ int main(int argc, char *argv[]) /** TODO * ">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 * 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