+ uint64_t samplerate;
+
+ // If there were stack changes, the session has been destroyed by now, so if
+ // it hasn't been destroyed, we can just reset and re-use it
+ if (srd_session_) {
+ // When a decoder stack was created before, re-use it
+ // for the next stream of input data, after terminating
+ // potentially still executing operations, and resetting
+ // internal state. Skip the rather expensive (teardown
+ // and) construction of another decoder stack.
+
+ // TODO Reduce redundancy, use a common code path for
+ // the meta/cb/start sequence?
+ terminate_srd_session();
+ srd_session_metadata_set(srd_session_, SRD_CONF_SAMPLERATE,
+ g_variant_new_uint64(segments_.at(current_segment_id_).samplerate));
+ srd_pd_output_callback_add(srd_session_, SRD_OUTPUT_ANN,
+ DecodeSignal::annotation_callback, this);
+ srd_session_start(srd_session_);
+ return;
+ }