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;
}
guint32
gboolean
gst_va_encoder_get_packed_headers (GstVaEncoder * self, VAProfile profile,
VAEntrypoint entrypoint)
VAEntrypoint entrypoint, guint * packed_headers)
{
VAStatus status;
VADisplay dpy;
VAConfigAttrib attrib = {.type = VAConfigAttribEncPackedHeaders };
if (profile == VAProfileNone)
return 0;
return FALSE;
dpy = gst_va_display_get_va_dpy (self->display);
status = vaGetConfigAttributes (dpy, profile, entrypoint, &attrib, 1);
if (status != VA_STATUS_SUCCESS) {
GST_ERROR_OBJECT (self, "Failed to query packed headers: %s",
vaErrorStr (status));
return 0;
return FALSE;
}
if (attrib.value == VA_ATTRIB_NOT_SUPPORTED) {
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,

View file

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

View file

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