修复 Bug
This commit is contained in:
@@ -276,12 +276,28 @@ public class CameraManager : IDisposable, IAsyncDisposable
|
||||
// B. 在线应用策略
|
||||
if (device.IsActived)
|
||||
{
|
||||
var options = new DynamicStreamOptions
|
||||
// Optimized: 仅构造真正发生变化的参数
|
||||
var options = new DynamicStreamOptions();
|
||||
|
||||
// 判定码流是否真的变了(或者 DTO 明确传了新值)
|
||||
if (dto.StreamType.HasValue && dto.StreamType != oldConfig.StreamType)
|
||||
{
|
||||
StreamType = dto.StreamType ?? newConfig.StreamType,
|
||||
RenderHandle = (IntPtr)dto.RenderHandle
|
||||
};
|
||||
device.ApplyOptions(options);
|
||||
options.StreamType = dto.StreamType.Value;
|
||||
}
|
||||
|
||||
// 判定句柄是否真的变了
|
||||
// Modified: 只有当 DTO 的句柄与旧配置不一致时,才放入 options
|
||||
if (dto.RenderHandle != oldConfig.RenderHandle)
|
||||
{
|
||||
options.RenderHandle = (IntPtr)dto.RenderHandle;
|
||||
}
|
||||
|
||||
// 只有当至少有一个参数需要更新时,才调用底层
|
||||
// 假设 DynamicStreamOptions 内部有检测是否有值的方法,或者判断其属性
|
||||
if (options.StreamType.HasValue || options.RenderHandle.HasValue)
|
||||
{
|
||||
device.ApplyOptions(options);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user