]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decoderstack.cpp
Rename 'probe' to 'channel' (libsigrokdecode change).
[pulseview.git] / pv / data / decoderstack.cpp
index c197e019fd16c6b1e1d5d35ff2aa02d62b9e2bfa..c3bf26d25699c12135707b40512414c9ee0ef4f3 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;
 
@@ -193,10 +194,10 @@ void DecoderStack::begin_decode()
 
        clear();
 
-       // Check that all decoders have the required probes
+       // Check that all decoders have the required channels
        BOOST_FOREACH(const shared_ptr<decode::Decoder> &dec, _stack)
                if (!dec->have_required_probes()) {
-                       _error_message = tr("One or more required probes "
+                       _error_message = tr("One or more required channels "
                                "have not been specified");
                        return;
                }
@@ -232,12 +233,12 @@ void DecoderStack::begin_decode()
                }
        }
 
-       // We get the logic data of the first probe in the list.
+       // We get the logic data of the first channel in the list.
        // This works because we are currently assuming all
        // LogicSignals have the same data/snapshot
        BOOST_FOREACH (const shared_ptr<decode::Decoder> &dec, _stack)
-               if (dec && !dec->probes().empty() &&
-                       ((logic_signal = (*dec->probes().begin()).second)) &&
+               if (dec && !dec->channels().empty() &&
+                       ((logic_signal = (*dec->channels().begin()).second)) &&
                        ((data = logic_signal->logic_data())))
                        break;
 
@@ -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();
@@ -325,7 +329,6 @@ void DecoderStack::decode_proc()
        srd_session *session;
        srd_decoder_inst *prev_di = NULL;
 
-       assert(data);
        assert(_snapshot);
 
        // Create the session
@@ -427,7 +430,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 +440,8 @@ void DecoderStack::on_frame_ended()
 {
        {
                unique_lock<mutex> lock(_input_mutex);
-               _frame_complete = true;
+               if (_snapshot)
+                       _frame_complete = true;
        }
        _input_cond.notify_one();
 }