From 1485a6f50390be0f7d1bdf5ffef01fd83850f414 Mon Sep 17 00:00:00 2001 From: Sebastian Moors Date: Sun, 24 May 2020 21:58:21 +0200 Subject: [PATCH] hydrogen.cpp: change return value behavior of audioEngine_process() Only return "2" if the consumer of audioEngine_process is the DiskWriterDriver. Other driver may interprete the return value in a different manner. --- src/core/src/hydrogen.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/src/hydrogen.cpp b/src/core/src/hydrogen.cpp index 765c42af4..9bbc388a3 100644 --- a/src/core/src/hydrogen.cpp +++ b/src/core/src/hydrogen.cpp @@ -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) {