]> sigrok.org Git - pulseview.git/commitdiff
DecodeSignal: Fix restarting the decode after reloading file
authorSoeren Apel <redacted>
Sun, 21 May 2017 17:59:59 +0000 (19:59 +0200)
committerUwe Hermann <redacted>
Wed, 5 Jul 2017 22:37:08 +0000 (00:37 +0200)
pv/data/decodesignal.cpp

index 4c8548fc8280fb8bf564e0cc98221de1aac41505..37956889e8554624139a26aebd74c90f484f750d 100644 (file)
@@ -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<mutex> 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<mutex> 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<mutex> input_wait_lock(input_mutex_);
+                       decode_input_cond_.wait(input_wait_lock);
+               }
        } while (!samplerate_valid && !decode_interrupt_);
 }