Ticket #25831: patch-qaudiooutput-period-size.diff

File patch-qaudiooutput-period-size.diff, 1.8 KB (added by sharky@…, 14 years ago)
  • src/multimedia/audio/qaudiooutput_mac_p.cpp

    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() 
    358358    // Set stream format
    359359    streamFormat = toAudioStreamBasicDescription(audioFormat);
    360360
    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);
    372362    if (AudioUnitSetProperty(audioUnit,
    373363                                kAudioUnitProperty_StreamFormat,
    374364                                kAudioUnitScope_Input,
    bool QAudioOutputPrivate::open() 
    392382        return false;
    393383    }
    394384
    395     periodSizeBytes = (numberOfFrames * streamFormat.mSampleRate / deviceFormat.mSampleRate) *
    396                         streamFormat.mBytesPerFrame;
     385    periodSizeBytes = numberOfFrames * streamFormat.mBytesPerFrame;
    397386    if (internalBufferSize < periodSizeBytes * 2)
    398387        internalBufferSize = periodSizeBytes * 2;
    399388    else