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!
|
// note: CStreamSource will assert crash if already physically playing!
|
||||||
|
|
||||||
nldebug("play");
|
|
||||||
|
|
||||||
if (m_Thread->isRunning() && m_WaitingForPlay)
|
if (m_Thread->isRunning() && m_WaitingForPlay)
|
||||||
{
|
{
|
||||||
|
nldebug("play waiting %s", getStreamFileSound()->getFilePath().c_str());
|
||||||
if (m_NextBuffer || !m_FreeBuffers)
|
if (m_NextBuffer || !m_FreeBuffers)
|
||||||
{
|
{
|
||||||
CStreamSource::play();
|
CStreamSource::play();
|
||||||
|
@ -79,6 +79,7 @@ void CStreamFileSource::play()
|
||||||
}
|
}
|
||||||
else if (!_Playing)
|
else if (!_Playing)
|
||||||
{
|
{
|
||||||
|
nldebug("play waiting %s", getStreamFileSound()->getFilePath().c_str());
|
||||||
if (!m_WaitingForPlay)
|
if (!m_WaitingForPlay)
|
||||||
{
|
{
|
||||||
// thread may be stopping from stop call
|
// thread may be stopping from stop call
|
||||||
|
@ -86,7 +87,7 @@ void CStreamFileSource::play()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nlwarning("Already playing");
|
nlwarning("Already waiting for play");
|
||||||
}
|
}
|
||||||
if (!getStreamFileSound()->getAsync())
|
if (!getStreamFileSound()->getAsync())
|
||||||
prepareDecoder();
|
prepareDecoder();
|
||||||
|
@ -97,7 +98,7 @@ void CStreamFileSource::play()
|
||||||
if (!getStreamFileSound()->getAsync())
|
if (!getStreamFileSound()->getAsync())
|
||||||
{
|
{
|
||||||
// wait until at least one buffer is ready
|
// wait until at least one buffer is ready
|
||||||
while (!(m_NextBuffer || !m_FreeBuffers))
|
while (!(m_NextBuffer || !m_FreeBuffers) && m_WaitingForPlay)
|
||||||
NLMISC::nlSleep(10);
|
NLMISC::nlSleep(10);
|
||||||
CStreamSource::play();
|
CStreamSource::play();
|
||||||
if (!_Playing)
|
if (!_Playing)
|
||||||
|
@ -111,6 +112,11 @@ void CStreamFileSource::play()
|
||||||
mixer->addSourceWaitingForPlay(this);
|
mixer->addSourceWaitingForPlay(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nlwarning("Already playing");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*if (!m_WaitingForPlay)
|
/*if (!m_WaitingForPlay)
|
||||||
{
|
{
|
||||||
|
@ -127,7 +133,7 @@ void CStreamFileSource::play()
|
||||||
|
|
||||||
void CStreamFileSource::stop()
|
void CStreamFileSource::stop()
|
||||||
{
|
{
|
||||||
nldebug("stop");
|
nldebug("stop %s", getStreamFileSound()->getFilePath().c_str());
|
||||||
|
|
||||||
CStreamSource::stop();
|
CStreamSource::stop();
|
||||||
|
|
||||||
|
|
|
@ -264,6 +264,8 @@ void CStreamSource::stop()
|
||||||
_SpawnEndCb(this, _CbUserParam);
|
_SpawnEndCb(this, _CbUserParam);
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_WaitingForPlay = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStreamSource::setPos(const NLMISC::CVector& pos)
|
void CStreamSource::setPos(const NLMISC::CVector& pos)
|
||||||
|
|
Loading…
Reference in a new issue