From: Soeren Apel Date: Sun, 21 May 2017 17:59:59 +0000 (+0200) Subject: DecodeSignal: Fix restarting the decode after reloading file X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=1ec191ed5406f1a6a7acb54472c66e7dc0554c20;p=pulseview.git DecodeSignal: Fix restarting the decode after reloading file --- diff --git a/pv/data/decodesignal.cpp b/pv/data/decodesignal.cpp index 4c8548fc..37956889 100644 --- a/pv/data/decodesignal.cpp +++ b/pv/data/decodesignal.cpp @@ -605,12 +605,12 @@ void DecodeSignal::logic_mux_proc() } while (processed_samples < samples_to_process); } - if (session_.get_capture_state() != Session::Stopped) { + if (samples_to_process == 0) { // Wait for more input unique_lock logic_mux_lock(logic_mux_mutex_); logic_mux_cond_.wait(logic_mux_lock); } - } while ((session_.get_capture_state() != Session::Stopped) && !logic_mux_interrupt_); + } while (!logic_mux_interrupt_); // No more input data and session is stopped, let the decode thread // process any pending data, terminate and release the global SRD mutex @@ -643,9 +643,11 @@ void DecodeSignal::query_input_metadata() samplerate_valid = true; } - // Wait until input data is available or an interrupt was requested - unique_lock input_wait_lock(input_mutex_); - decode_input_cond_.wait(input_wait_lock); + if (!samplerate_valid) { + // Wait until input data is available or an interrupt was requested + unique_lock input_wait_lock(input_mutex_); + decode_input_cond_.wait(input_wait_lock); + } } while (!samplerate_valid && !decode_interrupt_); }