The media_player instance retains and releases the libvlc instance it's
created from. When using a different libvlc instance for media_player
and media, it was using the libvlc instance from the media_t object,
leading to the release of the wrong libvlc instance, and thus potential
use-after-free of one instance and leaks of the other.
It has been spotted since VLCKit creates a shared libvlc instance and
then can create a new libvlc instance in case the VLCMediaPlayer is
created with different options, which means that the VLCMediaPlayer and
the VLCMedia will be bound to different libvlc instances, triggering the
issue described in first paragraph and crashing.
/!\ This commit changes libvlc behaviour in the following case:
- There's at least two libvlc instance, one being the parent of a media
and the other being the parent of a media_player.
- The media is set on the media_player.
- A new media is played by the underlying vlc_player_t, in which case
the new libvlc_media_t instance is now created with the player
libvlc instance instead of the media libvlc instance.
- The user call libvlc_media_player_get_media() on the player.
- The user call preparse functions on the media.
Since this very case was leading to crash anyway, and is quite
intricate, it's probably not a very important change though.
Refs videolan/VLCKit#189, videolan/VLCKit#116
Cherry-picked from commit 12fa8556c0.
That way, users receive the media end status before receiving the
media_list end event.
(cherry picked from commit a4a94bb3f9)
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
Users only listening on the medialist events were not notified when the
media parsing failed.
(cherry picked from commit ff5089b94f)
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
Only query the list of audio devices if the specified module/option
exists, and it is a string.
(cherry picked from commit 7578135789)
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
p_stats is written with the input item lock (by the input thread).
Thus the input item lock is necessary to read and dereference p_stats.
(cherry picked from commit 1fffacd6ea)
Within all the introduced static libraries, the module cannot be known
at compilation time. This moves the module name from a compilation
constant to a link time constant string symbol. That way, the same
compiled object within a static library can use a different and correct
module name depending on which plugin it is linked into.
The symbol is hidden so it does not leak between shared objects. For
non-plugins shared libraries (vlccore, vlc, vlc_pulse and
vlc_xcb_events) the module name must be defined manually, unless the
library does not use msg_* macros at all (vlc_vdpau).
libvlc_media_player_set_xwindow() should only force the embed-xid "vout window"
plugin but not the xid "vout display" plugin.
This allows to use the GL "vout display" via EGL/GLX (with full hardware
acceleration) with an embedded X window.
Fixes#18907
This reverts commit 76118f5826.
It turns out this is actually an issue with libtool, cleaning the flags
when in link mode and removing the sanitizer flag.
It was fixed in libtool a5c6466528c060cc4660ad0319c00740db0e42ba
but there was no release since this fix.
Using sanitizer and no-undefined will cause linker errors on darwin due
to undefined symbols of the sanitizer.
This is adapted from a patch by Filip Roséen.
Since input_Control is executed asynchronously, current state may be
different to the state when INPUT_SET_STATE executing. Here is a use
case which is broken by check current state in
libvlc_media_player_set_pause():
1. current state is paused
2. call libvlc_media_player_play()
3. call libvlc_media_player_set_pause() immediately before
INPUT_SET_STATE PLAYING_S is executed, libvlc_media_player_set_pause()
will do nothing, so it looks like the pause request is been dropped
silently
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
Libvlc users need to hold a reference to an item before using it. This avoid
use-after-free if the delete callback is called while an item is used by the
media player.
Instead of getting all the dictionary keys, and iterating over them to
get the associated values, only to free/release the associated data;
use vlc_dictionary_clear together with a callback to handle the work
for us.
These changes also fixes a potential null-pointer dereference if the
previous usage of vlc_dictionary_all_keys failed.
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>