private async Task StopVideoStream()
        {
            if (VideoSource != null)
            {
                DoStopVideoStream();
                await VideoSource.Stop();

                VideoSource.Destroy();
                VideoSource = null;
            }
            if (VideoDepacketizer != null)
            {
                VideoDepacketizer.Destroy();
                VideoDepacketizer = null;
            }
            if (VideoDecoder != null)
            {
                VideoDecoder.Destroy();
                VideoDecoder = null;
            }
            if (ResetVideoPipe != null)
            {
                ResetVideoPipe.Destroy();
                ResetVideoPipe = null;
            }
            if (VideoConverter != null)
            {
                VideoConverter.Destroy();
                VideoConverter = null;
            }
            if (VideoEncoder != null)
            {
                VideoEncoder.Destroy();
                VideoEncoder = null;
            }
            if (VideoPacketizer != null)
            {
                VideoPacketizer.Destroy();
                VideoPacketizer = null;
            }
        }
 private Task StopVideoStream()
 {
     if (VideoDepacketizer != null)
     {
         VideoDepacketizer.Destroy();
         VideoDepacketizer = null;
     }
     if (VideoDecoder != null)
     {
         VideoDecoder.Destroy();
         VideoDecoder = null;
     }
     if (VideoConverter != null)
     {
         VideoConverter.Destroy();
         VideoConverter = null;
     }
     if (ResetVideoPipe != null)
     {
         ResetVideoPipe.Destroy();
         ResetVideoPipe = null;
     }
     if (VideoEncoder != null)
     {
         VideoEncoder.Destroy();
         VideoEncoder = null;
     }
     if (VideoPacketizer != null)
     {
         VideoPacketizer.Destroy();
         VideoPacketizer = null;
     }
     if (VideoSink != null)
     {
         VideoSink.Destroy();
         VideoSink = null;
     }
     return(Task.CompletedTask);
 }