projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
DecodeSignal: Add and use inclusive/exclusive sample count variant
[pulseview.git]
/
pv
/
data
/
decodesignal.cpp
diff --git
a/pv/data/decodesignal.cpp
b/pv/data/decodesignal.cpp
index baef9ce191ddeebd7ea2a480e0e4957b19a5d460..0e813d38b7d97b30c7b29d49edf44bc45222cb4a 100644
(file)
--- a/
pv/data/decodesignal.cpp
+++ b/
pv/data/decodesignal.cpp
@@
-398,7
+398,8
@@
int64_t DecodeSignal::get_working_sample_count(uint32_t segment_id) const
return (no_signals_assigned ? 0 : count);
}
return (no_signals_assigned ? 0 : count);
}
-int64_t DecodeSignal::get_decoded_sample_count(uint32_t segment_id) const
+int64_t DecodeSignal::get_decoded_sample_count(uint32_t segment_id,
+ bool include_processing) const
{
lock_guard<mutex> decode_lock(output_mutex_);
{
lock_guard<mutex> decode_lock(output_mutex_);
@@
-406,7
+407,10
@@
int64_t DecodeSignal::get_decoded_sample_count(uint32_t segment_id) const
try {
const DecodeSegment *segment = &(segments_.at(segment_id));
try {
const DecodeSegment *segment = &(segments_.at(segment_id));
- result = segment->samples_decoded;
+ if (include_processing)
+ result = segment->samples_decoded_incl;
+ else
+ result = segment->samples_decoded_excl;
} catch (out_of_range&) {
// Do nothing
}
} catch (out_of_range&) {
// Do nothing
}
@@
-919,11
+923,10
@@
void DecodeSignal::decode_data(
const int64_t chunk_end = min(i + chunk_sample_count,
abs_start_samplenum + sample_count);
const int64_t chunk_end = min(i + chunk_sample_count,
abs_start_samplenum + sample_count);
- // Report this chunk as already decoded so that annotations don't
- // appear in an area that we claim to not having been been decoded yet
{
lock_guard<mutex> lock(output_mutex_);
{
lock_guard<mutex> lock(output_mutex_);
- segments_.at(current_segment_id_).samples_decoded = chunk_end;
+ // Update the sample count showing the samples including currently processed ones
+ segments_.at(current_segment_id_).samples_decoded_incl = chunk_end;
}
int64_t data_size = (chunk_end - i) * unit_size;
}
int64_t data_size = (chunk_end - i) * unit_size;
@@
-939,6
+942,12
@@
void DecodeSignal::decode_data(
delete[] chunk;
delete[] chunk;
+ {
+ lock_guard<mutex> lock(output_mutex_);
+ // Now that all samples are processed, the exclusive sample count catches up
+ segments_.at(current_segment_id_).samples_decoded_excl = chunk_end;
+ }
+
// Notify the frontend that we processed some data and
// possibly have new annotations as well
new_annotations();
// Notify the frontend that we processed some data and
// possibly have new annotations as well
new_annotations();