]> sigrok.org Git - pulseview.git/commitdiff
Session: Allow an SR_DF_META packet to override the samplerate
authorSoeren Apel <redacted>
Tue, 22 May 2018 07:24:13 +0000 (09:24 +0200)
committerSoeren Apel <redacted>
Tue, 22 May 2018 07:24:13 +0000 (09:24 +0200)
Otherwise, the sample rate determined by the read_config() call
in Session::sample_thread_proc() will be kept even if it's wrong
and the driver wants to submit the correct one.

pv/session.cpp

index 6767951cf85961ea303d9fc6f830e8a7d9eb576d..4aba385b687d22ac8764da163b3f552792580682 100644 (file)
@@ -1048,15 +1048,10 @@ void Session::feed_in_meta(shared_ptr<Meta> meta)
        for (auto entry : meta->config()) {
                switch (entry.first->id()) {
                case SR_CONF_SAMPLERATE:
        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
+                       cur_samplerate_ = g_variant_get_uint64(entry.second.gobj());
                        break;
                default:
                        break;
                default:
-                       // Unknown metadata is not an error.
+                       qDebug() << "Received meta data key" << entry.first->id() << ", ignoring.";
                        break;
                }
        }
                        break;
                }
        }