As reported in bug #1118 not all input sources provide a samplerate, and
decoder instances may not cope with a rate spec of 0. Only pass non-zero
sample rates to the decoder stack. This improves robustness in addition
to the specific fix for #1118 in the decoders' implementations.
void DecodeSignal::start_srd_session()
{
+ uint64_t samplerate;
+
if (srd_session_)
stop_srd_session();
}
// Start the session
- srd_session_metadata_set(srd_session_, SRD_CONF_SAMPLERATE,
- g_variant_new_uint64(segments_.at(current_segment_id_).samplerate));
+ samplerate = segments_.at(current_segment_id_).samplerate;
+ if (samplerate)
+ srd_session_metadata_set(srd_session_, SRD_CONF_SAMPLERATE,
+ g_variant_new_uint64(samplerate));
srd_pd_output_callback_add(srd_session_, SRD_OUTPUT_ANN,
DecodeSignal::annotation_callback, this);