GstEnginePipeline: Set volume internal in notify volume callback

Fixes #1541
This commit is contained in:
Jonas Kvinge 2024-09-10 17:04:24 +02:00
parent af06f8e70a
commit 4ea5eb8292
1 changed files with 3 additions and 2 deletions

View File

@ -1123,11 +1123,12 @@ void GstEnginePipeline::NotifyVolumeCallback(GstElement *element, GParamSpec *pa
if (!instance->volume_set_.value()) return; 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); g_object_get(G_OBJECT(instance->volume_), "volume", &volume_internal, nullptr);
const uint volume_percent = static_cast<uint>(qBound(0L, lround(instance->volume_internal_.value() / 0.01), 100L)); const uint volume_percent = static_cast<uint>(qBound(0L, lround(volume_internal / 0.01), 100L));
if (volume_percent != instance->volume_percent_.value()) { if (volume_percent != instance->volume_percent_.value()) {
instance->volume_internal_ = volume_internal;
instance->volume_percent_ = volume_percent; instance->volume_percent_ = volume_percent;
Q_EMIT instance->VolumeChanged(volume_percent); Q_EMIT instance->VolumeChanged(volume_percent);
} }