summaryrefslogtreecommitdiff
path: root/indra/media_plugins
diff options
context:
space:
mode:
authorcallum_linden <none@none>2018-01-05 13:19:08 -0800
committercallum_linden <none@none>2018-01-05 13:19:08 -0800
commitd97d7c52068b71bd99b10db046c6a0688b61a254 (patch)
treed313f1e765aa13594e20a41f358a53c6f70f9f68 /indra/media_plugins
parent6659192a351f61a1c2476a6d34cc5fd6c8d6123f (diff)
Fix for MAINT-8119 - this bug morphed from a packaging issue to being all about audio not playing when a media stream started. There is some as yet, unknown interaction between the volume catcher code in the CEF plugin and the VLC volume controls. The fix for now is to add a Windows call to the VLC code that sets the process volume explicitly. Later we will address the volume catcher code, move it to a common spot so both CEF and LibVLC can use the same bytes
Diffstat (limited to 'indra/media_plugins')
-rw-r--r--indra/media_plugins/libvlc/media_plugin_libvlc.cpp55
1 files changed, 46 insertions, 9 deletions
diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
index 048e7675f8..80702a1079 100644
--- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
+++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
@@ -37,6 +37,11 @@
#include "vlc/vlc.h"
#include "vlc/libvlc_version.h"
+#if LL_WINDOWS
+// needed for waveOut call - see below for description
+#include <mmsystem.h>
+#endif
+
////////////////////////////////////////////////////////////////////////////////
//
class MediaPluginLibVLC :
@@ -55,6 +60,7 @@ private:
void playMedia();
void resetVLC();
void setVolume(const F64 volume);
+ void setVolumeVLC();
void updateTitle(const char* title);
static void* lock(void* data, void** p_pixels);
@@ -221,6 +227,7 @@ void MediaPluginLibVLC::eventCallbacks(const libvlc_event_t* event, void* ptr)
case libvlc_MediaPlayerPlaying:
parent->mDuration = (float)(libvlc_media_get_duration(parent->mLibVLCMedia)) / 1000.0f;
parent->mVlcStatus = STATUS_PLAYING;
+ parent->setVolumeVLC();
break;
case libvlc_MediaPlayerPaused:
@@ -394,30 +401,60 @@ void MediaPluginLibVLC::updateTitle(const char* title)
sendMessage(message);
}
-////////////////////////////////////////////////////////////////////////////////
-//
-void MediaPluginLibVLC::setVolume(const F64 volume)
+void MediaPluginLibVLC::setVolumeVLC()
{
- mCurVolume = volume;
-
if (mLibVLCMediaPlayer)
{
- int result = libvlc_audio_set_volume(mLibVLCMediaPlayer, (int)(volume * 100));
- if (result != 0)
+ int vlc_vol = (int)(mCurVolume * 100);
+
+ int result = libvlc_audio_set_volume(mLibVLCMediaPlayer, vlc_vol);
+ if (result == 0)
+ {
+ // volume change was accepted by LibVLC
+ }
+ else
{
- // volume wasn't set but not much to be done here
+ // volume change was NOT accepted by LibVLC and not actioned
}
+
+#if LL_WINDOWS
+ // https ://jira.secondlife.com/browse/MAINT-8119
+ // CEF media plugin uses code in media_plugins/cef/windows_volume_catcher.cpp to
+ // set the actual output volume of the plugin process since there is no API in
+ // CEF to otherwise do this.
+ // There are explicit calls to change the volume in LibVLC but sometimes they
+ // are ignored SLPlugin.exe process volume is set to 0 so you never heard audio
+ // from the VLC media stream.
+ // The right way to solve this is to move the volume catcher stuff out of
+ // the CEF plugin and into it's own folder under media_plugins and have it referenced
+ // by both CEF and VLC. That's for later. The code there boils down to this so for
+ // now, as we approach a release, the less risky option is to do it directly vs
+ // calls to volume catcher code.
+ DWORD left_channel = (DWORD)(mCurVolume * 65535.0f);
+ DWORD right_channel = (DWORD)(mCurVolume * 65535.0f);
+ DWORD hw_volume = left_channel << 16 | right_channel;
+ waveOutSetVolume(NULL, hw_volume);
+#endif
}
else
{
// volume change was requested but VLC wasn't ready.
- // that's okay thought because we saved the value in mCurVolume and
+ // that's okay though because we saved the value in mCurVolume and
// the next volume change after the VLC system is initilzied will set it
}
}
////////////////////////////////////////////////////////////////////////////////
//
+void MediaPluginLibVLC::setVolume(const F64 volume)
+{
+ mCurVolume = volume;
+
+ setVolumeVLC();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
void MediaPluginLibVLC::receiveMessage(const char* message_string)
{
LLPluginMessage message_in;