[vlc-devel] libvlc crashes on Windows when an application call libvlc_media_player_stop()

Ori Pessach mail at oripessach.com
Wed Apr 24 16:21:32 CEST 2019

I've seen this in every version of libvlc I tested since 3.0.1, including
3.0.6. I tried the Win32 and Win64 builds, and both seem to have the same

I have an application that displays multiple RTSP streams, and it
occasionally crashes when calling libvlc_media_player_stop(). Here's the

Thread 1397 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 9080.0x1904]
av_buffer_unref (buf=buf at entry=0x1b7e804c2c0) at libavutil/buffer.c:130
130     libavutil/buffer.c: No such file or directory.
(gdb) bt
#0  av_buffer_unref (buf=buf at entry=0x1b7e804c2c0) at libavutil/buffer.c:130
#1  0x00007ffcfc2f733b in ff_dxva2_decode_uninit (avctx=<optimized out>) at
#2  0x00007ffcfc433a32 in avcodec_close (avctx=avctx at entry=0x1b785586a80)
at libavcodec/utils.c:1171
#3  0x00007ffcfbd10799 in avcodec_free_context (pavctx=0x60d29f288) at
#4  0x00007ffcfb8b4e9c in EndVideoDec (obj=<optimized out>) at
#5  0x00007ffd066a803a in vlc_module_unload (obj=obj at entry=0x1b7a417ba00,
module=<optimized out>,
    deinit=deinit at entry=0x7ffd066a76f0 <generic_stop>) at
#6  0x00007ffd066a8105 in module_unneed (obj=obj at entry=0x1b7a417ba00,
module=<optimized out>)
    at ../../extras/package/win32/../../../src/modules/modules.c:378
#7  0x00007ffd066c48c6 in UnloadDecoder (p_dec=p_dec at entry=0x1b7a417ba00)
at ../../extras/package/win32/../../../src/input/decoder.c:201
#8  0x00007ffd066c5233 in DeleteDecoder (p_dec=0x1b7a417ba00) at
#9  0x00007ffd066c885a in input_DecoderDelete (p_dec=<optimized out>) at
#10 0x00007ffd066caac9 in EsDestroyDecoder (p_es=<optimized out>,
p_es=<optimized out>, out=0x1b7c2031fe0)
    at ../../extras/package/win32/../../../src/input/es_out.c:1713
#11 0x00007ffd066cc0f1 in EsUnselect (out=out at entry=0x1b7c2031fe0,
es=0x1b7f241baa0, b_update=<optimized out>)
    at ../../extras/package/win32/../../../src/input/es_out.c:1841
#12 0x00007ffd066cf565 in EsOutControlLocked (args=<optimized out>,
i_query=<optimized out>, out=0x1b7c2031fe0)
    at ../../extras/package/win32/../../../src/input/es_out.c:2323
#13 EsOutControl (out=0x1b7c2031fe0, i_query=<optimized out>,
args=<optimized out>)
    at ../../extras/package/win32/../../../src/input/es_out.c:2900
#14 0x00007ffd066d1cb3 in es_out_vaControl (args=0x60d29f620 "",
i_query=<optimized out>, out=<optimized out>)
    at ../../extras/package/win32/../../../include/vlc_es_out.h:141
#15 es_out_Control (out=<optimized out>, i_query=<optimized out>) at
#16 0x00007ffd066d372e in ControlLocked (args=<optimized out>,
i_query=<optimized out>, p_out=<optimized out>)
    at ../../extras/package/win32/../../../src/input/es_out_timeshift.c:664
#17 Control (p_out=<optimized out>, i_query=<optimized out>,
args=<optimized out>)
    at ../../extras/package/win32/../../../src/input/es_out_timeshift.c:764
#18 0x00007ffd066d5383 in es_out_vaControl (args=0x60d29f740 "",
i_query=65536, out=<optimized out>)
    at ../../extras/package/win32/../../../include/vlc_es_out.h:141
#19 es_out_Control (out=<optimized out>, i_query=i_query at entry=65536) at
#20 0x00007ffd066d5fab in es_out_SetMode (i_mode=0, p_out=<optimized out>)
at ../../extras/package/win32/../../../src/input/es_out.h:95
#21 End (p_input=p_input at entry=0x1b79d4b85e0) at
#22 0x00007ffd066dd9ab in Run (data=0x1b79d4b85e0) at
#23 0x00007ffd0672a516 in vlc_entry (p=0x1b79163b6d0) at
#24 0x00007ffd3601aa96 in msvcrt!_beginthreadex () from
#25 0x00007ffd3601ab6c in msvcrt!_endthreadex () from
#26 0x00007ffd357e4034 in KERNEL32!BaseThreadInitThunk () from
#27 0x00007ffd383b3691 in ntdll!RtlUserThreadStart () from
#28 0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

I was able to work around this by patching the libavcodec_plugin code to
effectively disable hardware acceleration, but due to the number of RTSP
streams that the application needs to support, this isn't an ideal

I'm able to reproduce this problem with the attached program. It might seem
long, but most of the code is just Windows boilerplate. The interesting bit
is in the RunTests() function, which isn't very long.

By the way, the Win64 debug symbols that are available for download on
videolan.org don't seem to match the released code... I had to recompile
VLC myself to be able to get a stack trace from gdb.

I can make the entire Visual Studio project available if it's necessary,
but I didn't want to send binary files to the mailing list.

Any ideas what's going on here?


Ori Pessach
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190424/94fc25ae/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vlc-crash.cpp
Type: application/octet-stream
Size: 7526 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190424/94fc25ae/attachment.obj>

More information about the vlc-devel mailing list