From 0b53469e4937bdfcb167ebc025ad89a050eb11e1 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Mon, 21 Feb 2011 10:20:53 +0000 Subject: change the default buffer size in call handling example --- examples/example_4_callHandling/xmppClient.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'examples/example_4_callHandling/xmppClient.cpp') diff --git a/examples/example_4_callHandling/xmppClient.cpp b/examples/example_4_callHandling/xmppClient.cpp index 06def029..4ee9cc74 100644 --- a/examples/example_4_callHandling/xmppClient.cpp +++ b/examples/example_4_callHandling/xmppClient.cpp @@ -84,17 +84,18 @@ void xmppClient::slotConnected() format.setByteOrder(QAudioFormat::LittleEndian); format.setSampleType(QAudioFormat::SignedInt); - // the size in bytes of the audio samples for a single RTP packet - const int packetSize = (format.frequency() * format.channels() * (format.sampleSize() / 8)) * channel->payloadType().ptime() / 1000; + // the size in bytes of the audio buffers to/from sound devices + // 160 ms seems to be the minimum to work consistently on Linux/Mac/Windows + const int bufferSize = (format.frequency() * format.channels() * (format.sampleSize() / 8) * 160) / 1000; // initialise audio output QAudioOutput *audioOutput = new QAudioOutput(format, this); - audioOutput->setBufferSize(2 * packetSize); + audioOutput->setBufferSize(bufferSize); audioOutput->start(channel); // initialise audio input QAudioInput *audioInput = new QAudioInput(format, this); - audioInput->setBufferSize(2 * packetSize); + audioInput->setBufferSize(bufferSize); audioInput->start(channel); } -- cgit v1.2.3