diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-12-10 08:09:42 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-12-10 08:09:42 +0000 |
| commit | 64a0e58b40e7ee8422d56279882caeeb14152b2b (patch) | |
| tree | ea87237d89799e990f46838853da2717c9c8f33f /examples/example_4_callHandling/xmppClient.cpp | |
| parent | 097d082c5d1a33086f8bf395dc919afbff0cbedc (diff) | |
| download | qxmpp-64a0e58b40e7ee8422d56279882caeeb14152b2b.tar.gz | |
select a better buffer size for QAudioInput / QAudioOutput
Diffstat (limited to 'examples/example_4_callHandling/xmppClient.cpp')
| -rw-r--r-- | examples/example_4_callHandling/xmppClient.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/example_4_callHandling/xmppClient.cpp b/examples/example_4_callHandling/xmppClient.cpp index db3ee820..5a09852d 100644 --- a/examples/example_4_callHandling/xmppClient.cpp +++ b/examples/example_4_callHandling/xmppClient.cpp @@ -84,13 +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; + // initialise audio output QAudioOutput *audioOutput = new QAudioOutput(format, this); + audioOutput->setBufferSize(2 * packetSize); audioOutput->start(channel); // initialise audio input QAudioInput *audioInput = new QAudioInput(format, this); - audioInput->start(channel); + audioInput->setBufferSize(2 * packetSize); + audioInput->start(channel); } /// A call finished. |
