Mutex assertion failed in media_list_player.c when creating new media list player
This simple LibVLC program fails with an assertion:
#include <unistd.h>
#include <vlc/vlc.h>
#include <vlc/libvlc.h>
#include <vlc/libvlc_media_list_player.h>
int main(int argc, char** argv) {
libvlc_instance_t *p_instance = libvlc_new(0, NULL);
libvlc_media_list_player_t *p_player = libvlc_media_list_player_new(p_instance); // <------ fails here
libvlc_media_list_player_release(p_player);
libvlc_release(p_instance);
}
The failure that is reported:
test: media_list_player.c:110: assert_locked: Assertion `vlc_mutex_marked(&p_mlp->mp_callback_lock)' failed.
This is the code around line 110:
static inline void assert_locked(libvlc_media_list_player_t * p_mlp)
{
vlc_mutex_assert(&p_mlp->mp_callback_lock); <-----
(void) p_mlp;
}
This is called from libvlc_media_list_player_new, which eventually calls:
static void
install_media_player_observer(libvlc_media_list_player_t * p_mlp)
{
assert_locked(p_mlp); <-----
libvlc_event_attach(mplayer_em(p_mlp), libvlc_MediaPlayerEndReached, media_player_reached_end, p_mlp);
}
I most recently tested this against the VLC master git at d45268d2, although this problem has been around longer than that (I'm sorry I don't recall the first time I noticed this).
OS: Linux 4.15.0-45-generic 48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
I completely understand that the master git is undergoing continuing development, and that things might not work from time to time.