- const shared_ptr<pv::data::LogicSnapshot> &snapshot =
- snapshots.front();
- const int64_t sample_count = snapshot->get_sample_count();
- const unsigned int chunk_sample_count =
- DecodeChunkLength / snapshot->unit_size();
+ const int64_t chunk_end = min(
+ i + chunk_sample_count, sample_count);
+ snapshot_->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;
+
+ assert(snapshot_);