AE: fix segfault when stopping of stream and switching between tracks

This commit is contained in:
fritsch 2013-02-23 23:58:49 +01:00
parent e243a066b1
commit 79bfcdbee8

View File

@ -0,0 +1,48 @@
From dc648b78c4c571cc0a5d3df3e7b64c21c7d0901e Mon Sep 17 00:00:00 2001
From: fritsch <peter.fruehberger@gmail.com>
Date: Sat, 23 Feb 2013 10:44:33 +0100
Subject: [PATCH] AE: fix segfault after indirection patches
---
xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp
index cfb7be5..6ec78c5 100644
--- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp
+++ b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp
@@ -728,7 +728,6 @@ void CSoftAE::PauseStream(CSoftAEStream *stream)
CSingleLock streamLock(m_streamLock);
RemoveStream(m_playingStreams, stream);
stream->m_paused = true;
- streamLock.Leave();
m_reOpen = true;
m_wake.Set();
@@ -874,7 +873,10 @@ IAEStream *CSoftAE::FreeStream(IAEStream *stream)
RemoveStream(m_streams , (CSoftAEStream*)stream);
// Reopen is old behaviour. Not opening when masterstream stops means clipping on S/PDIF.
if(!m_isSuspended && (m_masterStream == stream))
+ {
m_reOpen = true;
+ m_masterStream = NULL;
+ }
delete (CSoftAEStream*)stream;
return NULL;
@@ -1058,11 +1060,11 @@ void CSoftAE::Run()
bool restart = false;
/* with the new non blocking implementation - we just reOpen here, when it tells reOpen */
- if (!m_reOpen && (this->*m_outputStageFn)(hasAudio) > 0)
+ 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_reOpen && m_buffer.Free() >= m_frameSize)
+ if (m_buffer.Free() >= m_frameSize)
{
/* take some data for our use from the buffer */
uint8_t *out = (uint8_t*)m_buffer.Take(m_frameSize);
--
1.7.10