VLC player crashes observed sometimes during pause at very end and auto stop of player triggers
Summary
VLC player crashes observed sometimes during pause at very end and auto stop of player triggers
Minimal project and steps to reproduce
- Open the file file in media player
- Start playing and pause before end (less than 1 sec)
- Player triggers auto stop. we call mediaplayer.stop() method to clear data
- The application crashes some times.
- please refer attached logs for details.
Code snippet
//Initialization code---
_libVLC = new LibVLC(new string[] { "--no-snapshot-preview", "--no-osd", "--avcodec-hw=d3d11va", "--no-video-title", "--no-audio" });
_mediaPlayer = new MediaPlayer(_libVLC);
_mediaPlayer.EnableHardwareDecoding = true;
_mediaPlayerRecord = new MediaPlayer(_libVLC);
_mediaPlayerRecord.EnableHardwareDecoding = true;
Capture snippet
//Capture code
private void StartVideoRecording()
{
string dshowfps = $":dshow-fps=30";
using (Media _recordMedia = new Media(_libVLC, "dshow://", FromType.FromLocation))
{
_recordMedia.AddOption($":dshow-vdev=Virtual Camera");
{
// diff
_recordMedia.AddOption(dshowfps);
}
List<string> options = Win32Utils.ParseStringOptions(":no-audio|:live-caching=1|:dshow-size=1280x1024|:dshow-aspect-ratio=5:4|:dshow-adev=none|:avcodec-hw=d3d11va", new char[] { '|' });
if (options == null || options.Count == 0)
{
sLogger.Log($"Record option: No Media Options added", Category.Warn);
}
else
{
foreach (string item in options)
{
_recordMedia.AddOption(item);
sLogger.Log($"Record option: {item} added", Category.Debug);
}
}
string destination = Path.Combine(AssemblyDirectory, "AttemptVideo_1.mp4");
string transcode = ":sout=#transcode{{venc=x264{{keyint=10}},vcodec=h264,vb=1500,fps=30,scale=0,acodec=none,ab=128,channels=2,threads=4,high-priority=true}}:std{{access=file,dst=c:\\temp\\AttemptVideo_1.mp4,mux=ts}}";
sLogger.Log($"Record option: {transcode} added", Category.Debug);
_recordMedia.AddOption(transcode);
if (!_mediaPlayerRecord.Play(_recordMedia))
{
MessageBox.Show("Error in Recording...");
}
_mediaPlayerRecord.Playing += _mediaPlayerRecord_Playing;
}
}
private void _mediaPlayerRecord_Playing(object sender, EventArgs e)
{
StartVideoPreview();
_mediaPlayerRecord.Playing -= _mediaPlayerRecord_Playing;
}
private bool StartVideoPreview()
{
bool bResult = false;
if (this._VideoParameters == null)
return bResult;
string dshowfps = $":dshow-fps=30";
// For Capture live feed from Camera device
using (Media _previewMedia = new Media(_libVLC, "dshow://", FromType.FromLocation))
{
_previewMedia.AddOption($":dshow-vdev=Virtual Camera");
{
// diff
_previewMedia.AddOption(dshowfps);
}
List<string> options = Win32Utils.ParseStringOptions(":no-audio|:live-caching=1|:dshow-size=1280x1024|:dshow-aspect-ratio=5:4|:dshow-adev=none|:avcodec-hw=d3d11va", new char[] { '|' });
if (options == null || options.Count == 0)
{
sLogger.Log($"Preview option: No Media Options added", Category.Warn);
}
else
{
foreach (string item in options)
{
_previewMedia.AddOption(item);
sLogger.Log($"Preview option: {item} added", Category.Debug);
}
}
if (!_mediaPlayer.Play(_previewMedia))
{
MessageBox.Show("Error in Previewing...");
}
}
bResult = true;
return bResult;
}
Playback snippet
//Playback code----
string inVideoOutputPath = Path.Combine(AssemblyDirectory, "AttemptVideo_1.mp4");
if (!_mediaPlayer.IsPlaying)
{
using (var media = new Media(_libVLC, new Uri(inVideoOutputPath)))
{
List<string> options = Win32Utils.ParseStringOptions(":file-caching=300|:avcodec-fast|:no-avcodec-corrupted");
if (options == null || options.Count == 0)
{
sLogger.Log($"Playback option: No Media Options added", Category.Warn);
}
else
{
foreach (string item in options)
{
media.AddOption(item);
sLogger.Log($"Playback option: {item} added", Category.Debug);
}
}
if (!_mediaPlayer.Play(media))
{
MessageBox.Show("Error in Playing...");
}
}
}
What is the current bug behavior?
VLC player crashes observed sometimes during pause at very end and auto stop of player triggers
What is the expected correct behavior?
VLC player should not crash during pause at very end and auto stop of player triggers
Does it work on other plaforms? Does it work with the official VLC apps?
NA
Refer attached log link for details: search for [Framework.Application.Presentation.VLCWrapper] for VLC related logs https://www.dropbox.com/s/svegth15iw7ei64/ClientLog_25-Oct-2021.txt?dl=0
Relevant logs and/or screenshots
Environment
versions info------------ OS: Windows 64 bit Version Win10, Device: Virtual Camera LibVLC version and architecture 3.0.11.0 LibVLCSharp version 3.4.9.0 LibVLCSharp.WPF 3.4.9.0
- OS:
- Version
- Device:
- LibVLC version and architecture
- LibVLCSharp version