From 7d197c4c23acb0c809784e241848b7905ea8f989 Mon Sep 17 00:00:00 2001 From: Aryan Salmanpour Date: Tue, 26 Mar 2024 11:40:59 -0400 Subject: [PATCH] modify the condition of using visble_devices by making sure that the requsted device id is valid (#295) [ROCm/rocdecode commit: 4d5497eec801af2421953f9f026b771e2af60e80] --- projects/rocdecode/src/rocdecode/vaapi/vaapi_videodecoder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/rocdecode/src/rocdecode/vaapi/vaapi_videodecoder.cpp b/projects/rocdecode/src/rocdecode/vaapi/vaapi_videodecoder.cpp index 16f116db7c..d88023ca79 100644 --- a/projects/rocdecode/src/rocdecode/vaapi/vaapi_videodecoder.cpp +++ b/projects/rocdecode/src/rocdecode/vaapi/vaapi_videodecoder.cpp @@ -80,7 +80,7 @@ rocDecStatus VaapiVideoDecoder::InitializeDecoder(std::string gcn_arch_name) { std::vector visible_devices; GetVisibleDevices(visible_devices); std::string drm_node; - if (visible_devices.size() != 0) { + if (decoder_create_info_.device_id < visible_devices.size()) { drm_node = "/dev/dri/renderD" + std::to_string(128 + visible_devices[decoder_create_info_.device_id] * num_render_cards_per_device); } else { drm_node = "/dev/dri/renderD" + std::to_string(128 + decoder_create_info_.device_id * num_render_cards_per_device);