mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-09 19:09:41 +00:00
vaapidecode: always a valid format in decoded_info
Always set a valid format in decoded_info class variable. https://bugzilla.gnome.org/show_bug.cgi?id=764316
This commit is contained in:
parent
ade0c7bb43
commit
3e97d71935
1 changed files with 16 additions and 8 deletions
|
@ -355,7 +355,7 @@ is_surface_resolution_changed (GstVaapiDecode * decode,
|
||||||
GstVaapiSurface * surface)
|
GstVaapiSurface * surface)
|
||||||
{
|
{
|
||||||
GstVideoInfo *vinfo = &decode->decoded_info;
|
GstVideoInfo *vinfo = &decode->decoded_info;
|
||||||
GstVideoFormat format = GST_VIDEO_FORMAT_UNKNOWN;
|
GstVideoFormat surface_format;
|
||||||
guint surface_width, surface_height;
|
guint surface_width, surface_height;
|
||||||
|
|
||||||
g_return_val_if_fail (surface != NULL, FALSE);
|
g_return_val_if_fail (surface != NULL, FALSE);
|
||||||
|
@ -366,14 +366,22 @@ is_surface_resolution_changed (GstVaapiDecode * decode,
|
||||||
&& GST_VIDEO_INFO_HEIGHT (vinfo) == surface_height)
|
&& GST_VIDEO_INFO_HEIGHT (vinfo) == surface_height)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* doing gst_vaapi_surface_get_format() only if necessary since it execute
|
/* doing gst_vaapi_surface_get_format() only if necessary since it
|
||||||
* vaDeriveImage in the backgrorund . This will usually get executed only once */
|
* execute vaDeriveImage in the background. This will usually get
|
||||||
format =
|
* executed only once */
|
||||||
(GST_VIDEO_INFO_FORMAT (vinfo) ==
|
surface_format = GST_VIDEO_INFO_FORMAT (vinfo);
|
||||||
GST_VIDEO_FORMAT_UNKNOWN) ? gst_vaapi_surface_get_format (surface) :
|
if (surface_format == GST_VIDEO_FORMAT_UNKNOWN) {
|
||||||
GST_VIDEO_INFO_FORMAT (vinfo);
|
surface_format = gst_vaapi_surface_get_format (surface);
|
||||||
|
|
||||||
gst_video_info_set_format (vinfo, format, surface_width, surface_height);
|
/* if the VA context delivers a currently unrecognized format
|
||||||
|
* (ICM3, e.g.), we can assume NV12 "safely" */
|
||||||
|
if (surface_format == GST_VIDEO_FORMAT_UNKNOWN
|
||||||
|
|| surface_format == GST_VIDEO_FORMAT_ENCODED)
|
||||||
|
surface_format = GST_VIDEO_FORMAT_NV12;
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_video_info_set_format (vinfo, surface_format, surface_width,
|
||||||
|
surface_height);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue