From: Soeren Apel Date: Mon, 9 Oct 2017 15:47:19 +0000 (+0200) Subject: Session: Query the device's sample rate when needed, not sooner X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=b5940cf0ef30b3519389da8c8768aee4d4424415;p=pulseview.git Session: Query the device's sample rate when needed, not sooner --- diff --git a/pv/session.cpp b/pv/session.cpp index a44ceb99..07ee594d 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -952,7 +952,7 @@ void Session::free_unused_memory() void Session::feed_in_header() { - cur_samplerate_ = device_->read_config(ConfigKey::SAMPLERATE); + // Nothing to do here for now } void Session::feed_in_meta(shared_ptr meta) @@ -1023,6 +1023,9 @@ void Session::feed_in_frame_end() void Session::feed_in_logic(shared_ptr logic) { + if (!cur_samplerate_) + cur_samplerate_ = device_->read_config(ConfigKey::SAMPLERATE); + lock_guard lock(data_mutex_); if (!logic_data_) { @@ -1055,6 +1058,9 @@ void Session::feed_in_logic(shared_ptr logic) void Session::feed_in_analog(shared_ptr analog) { + if (!cur_samplerate_) + cur_samplerate_ = device_->read_config(ConfigKey::SAMPLERATE); + lock_guard lock(data_mutex_); const vector> channels = analog->channels();