X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fsession.cpp;h=ef1159ee599f8abfbf0a7e6b90d6c100eeef3f44;hp=da9c0e9bb4af998abf3a3303eb525536245b3ba9;hb=8a7b603b295dacee7160eba8e577d6666472be9f;hpb=48257a69ffad409c9893605d99cd6e15161dff4f diff --git a/pv/session.cpp b/pv/session.cpp index da9c0e9b..ef1159ee 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -324,9 +324,14 @@ void Session::remove_decode_signal(view::DecodeTrace *signal) void Session::set_capture_state(capture_state state) { - lock_guard lock(sampling_mutex_); - const bool changed = capture_state_ != state; - capture_state_ = state; + bool changed; + + { + lock_guard lock(sampling_mutex_); + changed = capture_state_ != state; + capture_state_ = state; + } + if (changed) capture_state_changed(state); } @@ -481,6 +486,11 @@ void Session::feed_in_meta(shared_ptr meta) for (auto entry : meta->config()) { switch (entry.first->id()) { case SR_CONF_SAMPLERATE: + // We can't rely on the header to always contain the sample rate, + // so in case it's supplied via a meta packet, we use it. + if (!cur_samplerate_) + cur_samplerate_ = g_variant_get_uint64(entry.second.gobj()); + /// @todo handle samplerate changes break; default: