aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavilla <davilla@svn>2009-11-21 03:57:56 +0000
committerdavilla <davilla@svn>2009-11-21 03:57:56 +0000
commit29645d4e40032d7fe48c8067174af304738034e0 (patch)
tree3cd0873d03437bd278134c6746dc0e5e4b9a83f0
parenta4ade5a02afa38ee4fca8fec244db919572408bb (diff)
[osx] disable CCoreAudioPerformance tacking under release builds
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@24807 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r--xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp13
-rw-r--r--xbmc/cores/AudioRenderers/CoreAudioRenderer.h3
2 files changed, 14 insertions, 2 deletions
diff --git a/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp b/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp
index a2d6599d1d..c13a3cd405 100644
--- a/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp
+++ b/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp
@@ -438,8 +438,10 @@ bool CCoreAudioRenderer::Initialize(IAudioCallback* pCallback, const CStdString&
m_MaxCacheLen = m_AvgBytesPerSec; // Set the max cache size to 1 second of data. TODO: Make this more intelligent
m_Pause = true; // Suspend rendering. We will start once we have some data.
m_pCache = new CSliceQueue(m_ChunkLen); // Initialize our incoming data cache
+#ifdef _DEBUG
m_PerfMon.Init(m_AvgBytesPerSec, 1000, CCoreAudioPerformance::FlagDefault); // Set up the performance monitor
m_PerfMon.SetPreroll(2.0f); // Disable underrun detection for the first 2 seconds (after start and after resume)
+#endif
m_Initialized = true;
MPCreateEvent(&m_RunoutEvent); // Create a waitable event for use by clients when draining the cache
m_DoRunout = 0;
@@ -500,7 +502,9 @@ bool CCoreAudioRenderer::Pause()
m_AudioUnit.Stop();
m_Pause = true;
}
+#ifdef _DEBUG
m_PerfMon.EnableWatchdog(false); // Stop monitoring, we're paused
+#endif
return true;
}
@@ -517,7 +521,9 @@ bool CCoreAudioRenderer::Resume()
m_AudioUnit.Start();
m_Pause = false;
}
+#ifdef _DEBUG
m_PerfMon.EnableWatchdog(true); // Resume monitoring
+#endif
return true;
}
@@ -531,7 +537,9 @@ bool CCoreAudioRenderer::Stop()
m_AudioUnit.Stop();
m_Pause = true;
+#ifdef _DEBUG
m_PerfMon.EnableWatchdog(false);
+#endif
m_pCache->Clear();
return true;
@@ -593,8 +601,10 @@ unsigned int CCoreAudioRenderer::AddPackets(const void* data, DWORD len)
size_t bytesUsed = m_pCache->AddData((void*)data, len);
+#ifdef _DEBUG
// Update tracking variable
m_PerfMon.ReportData(bytesUsed, 0);
+#endif
Resume(); // We have some data. Attmept to resume playback
return bytesUsed; // Number of bytes added to cache;
@@ -685,9 +695,10 @@ OSStatus CCoreAudioRenderer::OnRender(AudioUnitRenderActionFlags *ioActionFlags,
else
ioData->mBuffers[m_OutputBufferIndex].mDataByteSize = bytesRead;
+#ifdef _DEBUG
// Calculate stats and perform a sanity check
m_PerfMon.ReportData(0, bytesRead); // TODO: Should we check the result?
-
+#endif
return noErr;
}
diff --git a/xbmc/cores/AudioRenderers/CoreAudioRenderer.h b/xbmc/cores/AudioRenderers/CoreAudioRenderer.h
index a9f6257d91..81d64816c8 100644
--- a/xbmc/cores/AudioRenderers/CoreAudioRenderer.h
+++ b/xbmc/cores/AudioRenderers/CoreAudioRenderer.h
@@ -155,9 +155,10 @@ class CCoreAudioRenderer : public IAudioRenderer
size_t m_BytesPerFrame; // Input frame size
UInt32 m_NumLatencyFrames;
+#ifdef _DEBUG
// Performace Monitoring
CCoreAudioPerformance m_PerfMon;
-
+#endif
// Thread synchronization
MPEventID m_RunoutEvent;
long m_DoRunout;