aboutsummaryrefslogtreecommitdiff
path: root/examples/example_4_callHandling
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2011-02-21 10:20:53 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2011-02-21 10:20:53 +0000
commit0b53469e4937bdfcb167ebc025ad89a050eb11e1 (patch)
tree2f759bdab8635a010df774973caab028fbf3dcaa /examples/example_4_callHandling
parent7e17d5642f9640cf2c7b9f907c30a1f99cb122f8 (diff)
downloadqxmpp-0b53469e4937bdfcb167ebc025ad89a050eb11e1.tar.gz
change the default buffer size in call handling example
Diffstat (limited to 'examples/example_4_callHandling')
-rw-r--r--examples/example_4_callHandling/xmppClient.cpp9
1 files changed, 5 insertions, 4 deletions
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);
}