AudioSdl: fix cleanup hanging

This commit is contained in:
Andrew Kelley
2015-09-13 20:48:53 -07:00
parent 799f830827
commit 98346f7a9a
2 changed files with 3 additions and 11 deletions

View File

@@ -82,8 +82,7 @@ private:
bool m_convertEndian;
volatile bool m_stopped;
QSemaphore m_stopSemaphore;
bool m_stopped;
} ;

View File

@@ -42,8 +42,7 @@ AudioSdl::AudioSdl( bool & _success_ful, Mixer* _mixer ) :
AudioDevice( DEFAULT_CHANNELS, _mixer ),
m_outBuf( new surroundSampleFrame[mixer()->framesPerPeriod()] ),
m_convertedBufPos( 0 ),
m_convertEndian( false ),
m_stopSemaphore( 1 )
m_convertEndian( false )
{
_success_ful = false;
@@ -78,8 +77,6 @@ AudioSdl::AudioSdl( bool & _success_ful, Mixer* _mixer ) :
}
m_convertEndian = ( m_audioHandle.format != actual.format );
m_stopSemaphore.acquire();
_success_ful = true;
}
@@ -89,7 +86,6 @@ AudioSdl::AudioSdl( bool & _success_ful, Mixer* _mixer ) :
AudioSdl::~AudioSdl()
{
stopProcessing();
m_stopSemaphore.release();
SDL_CloseAudio();
SDL_Quit();
@@ -114,9 +110,8 @@ void AudioSdl::stopProcessing()
{
if( SDL_GetAudioStatus() == SDL_AUDIO_PLAYING )
{
m_stopSemaphore.acquire();
SDL_LockAudio();
m_stopped = true;
SDL_PauseAudio( 1 );
SDL_UnlockAudio();
}
@@ -176,8 +171,6 @@ void AudioSdl::sdlAudioCallback( Uint8 * _buf, int _len )
const fpp_t frames = getNextBuffer( m_outBuf );
if( !frames )
{
m_stopped = true;
m_stopSemaphore.release();
memset( _buf, 0, _len );
return;
}