aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp15
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h1
2 files changed, 12 insertions, 4 deletions
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp
index c43cc5c780..b4221663c7 100644
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp
+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp
@@ -53,6 +53,7 @@ CActiveAEStream::CActiveAEStream(AEAudioFormat *format)
m_streamFading = false;
m_streamFreeBuffers = 0;
m_streamIsBuffering = false;
+ m_streamIsFlushed = false;
m_streamSlave = NULL;
m_leftoverBuffer = new uint8_t[m_format.m_frameSize];
m_leftoverBytes = 0;
@@ -200,6 +201,8 @@ unsigned int CActiveAEStream::AddData(uint8_t* const *data, unsigned int offset,
int sourceFrames = frames;
uint8_t* const *buf = data;
+ m_streamIsFlushed = false;
+
while(copied < frames)
{
sourceFrames = frames - copied;
@@ -385,10 +388,14 @@ bool CActiveAEStream::IsDrained()
void CActiveAEStream::Flush()
{
- m_currentBuffer = NULL;
- m_leftoverBytes = 0;
- AE.FlushStream(this);
- ResetFreeBuffers();
+ if (!m_streamIsFlushed)
+ {
+ m_currentBuffer = NULL;
+ m_leftoverBytes = 0;
+ AE.FlushStream(this);
+ ResetFreeBuffers();
+ m_streamIsFlushed = true;
+ }
}
float CActiveAEStream::GetAmplification()
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h
index 09fda0fadc..011ad02c02 100644
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h
+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h
@@ -92,6 +92,7 @@ protected:
bool m_streamFading;
int m_streamFreeBuffers;
bool m_streamIsBuffering;
+ bool m_streamIsFlushed;
IAEStream *m_streamSlave;
CCriticalSection m_streamLock;
uint8_t *m_leftoverBuffer;