Browse Source

Merge pull request #210 from f1xpl/master

Fix high CPU usage by PulseAudio backend when stream is stopped
fix-wasapi-resampler-crash
garyscavone GitHub 5 years ago
parent
commit
1cba5c90a3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 18 deletions
  1. +24
    -18
      RtAudio.cpp

+ 24
- 18
RtAudio.cpp View File

@@ -8699,15 +8699,18 @@ void RtApiPulse::stopStream( void )
stream_.state = STREAM_STOPPED;
MUTEX_LOCK( &stream_.mutex );

if ( pah && pah->s_play ) {
int pa_error;
if ( pa_simple_drain( pah->s_play, &pa_error ) < 0 ) {
errorStream_ << "RtApiPulse::stopStream: error draining output device, " <<
pa_strerror( pa_error ) << ".";
errorText_ = errorStream_.str();
MUTEX_UNLOCK( &stream_.mutex );
error( RtAudioError::SYSTEM_ERROR );
return;
if ( pah ) {
pah->runnable = false;
if ( pah->s_play ) {
int pa_error;
if ( pa_simple_drain( pah->s_play, &pa_error ) < 0 ) {
errorStream_ << "RtApiPulse::stopStream: error draining output device, " <<
pa_strerror( pa_error ) << ".";
errorText_ = errorStream_.str();
MUTEX_UNLOCK( &stream_.mutex );
error( RtAudioError::SYSTEM_ERROR );
return;
}
}
}

@@ -8733,15 +8736,18 @@ void RtApiPulse::abortStream( void )
stream_.state = STREAM_STOPPED;
MUTEX_LOCK( &stream_.mutex );

if ( pah && pah->s_play ) {
int pa_error;
if ( pa_simple_flush( pah->s_play, &pa_error ) < 0 ) {
errorStream_ << "RtApiPulse::abortStream: error flushing output device, " <<
pa_strerror( pa_error ) << ".";
errorText_ = errorStream_.str();
MUTEX_UNLOCK( &stream_.mutex );
error( RtAudioError::SYSTEM_ERROR );
return;
if ( pah ) {
pah->runnable = false;
if ( pah->s_play ) {
int pa_error;
if ( pa_simple_flush( pah->s_play, &pa_error ) < 0 ) {
errorStream_ << "RtApiPulse::abortStream: error flushing output device, " <<
pa_strerror( pa_error ) << ".";
errorText_ = errorStream_.str();
MUTEX_UNLOCK( &stream_.mutex );
error( RtAudioError::SYSTEM_ERROR );
return;
}
}
}



Loading…
Cancel
Save