mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 05:31:15 +00:00
libs: surface: add pointer check for surface_new_from_formats.
The command line: gst-launch-1.0 filesrc location=some_name.mjpeg ! jpegparse ! vaapijpegdec ! videoconvert ! video/x-raw,format=I420 ! vaapisink will crash on i965 driver because of no pointer check. We now generate the video format map between GST format and VA format dynamically based on the image format returned by vaQueryImageFormats. i965 driver does to report image format of 444P and Y800 forcc, while the jpeg decoder context VASurfaceAttribPixelFormat use them. We can not recognize these format and pass a NULL pointer to gst_vaapi_surface_new_from_formats. We need to add a pointer check here and let the fallback logic handle this case correctly. Other drivers work well.
This commit is contained in:
parent
8d8743a494
commit
5168611f55
1 changed files with 6 additions and 4 deletions
|
@ -327,10 +327,12 @@ gst_vaapi_surface_new_from_formats (GstVaapiDisplay * display,
|
|||
GstVaapiSurface *surface;
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < formats->len; i++) {
|
||||
GstVideoFormat format = g_array_index (formats, GstVideoFormat, i);
|
||||
if (format == gst_vaapi_video_format_from_chroma (chroma_type))
|
||||
return gst_vaapi_surface_new (display, chroma_type, width, height);
|
||||
if (formats) {
|
||||
for (i = 0; i < formats->len; i++) {
|
||||
GstVideoFormat format = g_array_index (formats, GstVideoFormat, i);
|
||||
if (format == gst_vaapi_video_format_from_chroma (chroma_type))
|
||||
return gst_vaapi_surface_new (display, chroma_type, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
/* Fallback: if there's no format valid for the chroma type let's
|
||||
|
|
Loading…
Reference in a new issue