mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2026-02-06 11:27:19 +00:00
VNC-151 Fix hw_ctx_guard reset placement to ensure proper resource management
This commit is contained in:
parent
3e166ede41
commit
4818d96499
@ -79,10 +79,10 @@ namespace rfb::video_encoders {
|
||||
|
||||
FFmpeg::BufferGuard hw_ctx_guard;
|
||||
AVBufferRef *hw_ctx{};
|
||||
hw_ctx_guard.reset(hw_ctx);
|
||||
|
||||
if (dri_node) {
|
||||
const auto err = ffmpeg.av_hwdevice_ctx_create(&hw_ctx, encoder_candidate.hw_type, dri_node, nullptr, 0);
|
||||
hw_ctx_guard.reset(hw_ctx);
|
||||
if (err == 0) {
|
||||
drm_device_path = dri_node;
|
||||
result.push_back(encoder_candidate.encoder);
|
||||
@ -93,6 +93,7 @@ namespace rfb::video_encoders {
|
||||
vlog.debug("Trying to open all DRM devices");
|
||||
for (const auto *drm_dev_path: drm_device_paths) {
|
||||
const auto err = ffmpeg.av_hwdevice_ctx_create(&hw_ctx, encoder_candidate.hw_type, drm_dev_path, nullptr, 0);
|
||||
hw_ctx_guard.reset(hw_ctx);
|
||||
if (err < 0) {
|
||||
vlog.error("%s", ffmpeg.get_error_description(err).c_str());
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user