From 4ea5eb82925b897300396024bcee8619cd026d53 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Tue, 10 Sep 2024 17:04:24 +0200 Subject: [PATCH] GstEnginePipeline: Set volume internal in notify volume callback Fixes #1541 --- src/engine/gstenginepipeline.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/engine/gstenginepipeline.cpp b/src/engine/gstenginepipeline.cpp index ad35a7b6e..528cdcaaf 100644 --- a/src/engine/gstenginepipeline.cpp +++ b/src/engine/gstenginepipeline.cpp @@ -1123,11 +1123,12 @@ void GstEnginePipeline::NotifyVolumeCallback(GstElement *element, GParamSpec *pa if (!instance->volume_set_.value()) return; - const double volume_internal = instance->volume_internal_.value(); + double volume_internal = 0.0; g_object_get(G_OBJECT(instance->volume_), "volume", &volume_internal, nullptr); - const uint volume_percent = static_cast(qBound(0L, lround(instance->volume_internal_.value() / 0.01), 100L)); + const uint volume_percent = static_cast(qBound(0L, lround(volume_internal / 0.01), 100L)); if (volume_percent != instance->volume_percent_.value()) { + instance->volume_internal_ = volume_internal; instance->volume_percent_ = volume_percent; Q_EMIT instance->VolumeChanged(volume_percent); }