summaryrefslogtreecommitdiff
path: root/indra/media_plugins
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2021-11-16 01:09:11 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2021-11-16 01:09:11 +0200
commit30c381406c4891cce439c66ca17b26247f0a698c (patch)
tree2196833344c813e2d6bf4b963adc517c30050697 /indra/media_plugins
parent764788c9bc549715aed119c639ac919067f38a92 (diff)
parent9957c28ddc5e5c129af2db662da7d69f1509af65 (diff)
Merge branch 'master' into DRTVWR-530-maint
# Conflicts: # doc/contributions.txt
Diffstat (limited to 'indra/media_plugins')
-rw-r--r--indra/media_plugins/cef/CMakeLists.txt3
-rw-r--r--indra/media_plugins/cef/media_plugin_cef.cpp5
-rw-r--r--indra/media_plugins/libvlc/media_plugin_libvlc.cpp41
3 files changed, 12 insertions, 37 deletions
diff --git a/indra/media_plugins/cef/CMakeLists.txt b/indra/media_plugins/cef/CMakeLists.txt
index ce6278963d..854ba55731 100644
--- a/indra/media_plugins/cef/CMakeLists.txt
+++ b/indra/media_plugins/cef/CMakeLists.txt
@@ -5,7 +5,6 @@ project(media_plugin_cef)
include(Boost)
include(00-Common)
include(LLCommon)
-include(LLImage)
include(LLPlugin)
include(LLMath)
include(LLRender)
@@ -13,7 +12,6 @@ include(LLWindow)
include(Linking)
include(PluginAPI)
include(MediaPluginBase)
-include(OpenGL)
include(CEFPlugin)
@@ -22,7 +20,6 @@ include_directories(
${MEDIA_PLUGIN_BASE_INCLUDE_DIRS}
${LLCOMMON_INCLUDE_DIRS}
${LLMATH_INCLUDE_DIRS}
- ${LLIMAGE_INCLUDE_DIRS}
${LLRENDER_INCLUDE_DIRS}
${LLWINDOW_INCLUDE_DIRS}
${CEF_INCLUDE_DIR}
diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp
index aa6eb16762..c413263619 100644
--- a/indra/media_plugins/cef/media_plugin_cef.cpp
+++ b/indra/media_plugins/cef/media_plugin_cef.cpp
@@ -29,7 +29,7 @@
#include "linden_common.h"
#include "indra_constants.h" // for indra keyboard codes
-#include "llgl.h"
+#include "llglheaders.h" // for GL_* constants
#include "llsdutil.h"
#include "llplugininstance.h"
#include "llpluginmessage.h"
@@ -37,9 +37,6 @@
#include "volume_catcher.h"
#include "media_plugin_base.h"
-#include <functional>
-#include <chrono>
-
#include "dullahan.h"
////////////////////////////////////////////////////////////////////////////////
diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
index 5d4a488e64..1afe25e9a1 100644
--- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
+++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
@@ -283,35 +283,16 @@ void MediaPluginLibVLC::playMedia()
return;
}
+ // A new call to play the media is received after the initial one. Typically
+ // this is due to a size change request either as the media naturally resizes
+ // to the size of the prim container, or else, as a 2D window is resized by the
+ // user. Stopping the media, helps avoid a race condition where the media pixel
+ // buffer size is out of sync with the declared size (width/height) for a frame
+ // or two and the plugin crashes as VLC tries to decode a frame into unallocated
+ // memory.
if (mLibVLCMediaPlayer)
{
- // stop listening to events while we reset things
- libvlc_event_manager_t* em = libvlc_media_player_event_manager(mLibVLCMediaPlayer);
- if (em)
- {
- libvlc_event_detach(em, libvlc_MediaPlayerOpening, eventCallbacks, NULL);
- libvlc_event_detach(em, libvlc_MediaPlayerPlaying, eventCallbacks, NULL);
- libvlc_event_detach(em, libvlc_MediaPlayerPaused, eventCallbacks, NULL);
- libvlc_event_detach(em, libvlc_MediaPlayerStopped, eventCallbacks, NULL);
- libvlc_event_detach(em, libvlc_MediaPlayerEndReached, eventCallbacks, NULL);
- libvlc_event_detach(em, libvlc_MediaPlayerEncounteredError, eventCallbacks, NULL);
- libvlc_event_detach(em, libvlc_MediaPlayerTimeChanged, eventCallbacks, NULL);
- libvlc_event_detach(em, libvlc_MediaPlayerPositionChanged, eventCallbacks, NULL);
- libvlc_event_detach(em, libvlc_MediaPlayerLengthChanged, eventCallbacks, NULL);
- libvlc_event_detach(em, libvlc_MediaPlayerTitleChanged, eventCallbacks, NULL);
- };
-
libvlc_media_player_stop(mLibVLCMediaPlayer);
- libvlc_media_player_release(mLibVLCMediaPlayer);
-
- mLibVLCMediaPlayer = 0;
- }
-
- if (mLibVLCMedia)
- {
- libvlc_media_release(mLibVLCMedia);
-
- mLibVLCMedia = 0;
}
mLibVLCMedia = libvlc_media_new_location(mLibVLC, mURL.c_str());
@@ -345,6 +326,9 @@ void MediaPluginLibVLC::playMedia()
libvlc_event_attach(em, libvlc_MediaPlayerTitleChanged, eventCallbacks, this);
}
+ libvlc_video_set_callbacks(mLibVLCMediaPlayer, lock, unlock, display, &mLibVLCCallbackContext);
+ libvlc_video_set_format(mLibVLCMediaPlayer, "RV32", mWidth, mHeight, mWidth * mDepth);
+
mLibVLCCallbackContext.parent = this;
mLibVLCCallbackContext.texture_pixels = mPixels;
mLibVLCCallbackContext.mp = mLibVLCMediaPlayer;
@@ -366,14 +350,11 @@ void MediaPluginLibVLC::playMedia()
setStatus(STATUS_LOADED);
- libvlc_video_set_callbacks(mLibVLCMediaPlayer, lock, unlock, display, &mLibVLCCallbackContext);
- libvlc_video_set_format(mLibVLCMediaPlayer, "RV32", mWidth, mHeight, mWidth * mDepth);
-
// note this relies on the "set_loop" message arriving before the "start" (play) one
// but that appears to always be the case
if (mIsLooping)
{
- libvlc_media_add_option(mLibVLCMedia, "input-repeat=-1");
+ libvlc_media_add_option(mLibVLCMedia, "input-repeat=65535");
}
libvlc_media_player_play(mLibVLCMediaPlayer);