Skip to content

Commit

Permalink
hydrogen.cpp: change return value behavior of audioEngine_process()
Browse files Browse the repository at this point in the history
Only return "2" if the consumer of audioEngine_process is the
DiskWriterDriver. Other driver may interprete the return value
in a different manner.
  • Loading branch information
mauser committed May 24, 2020
1 parent 5ba437f commit 1485a6f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/core/src/hydrogen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1269,10 +1269,15 @@ int audioEngine_process( uint32_t nframes, void* /*arg*/ )
* The "try_lock" was introduced for Bug #164 (Deadlock after during
* alsa driver shutdown). The try_lock *should* only fail in rare circumstances
* (like shutting down drivers). In such cases, it seems to be ok to interrupt
* audio processing.
* audio processing. Returning the special return value "2" enables the disk
* writer driver to repeat the processing of the current data.
*/
if(!AudioEngine::get_instance()->try_lock( RIGHT_HERE )){
return 2;
if(!AudioEngine::get_instance()->try_lock( RIGHT_HERE )) {
if ( m_pAudioDriver->class_name() == DiskWriterDriver::class_name() ) {
return 2; // inform the caller that we could not aquire the lock
}

return 0;
}

if ( m_audioEngineState < STATE_READY) {
Expand Down

0 comments on commit 1485a6f

Please sign in to comment.