summaryrefslogtreecommitdiff
path: root/indra/llplugin/llpluginclassmedia.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-07-15 22:50:02 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-07-16 20:06:41 +0300
commit8aa0161ed3f370a37a4ae849ce5c8a367d88c3fb (patch)
treebd8cdad3be840ff2dd8a112909d02d77a0fdf98c /indra/llplugin/llpluginclassmedia.cpp
parentb76dce8903f9fd653ab604132c79c091c5476b08 (diff)
#6002 Filter out inaudible media volume changes
Diffstat (limited to 'indra/llplugin/llpluginclassmedia.cpp')
-rw-r--r--indra/llplugin/llpluginclassmedia.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index 4e80f4c0ca..94c29d9457 100644
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -33,6 +33,8 @@
#include "llpluginmessageclasses.h"
#include "llcontrol.h"
+#include <cmath>
+
extern LLControlGroup gSavedSettings;
#if LL_DARWIN
extern bool gHiDPISupport;
@@ -1616,7 +1618,13 @@ void LLPluginClassMedia::setLoop(bool loop)
void LLPluginClassMedia::setVolume(float volume)
{
- if(volume != mRequestedVolume)
+ // VLC's volume is integer, 0 to 100 range. When converted from float,
+ // changes below 0.01 won't be noticed by VLC.
+ // CEF's audio range is DWORD, 0 to 65535. But changes so small are
+ // inaudible and don't warrant the overhead, so use a bigger epsilon
+ // to avoid extra messages and locking.
+ constexpr float VOLUME_EPSILON = 0.002f;
+ if (std::abs(volume - mRequestedVolume) > VOLUME_EPSILON)
{
mRequestedVolume = volume;