+ DecodeChunkLength / segment_->unit_size();
+
+ for (int64_t i = 0; !interrupt_ && i < sample_count;
+ i += chunk_sample_count) {
+
+ const int64_t chunk_end = min(
+ i + chunk_sample_count, sample_count);
+ segment_->get_samples(chunk, i, chunk_end);
+
+ if (srd_session_send(session, i, chunk_end, chunk,
+ (chunk_end - i) * unit_size, unit_size) != SRD_OK) {
+ error_message_ = tr("Decoder reported an error");
+ break;
+ }
+
+ {
+ lock_guard<mutex> lock(output_mutex_);
+ samples_decoded_ = chunk_end;
+ }
+
+ if (i % DecodeNotifyPeriod == 0)
+ new_decode_data();
+ }
+
+ new_decode_data();
+}
+
+void DecoderStack::decode_proc()
+{
+ optional<int64_t> sample_count;
+ srd_session *session;
+ srd_decoder_inst *prev_di = nullptr;
+
+ assert(segment_);
+
+ // Prevent any other decode threads from accessing libsigrokdecode
+ lock_guard<mutex> srd_lock(global_srd_mutex_);