From e3a8f010c32bc00d1371484c5387157436287eae Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 13 Sep 2018 12:00:51 -0700 Subject: [PATCH] Fixes for experimental Qt audio renderer --- app/streaming/audio/renderers/qtaud.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/streaming/audio/renderers/qtaud.cpp b/app/streaming/audio/renderers/qtaud.cpp index e83133f0..b7de26fe 100644 --- a/app/streaming/audio/renderers/qtaud.cpp +++ b/app/streaming/audio/renderers/qtaud.cpp @@ -29,9 +29,8 @@ bool QtAudioRenderer::prepareForPlayback(const OPUS_MULTISTREAM_CONFIGURATION* o m_AudioOutput = new QAudioOutput(format); - m_AudioOutput->setBufferSize(SAMPLES_PER_FRAME * 2); - - qInfo() << "Audio stream buffer:" << m_AudioOutput->bufferSize() << "bytes"; + // Buffer 20 ms of audio data + m_AudioOutput->setBufferSize(format.bytesForDuration(20000)); m_OutputDevice = m_AudioOutput->start(); if (m_OutputDevice == nullptr) { @@ -39,6 +38,9 @@ bool QtAudioRenderer::prepareForPlayback(const OPUS_MULTISTREAM_CONFIGURATION* o return false; } + // Check what buffer size was really used after starting + qInfo() << "Audio stream buffer:" << m_AudioOutput->bufferSize() << "bytes"; + return true; }