修复 Bug
This commit is contained in:
@@ -158,7 +158,7 @@ public class HikVideoSource : BaseVideoSource,
|
||||
throw new CameraException(HikErrorMapper.Map(err), $"预览失败: {err}", DeviceBrand.HikVision, (int)err);
|
||||
}
|
||||
|
||||
_sdkLog.Debug($"[SDK] Hik 网络取流成功 => ID:{_config.Id} IP:{_config.IpAddress} Port:{_config.Port} Name:{_config.Name}, UserID: {_userId}");
|
||||
_sdkLog.Information($"[SDK] Hik 网络取流成功 => ID:{_config.Id} IP:{_config.IpAddress} Port:{_config.Port} Name:{_config.Name}, UserID: {_userId}");
|
||||
AddAuditLog($"[SDK] Hik 网络取流成功 => ID:{_config.Id} IP:{_config.IpAddress} Port:{_config.Port} Name:{_config.Name}, UserID: {_userId}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -506,7 +506,8 @@ public class HikVideoSource : BaseVideoSource,
|
||||
Cv2.CvtColor(rawYuvWrapper, smartFrame.InternalMat, ColorConversionCodes.YUV2BGR_YV12);
|
||||
}
|
||||
|
||||
smartFrame.SubscriberIds.AddRange(decision.TargetAppIds);
|
||||
foreach(var targetAppId in decision.TargetAppIds)
|
||||
smartFrame.SubscriberIds.Enqueue(targetAppId);
|
||||
|
||||
// =========================================================================
|
||||
// 【修正】删除这里的 GlobalStreamDispatcher.Dispatch!
|
||||
@@ -530,13 +531,10 @@ public class HikVideoSource : BaseVideoSource,
|
||||
}
|
||||
finally
|
||||
{
|
||||
// 【核心修复】
|
||||
// 只有当分发失败(异常)时,驱动层才负责回收。
|
||||
// 一旦分发成功,所有权属于 GlobalProcessingCenter,驱动层严禁 Dispose。
|
||||
if (!handoverSuccess && smartFrame != null)
|
||||
{
|
||||
smartFrame.Dispose();
|
||||
}
|
||||
// Optimized: [原因] 驱动层必须释放它持有的初始引用。
|
||||
// 如果 Dispatch 内部已经 AddRef,此处 Dispose 只会让计数从 2 降到 1,帧不会回池。
|
||||
// 如果没有其他人持有,此处 Dispose 会让计数从 1 降到 0,帧安全回池。
|
||||
smartFrame?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user