3825ca17ba
Unrelated, but %license macro instead of %doc for COPYING
56 lines
2.0 KiB
Diff
56 lines
2.0 KiB
Diff
From cc10c40992278034a7d7648d34f19ff6743710db Mon Sep 17 00:00:00 2001
|
|
From: Soeren Apel <soeren@apelpie.net>
|
|
Date: Tue, 9 Feb 2016 11:58:36 +0100
|
|
Subject: [PATCH 11/13] DecoderStack: Make decoder sessions terminate after
|
|
running
|
|
|
|
Currently, SRD sessions aren't terminating after all data
|
|
has been decoded, leaving the decode thread in a state
|
|
where it's waiting for more data.
|
|
This would be okay if an acquisition was still ongoing but
|
|
when the acquisition has been stopped, there will never be
|
|
more data. When a new acquisition is started, the previous
|
|
decode sessions will be terminated and then new ones will
|
|
be started. This is the reason why this behavior wasn't
|
|
an issue up until now.
|
|
|
|
However, the fix for #181 requires that the decode thread
|
|
terminates or else the global SRD lock will never be
|
|
released.
|
|
---
|
|
pv/data/decoderstack.cpp | 15 +++++++++++++--
|
|
1 file changed, 13 insertions(+), 2 deletions(-)
|
|
|
|
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<int64_t> DecoderStack::wait_for_data() const
|
|
{
|
|
unique_lock<mutex> 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_);
|
|
}
|
|
|
|
--
|
|
2.4.3
|
|
|