msdk: don't fall back to the default device
authorHaihao Xiang <haihao.xiang@intel.com>
Tue, 6 Apr 2021 04:03:32 +0000 (12:03 +0800)
committerHaihao Xiang <haihao.xiang@intel.com>
Tue, 13 Apr 2021 01:23:43 +0000 (01:23 +0000)
Ohterwise when user set a wrong device, the warning message doesn't get
printed if user doesn't set a right debug level in the environment, this
behavior might mislead user that the wrong device is being used.

This fixed https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1567

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2138>

sys/msdk/gstmsdkcontext.c

index df635c7..294b49e 100644 (file)
@@ -87,20 +87,19 @@ get_device_id (void)
       drmVersionPtr drm_version = drmGetVersion (fd);
 
       if (!drm_version || strncmp (drm_version->name, "i915", 4)) {
-        GST_WARNING ("The specified device isn't an Intel device, "
-            "use the default device instead");
+        GST_ERROR ("The specified device isn't an Intel device");
         drmFreeVersion (drm_version);
         close (fd);
         fd = -1;
       } else {
         GST_DEBUG ("Opened the specified drm device %s", user_choice);
         drmFreeVersion (drm_version);
-        return fd;
       }
     } else {
-      GST_WARNING ("The specified device isn't a valid drm device, "
-          "use the default device instead");
+      GST_ERROR ("The specified device isn't a valid drm device");
     }
+
+    return fd;
   }
 
   client = g_udev_client_new (NULL);