Segmentation fault on Windows with libvlc_media_player_stop if video adjustments are enabled
This LibVLC example causes a segmentation fault when invoking libvlc_media_player_stop
if libvlc_video_set_adjust_int
is used to enable video adjustments.
#include <stdio.h>
#include <windows.h>
#include "libvlc.h"
#include "libvlc_media.h"
#include "libvlc_renderer_discoverer.h"
#include "libvlc_media_player.h"
#define CRASH
int main(int argc, const char** argv) {
if (argc != 2) {
printf("Specify an MRL\n");
return -1;
}
printf("Test...\n");
fflush(stdout);
libvlc_instance_t* p_inst = libvlc_new(0, NULL);
if (!p_inst) {
printf("No instance\n");
goto cleanup;
}
libvlc_media_player_t* p_mp = libvlc_media_player_new(p_inst);
if (!p_mp) {
printf("No media player\n");
goto cleanup;
}
libvlc_media_t* p_md = libvlc_media_new_path(p_inst, argv[1]);
if (!p_md) {
printf("No media\n");
goto cleanup;
}
libvlc_media_player_set_media(p_mp, p_md);
#ifdef CRASH
printf("Crash mode!\n");
fflush(stdout);
libvlc_video_set_adjust_int(p_mp, libvlc_adjust_Enable, 1);
#endif
printf("Playing...\n");
libvlc_media_player_play(p_mp);
Sleep(3000);
libvlc_media_player_stop(p_mp);
printf("Stopped.\n");
cleanup:
if (p_md) {
libvlc_media_release(p_md);
}
if (p_mp) {
libvlc_media_player_release(p_mp);
}
if (p_inst) {
libvlc_release(p_inst);
}
return 0;
}
A run without the crash, the h264
output appears after invoking stop, but in any case there is no crash:
Test...
[00000254a7b8a6f0] avcodec decoder: Using D3D11VA (Intel(R) Iris(R) Xe Graphics, vendor 8086(Intel), device 9a49, revision 1) for hardware decoding
[h264 @ 00000254a7bd4a40] get_buffer() failed
[h264 @ 00000254a7bd4a40] thread_get_buffer() failed
[h264 @ 00000254a7bd4a40] decode_slice_header error
[h264 @ 00000254a7bd4a40] no frame!
[h264 @ 00000254a7bd51c0] get_buffer() failed
[h264 @ 00000254a7bd51c0] thread_get_buffer() failed
[h264 @ 00000254a7bd51c0] decode_slice_header error
[h264 @ 00000254a7bd51c0] no frame!
[00000254a8f47630] direct3d11 vout display error: SetThumbNailClip failed: 0x800706f4
Playing...
Stopped.
A run with the crash code enabled:
Test...
Crash mode!
Segmentation fault
Versions:
VLC 3.0.21 Windows 11 24H2 Pro 64-bit