X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fdata%2Fdecoderstack.cpp;h=51d4bae0483ec4ca2b1fb74abae54738f680bd0d;hb=cc10c40992278034a7d7648d34f19ff6743710db;hp=2668df2937acb3e29035ab39ceffaf86953f1195;hpb=b926e4eeef6db657601ebd4bbededdf9d329cdd6;p=pulseview.git diff --git a/pv/data/decoderstack.cpp b/pv/data/decoderstack.cpp index 2668df2..51d4bae 100644 --- a/pv/data/decoderstack.cpp +++ b/pv/data/decoderstack.cpp @@ -282,11 +282,22 @@ uint64_t DecoderStack::max_sample_count() const optional DecoderStack::wait_for_data() const { unique_lock input_lock(input_mutex_); + + // Do wait if we decoded all samples but we're still capturing + // Do not wait if we're done capturing while (!interrupt_ && !frame_complete_ && - samples_decoded_ >= sample_count_) + (samples_decoded_ >= sample_count_) && + (session_.get_capture_state() != Session::Stopped)) { + input_cond_.wait(input_lock); + } + + // Return value is valid if we're not aborting the decode, return boost::make_optional(!interrupt_ && - (samples_decoded_ < sample_count_ || !frame_complete_), + // and there's more work to do... + (samples_decoded_ < sample_count_ || !frame_complete_) && + // and if the end of the data hasn't been reached yet + (!((samples_decoded_ >= sample_count_) && (session_.get_capture_state() == Session::Stopped))), sample_count_); }