fix: 配置摄像头必须初始化
This commit is contained in:
parent
558a139593
commit
540f5c788d
|
@ -165,18 +165,9 @@ public class HttpVideoStreamService : BackgroundService
|
|||
}
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
lock (_cameraLock)
|
||||
{
|
||||
// 如果地址和端口没有变化,直接返回成功
|
||||
if (_cameraAddress == address && _cameraPort == port && _camera != null)
|
||||
{
|
||||
logger.Info("摄像头配置未变化,保持当前连接");
|
||||
return;
|
||||
}
|
||||
|
||||
// 关闭现有连接
|
||||
if (_camera != null)
|
||||
{
|
||||
|
@ -210,7 +201,6 @@ public class HttpVideoStreamService : BackgroundService
|
|||
throw new Exception($"Camera Init Failed!");
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
Loading…
Reference in New Issue