vah264enc: Packed headers can be zero.

A driver can report back no packed header support (VA_ENC_PACKED_HEADER_NONE).
This patch removes that false verification.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2851>
This commit is contained in:
Víctor Manuel Jáquez Leal 2022-08-09 12:28:43 +02:00 committed by GStreamer Marge Bot
parent a13fd0ead5
commit c4706ed219
3 changed files with 13 additions and 12 deletions

View file

@ -756,31 +756,33 @@ gst_va_encoder_get_rtformat (GstVaEncoder * self,
return attrib.value; return attrib.value;
} }
guint32 gboolean
gst_va_encoder_get_packed_headers (GstVaEncoder * self, VAProfile profile, gst_va_encoder_get_packed_headers (GstVaEncoder * self, VAProfile profile,
VAEntrypoint entrypoint) VAEntrypoint entrypoint, guint * packed_headers)
{ {
VAStatus status; VAStatus status;
VADisplay dpy; VADisplay dpy;
VAConfigAttrib attrib = {.type = VAConfigAttribEncPackedHeaders }; VAConfigAttrib attrib = {.type = VAConfigAttribEncPackedHeaders };
if (profile == VAProfileNone) if (profile == VAProfileNone)
return 0; return FALSE;
dpy = gst_va_display_get_va_dpy (self->display); dpy = gst_va_display_get_va_dpy (self->display);
status = vaGetConfigAttributes (dpy, profile, entrypoint, &attrib, 1); status = vaGetConfigAttributes (dpy, profile, entrypoint, &attrib, 1);
if (status != VA_STATUS_SUCCESS) { if (status != VA_STATUS_SUCCESS) {
GST_ERROR_OBJECT (self, "Failed to query packed headers: %s", GST_ERROR_OBJECT (self, "Failed to query packed headers: %s",
vaErrorStr (status)); vaErrorStr (status));
return 0; return FALSE;
} }
if (attrib.value == VA_ATTRIB_NOT_SUPPORTED) { if (attrib.value == VA_ATTRIB_NOT_SUPPORTED) {
GST_WARNING_OBJECT (self, "Driver does not support any packed headers"); GST_WARNING_OBJECT (self, "Driver does not support any packed headers");
return 0; return FALSE;
} }
return attrib.value; if (packed_headers)
*packed_headers = attrib.value;
return TRUE;
} }
/* Add packed header such as SPS, PPS, SEI, etc. If adding slice header, /* Add packed header such as SPS, PPS, SEI, etc. If adding slice header,

View file

@ -80,9 +80,10 @@ gboolean gst_va_encoder_has_trellis (GstVaEncoder * self,
guint32 gst_va_encoder_get_rtformat (GstVaEncoder * self, guint32 gst_va_encoder_get_rtformat (GstVaEncoder * self,
VAProfile profile, VAProfile profile,
VAEntrypoint entrypoint); VAEntrypoint entrypoint);
guint32 gst_va_encoder_get_packed_headers (GstVaEncoder * self, gboolean gst_va_encoder_get_packed_headers (GstVaEncoder * self,
VAProfile profile, VAProfile profile,
VAEntrypoint entrypoint); VAEntrypoint entrypoint,
guint32 * packed_headers);
gboolean gst_va_encoder_get_rate_control_enum (GstVaEncoder * self, gboolean gst_va_encoder_get_rate_control_enum (GstVaEncoder * self,
GEnumValue ratectl[16]); GEnumValue ratectl[16]);
gboolean gst_va_encoder_add_param (GstVaEncoder * self, gboolean gst_va_encoder_add_param (GstVaEncoder * self,

View file

@ -1258,10 +1258,8 @@ _init_packed_headers (GstVaH264Enc * self)
self->packed_headers = 0; self->packed_headers = 0;
packed_headers = gst_va_encoder_get_packed_headers (base->encoder, if (!gst_va_encoder_get_packed_headers (base->encoder, base->profile,
base->profile, base->entrypoint); base->entrypoint, &packed_headers))
if (packed_headers == 0)
return FALSE; return FALSE;
if (desired_packed_headers & ~packed_headers) { if (desired_packed_headers & ~packed_headers) {