Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #3148 from FernetMenta/aepause

ActiveAE: flush engine on pause stream if only a single stream is playin...
  • Loading branch information...
commit 5be768077e64091468562c0501cdf0f19971c0c4 2 parents e4c9e8c + e6e0545
Rainer Hochecker FernetMenta authored
47 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
View
@@ -423,6 +423,8 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg)
CActiveAEStream *stream;
stream = *(CActiveAEStream**)msg->data;
stream->m_paused = true;
+ if (m_streams.size() == 1)
+ FlushEngine();
return;
case CActiveAEControlProtocol::RESUMESTREAM:
stream = *(CActiveAEStream**)msg->data;
@@ -1110,31 +1112,36 @@ void CActiveAE::SFlushStream(CActiveAEStream *stream)
// flush the engine if we only have a single stream
if (m_streams.size() == 1)
{
- if (m_sinkBuffers)
- m_sinkBuffers->Flush();
- if (m_vizBuffers)
- m_vizBuffers->Flush();
+ FlushEngine();
+ }
+}
- // send message to sink
- Message *reply;
- if (m_sink.m_controlPort.SendOutMessageSync(CSinkControlProtocol::FLUSH,
- &reply, 2000))
- {
- bool success = reply->signal == CSinkControlProtocol::ACC ? true : false;
- if (!success)
- {
- CLog::Log(LOGERROR, "ActiveAE::%s - returned error on flush", __FUNCTION__);
- m_extError = true;
- }
- reply->Release();
- }
- else
+void CActiveAE::FlushEngine()
+{
+ if (m_sinkBuffers)
+ m_sinkBuffers->Flush();
+ if (m_vizBuffers)
+ m_vizBuffers->Flush();
+
+ // send message to sink
+ Message *reply;
+ if (m_sink.m_controlPort.SendOutMessageSync(CSinkControlProtocol::FLUSH,
+ &reply, 2000))
+ {
+ bool success = reply->signal == CSinkControlProtocol::ACC ? true : false;
+ if (!success)
{
- CLog::Log(LOGERROR, "ActiveAE::%s - failed to flush", __FUNCTION__);
+ CLog::Log(LOGERROR, "ActiveAE::%s - returned error on flush", __FUNCTION__);
m_extError = true;
}
- m_stats.Reset(m_sinkFormat.m_sampleRate);
+ reply->Release();
+ }
+ else
+ {
+ CLog::Log(LOGERROR, "ActiveAE::%s - failed to flush", __FUNCTION__);
+ m_extError = true;
}
+ m_stats.Reset(m_sinkFormat.m_sampleRate);
}
void CActiveAE::ClearDiscardedBuffers()
1  xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h
View
@@ -256,6 +256,7 @@ class CActiveAE : public IAE, private CThread
CActiveAEStream* CreateStream(MsgStreamNew *streamMsg);
void DiscardStream(CActiveAEStream *stream);
void SFlushStream(CActiveAEStream *stream);
+ void FlushEngine();
void ClearDiscardedBuffers();
void SStopSound(CActiveAESound *sound);
void DiscardSound(CActiveAESound *sound);
Please sign in to comment.
Something went wrong with that request. Please try again.