diff options
author | Memphiz <memphis@machzwo.de> | 2014-03-14 19:33:23 +0100 |
---|---|---|
committer | Memphiz <memphis@machzwo.de> | 2014-03-14 23:46:45 +0100 |
commit | 943845f5a9005b737532178d562b39058d1da542 (patch) | |
tree | dd4acaffa09db4ffb192612aeb6d949598fa3736 | |
parent | 1df35f762b7da652cd4efc7f0ff7aaf76a31a36e (diff) |
[osxsink/iossink] - don't spam the log with audiobuffer underruns with 0 bytes available - those underruns happen alot when we idle but sink isn't suspended yet - instead only log those underruns once until there was some data played again
-rw-r--r-- | xbmc/cores/AudioEngine/Sinks/AESinkDARWINIOS.cpp | 19 | ||||
-rw-r--r-- | xbmc/cores/AudioEngine/Sinks/AESinkDARWINOSX.cpp | 18 |
2 files changed, 33 insertions, 4 deletions
diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkDARWINIOS.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkDARWINIOS.cpp index 130b8a9435..c7d3d036a9 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkDARWINIOS.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkDARWINIOS.cpp @@ -529,6 +529,21 @@ void CAAudioUnitSink::sessionInterruptionCallback(void *inClientData, UInt32 inI } } +inline void LogLevel(unsigned int got, unsigned int wanted) +{ + static unsigned int lastReported = INT_MAX; + if (got != wanted) + { + if (got != lastReported) + { + CLog::Log(LOGWARNING, "DARWINIOS: %sflow (%u vs %u bytes)", got > wanted ? "over" : "under", got, wanted); + lastReported = got; + } + } + else + lastReported = INT_MAX; // indicate we were good at least once +} + OSStatus CAAudioUnitSink::renderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inOutputBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) { @@ -542,8 +557,8 @@ OSStatus CAAudioUnitSink::renderCallback(void *inRefCon, AudioUnitRenderActionFl unsigned int wanted = ioData->mBuffers[i].mDataByteSize; unsigned int bytes = std::min(sink->m_buffer->GetReadSize(), wanted); sink->m_buffer->Read((unsigned char*)ioData->mBuffers[i].mData, bytes); - if (bytes != wanted) - CLog::Log(LOGERROR, "%s: %sFLOW (%i vs %i) bytes", __FUNCTION__, bytes > wanted ? "OVER" : "UNDER", bytes, wanted); + LogLevel(bytes, wanted); + if (bytes == 0) *ioActionFlags |= kAudioUnitRenderAction_OutputIsSilence; } diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkDARWINOSX.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkDARWINOSX.cpp index 60eb532bf6..fc366b5a27 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkDARWINOSX.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkDARWINOSX.cpp @@ -673,6 +673,21 @@ void CAESinkDARWINOSX::EnumerateDevicesEx(AEDeviceInfoList &list, bool force) list.push_back(i->second); } +inline void LogLevel(unsigned int got, unsigned int wanted) +{ + static unsigned int lastReported = INT_MAX; + if (got != wanted) + { + if (got != lastReported) + { + CLog::Log(LOGWARNING, "DARWINOSX: %sflow (%u vs %u bytes)", got > wanted ? "over" : "under", got, wanted); + lastReported = got; + } + } + else + lastReported = INT_MAX; // indicate we were good at least once +} + OSStatus CAESinkDARWINOSX::renderCallback(AudioDeviceID inDevice, const AudioTimeStamp* inNow, const AudioBufferList* inInputData, const AudioTimeStamp* inInputTime, AudioBufferList* outOutputData, const AudioTimeStamp* inOutputTime, void* inClientData) { CAESinkDARWINOSX *sink = (CAESinkDARWINOSX*)inClientData; @@ -702,8 +717,7 @@ OSStatus CAESinkDARWINOSX::renderCallback(AudioDeviceID inDevice, const AudioTim unsigned int wanted = outOutputData->mBuffers[i].mDataByteSize; unsigned int bytes = std::min(sink->m_buffer->GetReadSize(), wanted); sink->m_buffer->Read((unsigned char*)outOutputData->mBuffers[i].mData, bytes); - if (bytes != wanted) - CLog::Log(LOGERROR, "%s: %sFLOW (%i vs %i) bytes", __FUNCTION__, bytes > wanted ? "OVER" : "UNDER", bytes, wanted); + LogLevel(bytes, wanted); } // tell the sink we're good for more data |