summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2020-01-08 17:37:22 +0100
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-01-19 14:57:04 +0100
commitd576963979db4b0d657ff45f1927372425c09546 (patch)
tree7963e1b6da03ec1efe4271d2d04fffbd2659757a
parent209e1b5bf0e13c0059aea4605b916612dbf63718 (diff)
vaaph264enc: suppress avc if the driver does not support packed headers
Do not negotiate AVC output if the driver does not support it.
-rw-r--r--gst/vaapi/gstvaapiencode_h264.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gst/vaapi/gstvaapiencode_h264.c b/gst/vaapi/gstvaapiencode_h264.c
index 987f72c9..00d04e08 100644
--- a/gst/vaapi/gstvaapiencode_h264.c
+++ b/gst/vaapi/gstvaapiencode_h264.c
@@ -195,6 +195,9 @@ find_best_profile (GstCaps * caps)
static GstCaps *
get_available_caps (GstVaapiEncodeH264 * encode)
{
+ GstVaapiEncode *const base_encode = GST_VAAPIENCODE_CAST (encode);
+ GstVaapiEncoderH264 *const encoder =
+ GST_VAAPI_ENCODER_H264 (base_encode->encoder);
GstCaps *out_caps;
GArray *profiles;
GstVaapiProfile profile;
@@ -232,6 +235,13 @@ get_available_caps (GstVaapiEncodeH264 * encode)
g_value_unset (&profile_list);
g_value_unset (&profile_v);
+ if (!gst_vaapi_encoder_h264_supports_avc (encoder)) {
+ GST_INFO_OBJECT (encode,
+ "avc requires packed header support, outputting byte-stream");
+ gst_caps_set_simple (out_caps, "stream-format", G_TYPE_STRING,
+ "byte-stream", NULL);
+ }
+
encode->available_caps = out_caps;
return encode->available_caps;
@@ -384,8 +394,23 @@ gst_vaapiencode_h264_get_caps (GstVaapiEncode * base_encode)
GstVaapiEncoderH264 *const encoder =
GST_VAAPI_ENCODER_H264 (base_encode->encoder);
GstVaapiProfile profile;
+ GstCaps *available_caps;
+ GstStructure *structure;
+ const char *stream_format;
GstCaps *caps;
+ if (encode->is_avc) {
+ available_caps = get_available_caps (encode);
+ structure = gst_caps_get_structure (available_caps, 0);
+ stream_format = gst_structure_get_string (structure, "stream-format");
+ if (g_strcmp0 (stream_format, "byte-stream") == 0) {
+ GST_WARNING_OBJECT (encode,
+ "downstream prefers avc, but the driver does not support it");
+ encode->is_avc = FALSE;
+ base_encode->need_codec_data = FALSE;
+ }
+ }
+
caps = gst_caps_from_string (GST_CODEC_CAPS);
gst_caps_set_simple (caps, "stream-format", G_TYPE_STRING,