call SOUNDMAN->GetPosition unlocked (driver call), and GetSourceFrameFromHardwareFrame locked; also simpler (GetPositionSecondsInternal uses m_iStoppedSourceFrame)
This commit is contained in:
@@ -345,13 +345,16 @@ void RageSound::SoundIsFinishedPlaying()
|
|||||||
if( !m_bPlaying )
|
if( !m_bPlaying )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Lock the mutex after calling GetPositionSecondsInternal. We must not make driver
|
/* Get our current hardware position. */
|
||||||
* calls with our mutex locked (driver mutex < sound mutex). Nobody else will
|
int64_t iCurrentHardwareFrame = SOUNDMAN->GetPosition( NULL );
|
||||||
* see our sound as not playing until we set playing to false. */
|
|
||||||
m_iStoppedSourceFrame = (int) GetPositionSecondsInternal();
|
|
||||||
|
|
||||||
m_Mutex.Lock();
|
m_Mutex.Lock();
|
||||||
|
|
||||||
|
/* Lock the mutex after calling SOUNDMAN->GetPosition(). We must not make driver
|
||||||
|
* calls with our mutex locked (driver mutex < sound mutex). */
|
||||||
|
if( !m_HardwareToStreamMap.IsEmpty() && !m_StreamToSourceMap.IsEmpty() )
|
||||||
|
m_iStoppedSourceFrame = (int) GetSourceFrameFromHardwareFrame( iCurrentHardwareFrame );
|
||||||
|
|
||||||
// LOG->Trace("set playing false for %p (SoundIsFinishedPlaying) (%s)", this, this->GetLoadedFilePath().c_str());
|
// LOG->Trace("set playing false for %p (SoundIsFinishedPlaying) (%s)", this, this->GetLoadedFilePath().c_str());
|
||||||
m_bPlaying = false;
|
m_bPlaying = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user