From dc3deb2df177836e127eb1be9c781476c2bffbd2 Mon Sep 17 00:00:00 2001 From: "Chris \"Koying\" Browet" Date: Sun, 20 Mar 2016 10:00:00 +0100 Subject: [PATCH] FIX: [AT] low samplerate audio --- xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp index 7af5611a0f..b4dc81426d 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp @@ -209,9 +209,9 @@ bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device) m_passthrough = true; // Get equal or lower supported sample rate - std::set::iterator s = m_sink_sampleRates.upper_bound(m_format.m_encodedRate); - if (--s != m_sink_sampleRates.begin()) - m_sink_sampleRate = *s; + std::set::iterator s = m_sink_sampleRates.upper_bound((AE_IS_RAW_RAW(m_format.m_dataFormat) ? m_format.m_encodedRate : m_format.m_sampleRate)); + if (s != m_sink_sampleRates.end() && s != m_sink_sampleRates.begin()) + m_sink_sampleRate = *(--s); else m_sink_sampleRate = CJNIAudioTrack::getNativeOutputSampleRate(CJNIAudioManager::STREAM_MUSIC); @@ -337,8 +337,8 @@ bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device) // Get equal or lower supported sample rate std::set::iterator s = m_sink_sampleRates.upper_bound(m_format.m_sampleRate); - if (--s != m_sink_sampleRates.begin()) - m_sink_sampleRate = *s; + if (s != m_sink_sampleRates.end() && s != m_sink_sampleRates.begin()) + m_sink_sampleRate = *(--s); else m_sink_sampleRate = CJNIAudioTrack::getNativeOutputSampleRate(CJNIAudioManager::STREAM_MUSIC);