summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-01-17 13:07:04 +0100
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-01-19 12:54:02 +0000
commit38d7297bb62964837ec158fcc4f490e09b59bb23 (patch)
tree9c92c8b2fe3db71ab554d7285565a7c607ef864e
parent8b4d18da0a63769dc4263f0b3dbc800b11eaf428 (diff)
vaapih264enc: intersect the new proposed caps
Instead of just leave to keep the proposed caps, with the best profile in the allowed caps, is its intersected again.
-rw-r--r--gst/vaapi/gstvaapiencode_h264.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gst/vaapi/gstvaapiencode_h264.c b/gst/vaapi/gstvaapiencode_h264.c
index 1c84094e..987f72c9 100644
--- a/gst/vaapi/gstvaapiencode_h264.c
+++ b/gst/vaapi/gstvaapiencode_h264.c
@@ -274,6 +274,8 @@ gst_vaapiencode_h264_set_config (GstVaapiEncode * base_encode)
goto fail;
if (!gst_caps_can_intersect (allowed_caps, available_caps)) {
+ GstCaps *tmp_caps;
+
GST_INFO_OBJECT (encode, "downstream may have requested an unsupported "
"profile. Encoder will try to output a compatible one");
@@ -283,9 +285,15 @@ gst_vaapiencode_h264_set_config (GstVaapiEncode * base_encode)
if (profile == GST_VAAPI_PROFILE_UNKNOWN)
goto fail;
- profile_caps = gst_caps_from_string (GST_CODEC_CAPS);
- gst_caps_set_simple (profile_caps, "profile", G_TYPE_STRING,
+ tmp_caps = gst_caps_from_string (GST_CODEC_CAPS);
+ gst_caps_set_simple (tmp_caps, "profile", G_TYPE_STRING,
gst_vaapi_profile_get_name (profile), NULL);
+ profile_caps = gst_caps_intersect (available_caps, tmp_caps);
+ gst_caps_unref (tmp_caps);
+ if (gst_caps_is_empty (profile_caps)) {
+ gst_caps_unref (profile_caps);
+ goto fail;
+ }
} else {
profile_caps = gst_caps_intersect (allowed_caps, available_caps);
profile = find_best_profile (profile_caps);