Browse Source

Fixed Bug:0011866: 【新魔盒】【超声直播】RTMP+分流+双路画面,直播时拔掉摄像头后刷新配置页面,重新插入摄像头开启摄像头直播,不显示摄像头的预览画面

felix 2 years ago
parent
commit
4b6d8d3d0c

+ 16 - 13
Vinno.FIS.TRTCClient/Captures/Capturer.cs

@@ -182,20 +182,23 @@ namespace Vinno.FIS.TRTCClient.Captures
             {
                 lock (_lock)
                 {
-                    _isCapturing = false;
-                    if (_directShowCapture != null)
-                    {
-                        _directShowCapture.ImageFrameReceived -= OnImageFrameReceived;
-                        _directShowCapture.StopCapture();
-                        _directShowCapture.Dispose();
-                        _directShowCapture = null;
-                    }
-                    if (_aForgeCapturer != null)
+                    if (_isCapturing)
                     {
-                        _aForgeCapturer.ImageFrameReceived -= OnImageFrameReceived;
-                        _aForgeCapturer.StopCapture();
-                        _aForgeCapturer.Dispose();
-                        _aForgeCapturer = null;
+                        _isCapturing = false;
+                        if (_directShowCapture != null)
+                        {
+                            _directShowCapture.ImageFrameReceived -= OnImageFrameReceived;
+                            _directShowCapture.StopCapture();
+                            _directShowCapture.Dispose();
+                            _directShowCapture = null;
+                        }
+                        if (_aForgeCapturer != null)
+                        {
+                            _aForgeCapturer.ImageFrameReceived -= OnImageFrameReceived;
+                            _aForgeCapturer.StopCapture();
+                            _aForgeCapturer.Dispose();
+                            _aForgeCapturer = null;
+                        }
                     }
                 }
             }

+ 1 - 0
Vinno.FIS.TRTCClient/ImageSender/CameraImageSenderV2.cs

@@ -203,6 +203,7 @@ namespace Vinno.FIS.TRTCClient.ImageSender
         {
             _cameraCapture.ImageFrameReceived -= OnImageFrameReceived;
             _cameraCapture.StopCapture();
+            _cameraCapture.Dispose();
             StopPreviewImageThread();
             IsRunning = false;
         }

+ 16 - 13
Vinno.vCloud.FIS.CrossPlatform.Windows/LiveVideo/Capturer.cs

@@ -186,20 +186,23 @@ namespace Vinno.vCloud.FIS.CrossPlatform.Windows.LiveVideo
             {
                 lock (_lock)
                 {
-                    _isCapturing = false;
-                    if (_directShowCapture != null)
-                    {
-                        _directShowCapture.ImageFrameReceived -= OnImageFrameReceived;
-                        _directShowCapture.StopCapture();
-                        _directShowCapture.Dispose();
-                        _directShowCapture = null;
-                    }
-                    if (_aForgeCapturer != null)
+                    if (_isCapturing)
                     {
-                        _aForgeCapturer.ImageFrameReceived -= OnImageFrameReceived;
-                        _aForgeCapturer.StopCapture();
-                        _aForgeCapturer.Dispose();
-                        _aForgeCapturer = null;
+                        _isCapturing = false;
+                        if (_directShowCapture != null)
+                        {
+                            _directShowCapture.ImageFrameReceived -= OnImageFrameReceived;
+                            _directShowCapture.StopCapture();
+                            _directShowCapture.Dispose();
+                            _directShowCapture = null;
+                        }
+                        if (_aForgeCapturer != null)
+                        {
+                            _aForgeCapturer.ImageFrameReceived -= OnImageFrameReceived;
+                            _aForgeCapturer.StopCapture();
+                            _aForgeCapturer.Dispose();
+                            _aForgeCapturer = null;
+                        }
                     }
                 }
             }

+ 1 - 0
Vinno.vCloud.FIS.CrossPlatform.Windows/LiveVideo/MergePusherBase.cs

@@ -123,6 +123,7 @@ namespace Vinno.vCloud.FIS.CrossPlatform.Windows.LiveVideo
             {
                 capture.ImageFrameReceived -= OnImageReceived;
                 capture.StopCapture();
+                capture.Dispose();
             }
             _captures.Clear();
         }

+ 1 - 0
Vinno.vCloud.FIS.CrossPlatform.Windows/LiveVideo/MergePusherBaseV2.cs

@@ -117,6 +117,7 @@ namespace Vinno.vCloud.FIS.CrossPlatform.Windows.LiveVideo
             {
                 capture.ImageFrameReceived -= OnImageReceived;
                 capture.StopCapture();
+                capture.Dispose();
             }
             _captures.Clear();
         }

+ 1 - 0
Vinno.vCloud.FIS.CrossPlatform.Windows/LiveVideo/RTC/CameraImageSenderV2.cs

@@ -196,6 +196,7 @@ namespace Vinno.vCloud.FIS.CrossPlatform.Windows.LiveVideo.RTC
         {
             _cameraCapture.ImageFrameReceived -= OnImageFrameReceived;
             _cameraCapture.StopCapture();
+            _cameraCapture.Dispose();
             StopPreviewImageThread();
             IsRunning = false;
         }

+ 1 - 0
Vinno.vCloud.FIS.CrossPlatform.Windows/LiveVideo/RTC/TerminalImageSenderV2.cs

@@ -76,6 +76,7 @@ namespace Vinno.vCloud.FIS.CrossPlatform.Windows.LiveVideo.RTC
         {
             _terminalImageCapture.VideoFrameDataReceived -= OnVideoFrameDataReceived;
             _terminalImageCapture.StopCapture();
+            _terminalImageCapture.Dispose();
             IsRunning = false;
         }
     }

+ 2 - 0
Vinno.vCloud.FIS.CrossPlatform.Windows/LiveVideo/RTMP/DsRtmpPusher.cs

@@ -59,6 +59,8 @@ namespace Vinno.vCloud.FIS.CrossPlatform.Windows.LiveVideo.RTMP
             {
                 _pusher.StopPush();
                 _capture.StopCapture();
+                _capture.Dispose();
+                _capture = null;
                 _isPushing = false;
             }
         }

+ 2 - 0
Vinno.vCloud.FIS.CrossPlatform.Windows/LiveVideo/RTMP/USDsRtmpPusher.cs

@@ -83,6 +83,8 @@ namespace Vinno.vCloud.FIS.CrossPlatform.Windows.LiveVideo.RTMP
             if (IsCapturing)
             {
                 _capture.StopCapture();
+                _capture.Dispose();
+                _capture = null;
                 IsCapturing = false;
             }
             if (IsPushing)

+ 1 - 0
Vinno.vCloud.FIS.CrossPlatform.Windows/LiveVideo/RTMP/USMergePusherBase.cs

@@ -130,6 +130,7 @@ namespace Vinno.vCloud.FIS.CrossPlatform.Windows.LiveVideo.RTMP
             {
                 capture.ImageFrameReceived -= OnImageReceived;
                 capture.StopCapture();
+                capture.Dispose();
             }
             base.StopPreview();
             _captures.Clear();

+ 1 - 0
Vinno.vCloud.FIS.CrossPlatform.Windows/LiveVideo/USMergePusherBaseV2.cs

@@ -117,6 +117,7 @@ namespace Vinno.vCloud.FIS.CrossPlatform.Windows.LiveVideo
             {
                 capture.ImageFrameReceived -= OnImageReceived;
                 capture.StopCapture();
+                capture.Dispose();
             }
             _captures.Clear();
         }