摄像头播放后,增加分辨率的显示
This commit is contained in:
@@ -683,4 +683,14 @@ public abstract class BaseVideoSource : IVideoSource, IAsyncDisposable, IDeviceC
|
||||
public FrameController Controller { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
// 自动从 SmartFrame 中提取
|
||||
public int Width { get; protected set; }
|
||||
public int Height { get; protected set; }
|
||||
|
||||
public void ClearAuditLogs()
|
||||
{
|
||||
_auditLogs.Clear();
|
||||
AddAuditLog("用户清空了审计日志");
|
||||
}
|
||||
}
|
||||
@@ -295,6 +295,17 @@ public class HikVideoSource : BaseVideoSource
|
||||
|
||||
private void SafeOnDecodingCallBack(int nPort, IntPtr pBuf, int nSize, ref HikPlayMethods.FRAME_INFO pFrameInfo, int nReserved1, int nReserved2)
|
||||
{
|
||||
// [优化] 维持心跳,防止被哨兵误杀
|
||||
MarkFrameReceived(0);
|
||||
|
||||
// [新增] 捕获并更新分辨率
|
||||
// 只有当分辨率发生变化时才写入,减少属性赋值开销
|
||||
if (Width != pFrameInfo.nWidth || Height != pFrameInfo.nHeight)
|
||||
{
|
||||
Width = pFrameInfo.nWidth;
|
||||
Height = pFrameInfo.nHeight;
|
||||
}
|
||||
|
||||
// 1. [核心流控] 询问基类控制器:这帧要不要?
|
||||
// 之前失效是因为操作的是子类被遮蔽的 Controller,现在复用基类 Controller,逻辑就通了。
|
||||
// 传入真实的输入帧率作为参考基准
|
||||
@@ -303,9 +314,6 @@ public class HikVideoSource : BaseVideoSource
|
||||
// 如果没人要,直接丢弃,不进行 Mat 转换,节省 CPU
|
||||
if (!decision.IsCaptured) return;
|
||||
|
||||
// [优化] 维持心跳,防止被哨兵误杀
|
||||
MarkFrameReceived(0);
|
||||
|
||||
int width = pFrameInfo.nWidth;
|
||||
int height = pFrameInfo.nHeight;
|
||||
|
||||
@@ -348,7 +356,8 @@ public class HikVideoSource : BaseVideoSource
|
||||
}
|
||||
finally
|
||||
{
|
||||
smartFrame.Dispose();
|
||||
if (smartFrame != null)
|
||||
smartFrame.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user