vaapi: libs: video-format: Check if formats map is not NULL.
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Sun, 30 Jan 2022 06:10:09 +0000 (07:10 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 31 Jan 2022 13:33:31 +0000 (13:33 +0000)
commit2fc4e928d6b0440f666f901b6ebef43b9199d9e0
tree41f393f63515e96995d2a70f17e0eaa6f6608294
parentfb1c0626268e7bb4651795bf5651c4c7ea1306d2
vaapi: libs: video-format: Check if formats map is not NULL.

Formats map is instantiated at the end of the display
instantiation. The problem is the Wayland display which looks for a
format in a callback, before the map is populated.

If user compiles gstreamer-vaapi with DRM support, the map is
populated with a DRM display at GStreamer plugin registration. But if
not, or a VA driver is not available, the plugin will try with a
Wayland driver, which cause the NULL de-reference.

Nevertheless, in the case of no DRM support, and if the Wayland
display doesn't get a reply from the format conversion is not a
problem.

So the solution is the trivial one, check if the format map is already
populated before de-reference it.

Fixes: #977
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1606>
subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/video-format.c