From 76c256bdabcc207a6ed70d5b5b62698495548a25 Mon Sep 17 00:00:00 2001
From: Justin McPherson <justin.mcpherson@nokia.com>
Date: Tue, 22 Jun 2010 12:01:51 +1000
Subject: [PATCH] Audio(osx); Fix period size calculation.
Task-number: QTBUG-8878
Reviewed-by:Dmytro Poplavskiy
---
src/multimedia/audio/qaudiooutput_mac_p.cpp | 15 ++-------------
1 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/src/multimedia/audio/qaudiooutput_mac_p.cpp b/src/multimedia/audio/qaudiooutput_mac_p.cpp
index 9689101..cc52d90 100644
|
|
bool QAudioOutputPrivate::open() |
358 | 358 | // Set stream format |
359 | 359 | streamFormat = toAudioStreamBasicDescription(audioFormat); |
360 | 360 | |
361 | | UInt32 size = sizeof(deviceFormat); |
362 | | if (AudioUnitGetProperty(audioUnit, |
363 | | kAudioUnitProperty_StreamFormat, |
364 | | kAudioUnitScope_Input, |
365 | | 0, |
366 | | &deviceFormat, |
367 | | &size) != noErr) { |
368 | | qWarning() << "QAudioOutput: Unable to retrieve device format"; |
369 | | return false; |
370 | | } |
371 | | |
| 361 | UInt32 size = sizeof(streamFormat); |
372 | 362 | if (AudioUnitSetProperty(audioUnit, |
373 | 363 | kAudioUnitProperty_StreamFormat, |
374 | 364 | kAudioUnitScope_Input, |
… |
… |
bool QAudioOutputPrivate::open() |
392 | 382 | return false; |
393 | 383 | } |
394 | 384 | |
395 | | periodSizeBytes = (numberOfFrames * streamFormat.mSampleRate / deviceFormat.mSampleRate) * |
396 | | streamFormat.mBytesPerFrame; |
| 385 | periodSizeBytes = numberOfFrames * streamFormat.mBytesPerFrame; |
397 | 386 | if (internalBufferSize < periodSizeBytes * 2) |
398 | 387 | internalBufferSize = periodSizeBytes * 2; |
399 | 388 | else |