ue4plugins / VlcMedia

Media Framework plug-in using the Video LAN Codec (libvlc).
BSD 3-Clause "New" or "Revised" License
267 stars 145 forks source link

Crash in VLC thread when stopping playback of network stream. #22

Closed Lirrec closed 6 years ago

Lirrec commented 8 years ago

Hi, I'm playing a rtp network stream in my unreal project. To allow playback of .sdp files I edited the list of allowed file extensions in the plugin ( since .sdp is not whitelisted ). I'm using Windows 10 64bit, UE 4.13 and the latest commit from this repository.

Playback itself works fine, however once i try to stop playback ( via the MediaPlayer stop blueprint node ) the vlcplugin crashes in a background thread. Other media files are mixed, some local files i tried work fine, others crash on playback.

EDIT: I tried a few more things, the crash only occurs if the stream contains mpeg4 video. h264/avc seems to work fine. Also playing the stream in both formats on my local vlc installation works fine, too.

The backtrace itself looks like this ( "unbekannt" = unknown ):

>   ntdll.dll!RtlReportCriticalFailure()    Unbekannt  
    ntdll.dll!RtlpHeapHandleError() Unbekannt
    ntdll.dll!RtlpLogHeapFailure()  Unbekannt   
    ntdll.dll!RtlFreeHeap() Unbekannt   
    msvcrt.dll!free()   Unbekannt
    libvlccore.dll!00007ffff087bc1b()   Unbekannt
    liblive555_plugin.dll!00007fffe16f1590()    Unbekannt
    libvlccore.dll!00007ffff08811b8()   Unbekannt
    libvlccore.dll!00007ffff083d6a1()   Unbekannt
    libvlccore.dll!00007ffff0848f9f()   Unbekannt
    libvlccore.dll!00007ffff084945f()   Unbekannt
    libvlccore.dll!00007ffff084f413()   Unbekannt
    libvlccore.dll!00007ffff089f066()   Unbekannt
    msvcrt.dll!_beginthreadex() Unbekannt
    msvcrt.dll!_endthreadex()   Unbekannt
    kernel32.dll!BaseThreadInitThunk()  Unbekannt
    ntdll.dll!RtlUserThreadStart()  Unbekannt

The exception thrown is:

Critical error detected c0000374
UE4Editor.exe hat einen Haltepunkt ausgelöst.

Ausnahme ausgelöst bei 0x00007FF83567E6FC (ntdll.dll) in UE4Editor.exe: 0xC0000374: Ein Heap wurde beschädigt (Parameter: 0x00007FF8356D22B0).
Ausnahmefehler bei 0x00007FF83567E6FC (ntdll.dll) in UE4Editor.exe: 0xC0000374: Ein Heap wurde beschädigt (Parameter: 0x00007FF8356D22B0)

The message is basically "heap corruption".

The game thread executing the blueprint function has the following backtrace:

    ntdll.dll!NtWaitForSingleObject()   Unbekannt
    KernelBase.dll!WaitForSingleObjectEx()  Unbekannt
    libvlccore.dll!00007ffff089f7e9()   Unbekannt
    libvlccore.dll!00007ffff084a050()   Unbekannt
    libvlc.dll!00007ffff15cb11d()   Unbekannt
>   UE4Editor-VlcMedia-Win64-DebugGame.dll!FVlcMediaPlayer::Close() Zeile 265   C++
    UE4Editor-CoreUObject.dll!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Zeile 4280 C++
    ...

Any ideas what could be going wrong? Interesting fact: if I ignore the exception in Visual Studio and continue two times the player will run fine afterwards, even if I stop and restart playback multiple times.

Are there any debug symbols for the compiled vlc binaries in this plugin available?

gmpreussner commented 8 years ago

Thanks for your post, Lirrec. I'm not sure why it's crashing. It will be difficult to figure out without resolving the symbols. Newer nightly builds of libvlc include versions with debug symbols. However, we cannot use them due to https://github.com/videolan/vlc/commit/c220ddc927d1a97f72a0c5bf86de56301e3483ad

Hopefully this will be resolved soon, then we can figure out what's going on.

gmpreussner commented 8 years ago

@Lirrec do you have a sample SDP stream that I can use for testing? I couldn't find any available streams online.

Lirrec commented 8 years ago

I don't have a stream available. I'm using a NAO Robot ( linux-based ) to stream audio and video from the robot via gstreamer-0.10 in my local network. I've posted my gstreamer commandline for streaming ( the stream format is RTP ) and the sdp-file i use to play the stream back here In theory the gstreamer command should work on any linux machine providing a webcam via v4l2 and an Alsa sound Source. There are 2 gotchas:

  1. Both the .sdp file and the gstreamer commandline have the IP-adresses of the client/server hardcoded
  2. I'm not entirely sure the stream and the according sdp file are correct ( i.e. the formats specified in the .sdp file match with the formats streamed via gstreamer), also gstreamer-0.10 is not the most up-to-date version.

If you have a linux machine with webcam/mic available, you should be able to recreate the stream. I can't provide you with an option for streaming from windows, sorry.

For now i'm using a h264 stream, so this is not a blocking issue for me.

gmpreussner commented 6 years ago

@Lirrec please try the latest version (4.19). I integrated VLC 4.0.0, which has improved streaming support. Let me know if the problem persists, thanks!

Lirrec commented 6 years ago

I'm afraid i'm no longer working on the project (it was a student project) and i don't have access to the hardware and setup anymore, sorry! I will close this issue, as i don't have any way of reproducing it anymore.