+ for (int64_t i = 0; !interrupt_ && i < sample_count;
+ i += chunk_sample_count)
+ {
+ lock_guard<mutex> decode_lock(global_decode_mutex_);
+
+ 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, i + sample_count, chunk,
+ (chunk_end - i) * 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 = NULL;