summaryrefslogtreecommitdiff
path: root/indra/llplugin/llpluginclassmedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llplugin/llpluginclassmedia.cpp')
-rw-r--r--indra/llplugin/llpluginclassmedia.cpp49
1 files changed, 46 insertions, 3 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index 6ab378f30f..32ecf7bcd1 100644
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -33,12 +33,16 @@
#include "llpluginmessageclasses.h"
#include "llcontrol.h"
+#include <cmath>
+
extern LLControlGroup gSavedSettings;
-#if LL_DARWIN
+#if LL_DARWIN || LL_LINUX
extern bool gHiDPISupport;
#endif
static int LOW_PRIORITY_TEXTURE_SIZE_DEFAULT = 256;
+static const U32 MIN_DEBUG_PORT = 1024;
+static const U32 MAX_DEBUG_PORT = 65535;
static int nextPowerOf2( int value )
{
@@ -90,6 +94,7 @@ bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::s
void LLPluginClassMedia::reset()
{
+ LL_PROFILE_ZONE_SCOPED;
if(mPlugin)
{
mPlugin->requestShutdown();
@@ -373,7 +378,7 @@ void LLPluginClassMedia::setSizeInternal(void)
mRequestedMediaHeight = nextPowerOf2(mRequestedMediaHeight);
}
-#if LL_DARWIN
+#if LL_DARWIN || LL_LINUX
if (!gHiDPISupport)
#endif
{
@@ -960,6 +965,34 @@ void LLPluginClassMedia::showPageSource()
sendMessage(message);
}
+
+static U32 assignCefDebuggingPort()
+{
+ U32 base_port = gSavedSettings.getU32("CEFRemoteDebuggingPort");
+ if (base_port == 0)
+ {
+ return 0;
+ }
+ base_port = llclamp<U32>(base_port, MIN_DEBUG_PORT, MAX_DEBUG_PORT);
+
+ static U32 last_base_port = 0;
+ static U32 offset = 0;
+ if (base_port != last_base_port)
+ {
+ last_base_port = base_port;
+ offset = 0;
+ }
+
+ U32 new_port = base_port + offset;
+ if (new_port > MAX_DEBUG_PORT)
+ {
+ return 0;
+ }
+
+ ++offset;
+ return new_port;
+}
+
void LLPluginClassMedia::setUserDataPath(const std::string &user_data_path_cache,
const std::string &username,
const std::string &user_data_path_cef_log)
@@ -971,6 +1004,10 @@ void LLPluginClassMedia::setUserDataPath(const std::string &user_data_path_cache
bool cef_verbose_log = gSavedSettings.getBOOL("CefVerboseLog");
message.setValueBoolean("cef_verbose_log", cef_verbose_log);
+
+ U32 cef_remote_debugging_port = assignCefDebuggingPort();
+ message.setValueU32("cef_remote_debugging_port", cef_remote_debugging_port);
+ mCefRemoteDebuggingPort = cef_remote_debugging_port;
sendMessage(message);
}
@@ -1633,7 +1670,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;