]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decoderstack.cpp
Fixed non-painting decode
[pulseview.git] / pv / data / decoderstack.cpp
index c197e019fd16c6b1e1d5d35ff2aa02d62b9e2bfa..4b2a90576921178def34ca97dea23c3fe4d68e7c 100644 (file)
@@ -58,6 +58,7 @@ namespace data {
 const double DecoderStack::DecodeMargin = 1.0;
 const double DecoderStack::DecodeThreshold = 0.2;
 const int64_t DecoderStack::DecodeChunkLength = 4096;
+const unsigned int DecoderStack::DecodeNotifyPeriod = 65536;
 
 mutex DecoderStack::_global_decode_mutex;
 
@@ -314,6 +315,9 @@ void DecoderStack::decode_data(
                        lock_guard<mutex> lock(_output_mutex);
                        _samples_decoded = chunk_end;
                }
+
+               if (i % DecodeNotifyPeriod == 0)
+                       new_decode_data();
        }
 
        new_decode_data();
@@ -427,7 +431,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 +441,8 @@ void DecoderStack::on_frame_ended()
 {
        {
                unique_lock<mutex> lock(_input_mutex);
-               _frame_complete = true;
+               if (_snapshot)
+                       _frame_complete = true;
        }
        _input_cond.notify_one();
 }