mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-21 00:18:43 +00:00
Fixed: #795 Hang when stopping file stream source that is synchronously waiting for play
--HG-- branch : sound_dev
This commit is contained in:
parent
41968b0674
commit
1b49b59e02
2 changed files with 12 additions and 4 deletions
|
@ -62,10 +62,10 @@ void CStreamFileSource::play()
|
|||
{
|
||||
// note: CStreamSource will assert crash if already physically playing!
|
||||
|
||||
nldebug("play");
|
||||
|
||||
if (m_Thread->isRunning() && m_WaitingForPlay)
|
||||
{
|
||||
nldebug("play waiting %s", getStreamFileSound()->getFilePath().c_str());
|
||||
if (m_NextBuffer || !m_FreeBuffers)
|
||||
{
|
||||
CStreamSource::play();
|
||||
|
@ -79,6 +79,7 @@ void CStreamFileSource::play()
|
|||
}
|
||||
else if (!_Playing)
|
||||
{
|
||||
nldebug("play waiting %s", getStreamFileSound()->getFilePath().c_str());
|
||||
if (!m_WaitingForPlay)
|
||||
{
|
||||
// thread may be stopping from stop call
|
||||
|
@ -86,7 +87,7 @@ void CStreamFileSource::play()
|
|||
}
|
||||
else
|
||||
{
|
||||
nlwarning("Already playing");
|
||||
nlwarning("Already waiting for play");
|
||||
}
|
||||
if (!getStreamFileSound()->getAsync())
|
||||
prepareDecoder();
|
||||
|
@ -97,7 +98,7 @@ void CStreamFileSource::play()
|
|||
if (!getStreamFileSound()->getAsync())
|
||||
{
|
||||
// wait until at least one buffer is ready
|
||||
while (!(m_NextBuffer || !m_FreeBuffers))
|
||||
while (!(m_NextBuffer || !m_FreeBuffers) && m_WaitingForPlay)
|
||||
NLMISC::nlSleep(10);
|
||||
CStreamSource::play();
|
||||
if (!_Playing)
|
||||
|
@ -111,6 +112,11 @@ void CStreamFileSource::play()
|
|||
mixer->addSourceWaitingForPlay(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning("Already playing");
|
||||
}
|
||||
|
||||
|
||||
/*if (!m_WaitingForPlay)
|
||||
{
|
||||
|
@ -127,7 +133,7 @@ void CStreamFileSource::play()
|
|||
|
||||
void CStreamFileSource::stop()
|
||||
{
|
||||
nldebug("stop");
|
||||
nldebug("stop %s", getStreamFileSound()->getFilePath().c_str());
|
||||
|
||||
CStreamSource::stop();
|
||||
|
||||
|
|
|
@ -264,6 +264,8 @@ void CStreamSource::stop()
|
|||
_SpawnEndCb(this, _CbUserParam);
|
||||
delete this;
|
||||
}
|
||||
|
||||
m_WaitingForPlay = false;
|
||||
}
|
||||
|
||||
void CStreamSource::setPos(const NLMISC::CVector& pos)
|
||||
|
|
Loading…
Reference in a new issue