summaryrefslogtreecommitdiff
path: root/indra/media_plugins
diff options
context:
space:
mode:
authorMaki <maki@hotmilk.space>2024-05-24 18:40:27 -0400
committerMaki <maki@hotmilk.space>2024-05-24 18:40:27 -0400
commitf649f7ab2308047dc4a8ca3cbc331aed957543ff (patch)
treefa59d7966ba969ddcb74f1e0be359fe08f29d247 /indra/media_plugins
parentbdf46af9aff96a749dcf2612a2bdc6e8e394971e (diff)
Reset memorized Chromium volume and apply temporary volume
Diffstat (limited to 'indra/media_plugins')
-rwxr-xr-xindra/media_plugins/cef/linux/volume_catcher_pipewire.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/indra/media_plugins/cef/linux/volume_catcher_pipewire.cpp b/indra/media_plugins/cef/linux/volume_catcher_pipewire.cpp
index 0fb9d26476..27fea547c9 100755
--- a/indra/media_plugins/cef/linux/volume_catcher_pipewire.cpp
+++ b/indra/media_plugins/cef/linux/volume_catcher_pipewire.cpp
@@ -175,6 +175,9 @@ void VolumeCatcherPipeWire::unlock()
llpw_thread_loop_unlock(mThreadLoop);
}
+const uint32_t channels = 1;
+const float resetVolumes[channels] = { 1.0f };
+
void VolumeCatcherPipeWire::ChildNode::updateVolume()
{
if (!mActive)
@@ -182,9 +185,7 @@ void VolumeCatcherPipeWire::ChildNode::updateVolume()
F32 volume = std::clamp(mImpl->mVolume, 0.0f, 1.0f);
- const uint32_t channels = 1;
- float volumes[channels];
- volumes[0] = volume;
+ const float volumes[channels] = { volume };
uint8_t buffer[512];
@@ -193,8 +194,15 @@ void VolumeCatcherPipeWire::ChildNode::updateVolume()
spa_pod_frame frame;
spa_pod_builder_push_object(&builder, &frame, SPA_TYPE_OBJECT_Props, SPA_PARAM_Props);
+
+ // resets system-wide memorized volume for chromium (not google chrome) to 100%
spa_pod_builder_prop(&builder, SPA_PROP_channelVolumes, 0);
+ spa_pod_builder_array(&builder, sizeof(float), SPA_TYPE_Float, channels, resetVolumes);
+
+ // sets temporary volume
+ spa_pod_builder_prop(&builder, SPA_PROP_softVolumes, 0);
spa_pod_builder_array(&builder, sizeof(float), SPA_TYPE_Float, channels, volumes);
+
spa_pod* pod = static_cast<spa_pod*>(spa_pod_builder_pop(&builder, &frame));
{