]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decoderstack.cpp
Only update the decode state when decoding
[pulseview.git] / pv / data / decoderstack.cpp
index f642b11eaf92db972f4c0c01745db0b42ace3b87..b252877b7098940c80ca7f82ba91b4466aa3246a 100644 (file)
@@ -193,6 +193,14 @@ void DecoderStack::begin_decode()
 
        clear();
 
+       // Check that all decoders have the required probes
+       BOOST_FOREACH(const shared_ptr<decode::Decoder> &dec, _stack)
+               if (!dec->have_required_probes()) {
+                       _error_message = tr("One or more required probes "
+                               "have not been specified");
+                       return;
+               }
+
        // Add classes
        BOOST_FOREACH (const shared_ptr<decode::Decoder> &dec, _stack)
        {
@@ -320,14 +328,6 @@ void DecoderStack::decode_proc()
        assert(data);
        assert(_snapshot);
 
-       // Check that all decoders have the required probes
-       BOOST_FOREACH(const shared_ptr<decode::Decoder> &dec, _stack)
-               if (!dec->have_required_probes()) {
-                       _error_message = tr("One or more required probes "
-                               "have not been specified");
-                       return;
-               }
-
        // Create the session
        srd_session_new(&session);
        assert(session);
@@ -427,7 +427,8 @@ void DecoderStack::on_data_received()
 {
        {
                unique_lock<mutex> lock(_input_mutex);
-               _sample_count = _snapshot->get_sample_count();
+               if (_snapshot)
+                       _sample_count = _snapshot->get_sample_count();
        }
        _input_cond.notify_one();
 }
@@ -436,7 +437,8 @@ void DecoderStack::on_frame_ended()
 {
        {
                unique_lock<mutex> lock(_input_mutex);
-               _frame_complete = true;
+               if (_snapshot)
+                       _frame_complete = true;
        }
        _input_cond.notify_one();
 }