fix: 修复摄像头无法正常启动,以及关闭摄像头会导致后端崩溃的问题

This commit is contained in:
2025-08-18 19:14:02 +08:00
parent 7265b10870
commit 1b5b0e28e3
8 changed files with 640 additions and 75 deletions

View File

@@ -6,6 +6,8 @@ public sealed class MsgBus
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
// private static RtspStreamService _rtspStreamService = new RtspStreamService(new UsbCameraCapture());
private static readonly UDPServer udpServer = new UDPServer(1234, 12);
/// <summary>
/// 获取UDP服务器
@@ -49,7 +51,7 @@ public sealed class MsgBus
/// 通信总线初始化
/// </summary>
/// <returns>无</returns>
public static void Init()
public static async void Init()
{
if (!ArpClient.IsAdministrator())
{
@@ -57,6 +59,10 @@ public sealed class MsgBus
// throw new Exception($"非管理员运行ARP无法更新请用管理员权限运行");
}
udpServer.Start();
// _rtspStreamService.ConfigureVideo(1920, 1080, 30);
// await _rtspStreamService.StartAsync();
isRunning = true;
}