From ff9157eef471ebf0c2d3f8ed2b89a78b8cb124ab Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Wed, 12 Aug 2020 17:02:31 +0900 Subject: [PATCH] d3d11: Selected adapter index should be unsigned integer If d3d11device was created successfully, the index of adapter must not be negative value Part-of: --- sys/d3d11/gstd3d11utils.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/d3d11/gstd3d11utils.c b/sys/d3d11/gstd3d11utils.c index 6cf9a77dea..bffe6e0dfe 100644 --- a/sys/d3d11/gstd3d11utils.c +++ b/sys/d3d11/gstd3d11utils.c @@ -73,7 +73,7 @@ gst_d3d11_handle_set_context (GstElement * element, GstContext * context, if (g_strcmp0 (context_type, GST_D3D11_DEVICE_HANDLE_CONTEXT_TYPE) == 0) { const GstStructure *str; GstD3D11Device *other_device = NULL; - gint other_adapter = 0; + guint other_adapter = 0; /* If we had device already, will not replace it */ if (*device) @@ -82,8 +82,8 @@ gst_d3d11_handle_set_context (GstElement * element, GstContext * context, str = gst_context_get_structure (context); if (gst_structure_get (str, "device", GST_TYPE_D3D11_DEVICE, - &other_device, "adapter", G_TYPE_INT, &other_adapter, NULL)) { - if (adapter == -1 || adapter == other_adapter) { + &other_device, "adapter", G_TYPE_UINT, &other_adapter, NULL)) { + if (adapter == -1 || (guint) adapter == other_adapter) { GST_CAT_DEBUG_OBJECT (GST_CAT_CONTEXT, element, "Found D3D11 device context"); *device = other_device; @@ -102,7 +102,7 @@ static void context_set_d3d11_device (GstContext * context, GstD3D11Device * device) { GstStructure *s; - gint adapter; + guint adapter; g_return_if_fail (context != NULL); @@ -115,7 +115,7 @@ context_set_d3d11_device (GstContext * context, GstD3D11Device * device) s = gst_context_writable_structure (context); gst_structure_set (s, "device", GST_TYPE_D3D11_DEVICE, - device, "adapter", G_TYPE_INT, adapter, NULL); + device, "adapter", G_TYPE_UINT, adapter, NULL); } /**