X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fdata%2Fdecoderstack.cpp;h=4b2a90576921178def34ca97dea23c3fe4d68e7c;hb=4c581c790c0e9d378a0074c2b2802a0d7f5c7579;hp=8284c7937c7a7ee6a68f334a587bee7374e97fcb;hpb=c1b2865ea8b10c4b41360b2fd1974a8bebaa0dea;p=pulseview.git diff --git a/pv/data/decoderstack.cpp b/pv/data/decoderstack.cpp index 8284c793..4b2a9057 100644 --- a/pv/data/decoderstack.cpp +++ b/pv/data/decoderstack.cpp @@ -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,6 +194,14 @@ void DecoderStack::begin_decode() clear(); + // Check that all decoders have the required probes + BOOST_FOREACH(const shared_ptr &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 &dec, _stack) { @@ -306,6 +315,9 @@ void DecoderStack::decode_data( lock_guard lock(_output_mutex); _samples_decoded = chunk_end; } + + if (i % DecodeNotifyPeriod == 0) + new_decode_data(); } new_decode_data(); @@ -320,11 +332,6 @@ void DecoderStack::decode_proc() assert(data); assert(_snapshot); - // Check that all decoders have the required probes - BOOST_FOREACH(const shared_ptr &dec, _stack) - if (!dec->have_required_probes()) - return; - // Create the session srd_session_new(&session); assert(session); @@ -424,7 +431,8 @@ void DecoderStack::on_data_received() { { unique_lock lock(_input_mutex); - _sample_count = _snapshot->get_sample_count(); + if (_snapshot) + _sample_count = _snapshot->get_sample_count(); } _input_cond.notify_one(); } @@ -433,7 +441,8 @@ void DecoderStack::on_frame_ended() { { unique_lock lock(_input_mutex); - _frame_complete = true; + if (_snapshot) + _frame_complete = true; } _input_cond.notify_one(); }