Permalink
Browse files

[SoftAE] don't process silence when we don't have to.

  • Loading branch information...
1 parent a468ecb commit 95abdcfdc54093aab21939dff992c8f1d259d8fc Jonathan Marshall committed Jul 9, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp
@@ -853,11 +853,13 @@ void CSoftAE::Run()
CSingleLock runningLock(m_runningLock);
CLog::Log(LOGINFO, "CSoftAE::Run - Thread Started");
+ bool hasAudio = false;
while (m_running)
{
bool restart = false;
- (this->*m_outputStageFn)(true);
+ if ((this->*m_outputStageFn)(hasAudio) > 0)
+ hasAudio = false; /* taken some audio - reset our silence flag */
/* if we have enough room in the buffer */
if (m_buffer.Free() >= m_frameSize)
@@ -868,7 +870,8 @@ void CSoftAE::Run()
/* run the stream stage */
CSoftAEStream *oldMaster = m_masterStream;
- (this->*m_streamStageFn)(m_chLayout.Count(), out, restart);
+ if ((this->*m_streamStageFn)(m_chLayout.Count(), out, restart) > 0)
+ hasAudio = true; /* have some audio */
/* if in audiophile mode and the master stream has changed, flag for restart */
if (m_audiophile && oldMaster != m_masterStream)

0 comments on commit 95abdcf

Please sign in to comment.