summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-01-17 13:18:28 +0100
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-01-19 12:54:02 +0000
commita56ac3bffe707af5a22172097a69ba19f34a8539 (patch)
tree20be66c6eed543652470c50d2e3187f54b495135
parenteda173b3b089fc6da88c8fb77b9f9bdacb83dfb7 (diff)
vaapih264enc: common fail for gst_vaapiencode_h264_set_config()
Add a common fail code path for gst_vaapiencode_h264_set_config().
-rw-r--r--gst/vaapi/gstvaapiencode_h264.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/gst/vaapi/gstvaapiencode_h264.c b/gst/vaapi/gstvaapiencode_h264.c
index f623f67b..2ef1cae3 100644
--- a/gst/vaapi/gstvaapiencode_h264.c
+++ b/gst/vaapi/gstvaapiencode_h264.c
@@ -261,9 +261,7 @@ gst_vaapiencode_h264_set_config (GstVaapiEncode * base_encode)
encode->is_avc = FALSE;
} else if (gst_caps_is_empty (allowed_caps)) {
GST_INFO_OBJECT (encode, "downstream has EMPTY caps");
- gst_caps_unref (template_caps);
- gst_caps_unref (allowed_caps);
- return FALSE;
+ goto fail;
} else {
const char *stream_format = NULL;
GstStructure *structure;
@@ -272,11 +270,9 @@ gst_vaapiencode_h264_set_config (GstVaapiEncode * base_encode)
GstCaps *available_caps;
available_caps = get_available_caps (encode);
- if (!available_caps) {
- gst_caps_unref (template_caps);
- gst_caps_unref (allowed_caps);
- return FALSE;
- }
+ if (!available_caps)
+ goto fail;
+
if (!gst_caps_can_intersect (allowed_caps, available_caps)) {
GST_INFO_OBJECT (encode, "downstream requested an unsupported profile, "
"but encoder will try to output a compatible one");
@@ -319,6 +315,13 @@ gst_vaapiencode_h264_set_config (GstVaapiEncode * base_encode)
base_encode->need_codec_data = encode->is_avc;
return ret;
+
+fail:
+ {
+ gst_caps_unref (template_caps);
+ gst_caps_unref (allowed_caps);
+ return FALSE;
+ }
}
static void