Vlc.DotNet.Wpf连续播放RTSP问题

 多次不间断调用播放方法时,程序崩溃。

应该是解码时占用过多内存导致。

请问有没有办法解决此问题?

贴出代码:

private void PlayVideo(string uri)
{
    if (string.IsNullOrEmpty(uri)) return;
    //如果已经实例化vlc控件,则直接播放
    if (m_vlcControl != null && m_vlcControl.SourceProvider.MediaPlayer != null)
    {
        m_vlcControl.SourceProvider.MediaPlayer.Play(new Uri(uri));
        return;
    }

    this.m_vlcControl?.Dispose();
    this.m_vlcControl = new VlcControl();
    this.m_view.ControlContainer.Content = this.m_vlcControl;
    string appPath = AppDomain.CurrentDomain.BaseDirectory; //获取输出目录
    m_vlcDirectory = new DirectoryInfo(Path.Combine(appPath, "VLC"));//vlc文件的地址
    this.m_vlcControl.SourceProvider.CreatePlayer(this.m_vlcDirectory);
	
    if (m_vlcControl.SourceProvider.MediaPlayer != null)
    {
        //错误处理
        m_vlcControl.SourceProvider.MediaPlayer.EncounteredError += (sender, e) =>
        {
			MessageBox.Show("播放异常");
        };
        m_vlcControl.SourceProvider.MediaPlayer.Log += (sender, e) =>
        {
            System.Diagnostics.Debug.WriteLine("视频播放:" + e.Message);
        };
        m_vlcControl.SourceProvider.MediaPlayer.Play(new Uri(uri));
    }
}

 

 

请问解决了吗?我也碰到了

请问找到解决方法了吗?