summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2020-01-28 22:07:44 +0200
committerTim-Philipp Müller <tim@centricular.com>2020-02-05 09:07:56 +0000
commit9b664e60d94b3fb43b810ebd87838c2d8ac91e44 (patch)
tree5a4f9f0ec47eb1e12f87fd0cd09f3cbba3319351
parenta016e47a9159206221cf7c06e511b305fb12b045 (diff)
downloadgstreamer-plugins-base-9b664e60d94b3fb43b810ebd87838c2d8ac91e44.tar.gz
videoaggregator: Don't configure NULL chroma-site/colorimetry
If there's no known value in the best caps then the functions to convert them to strings will return NULL. Having the fields not in the caps is not a problem, having them with a NULL value however will cause negotiation failures.
-rw-r--r--gst-libs/gst/video/gstvideoaggregator.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gst-libs/gst/video/gstvideoaggregator.c b/gst-libs/gst/video/gstvideoaggregator.c
index 886121b02..0d448a803 100644
--- a/gst-libs/gst/video/gstvideoaggregator.c
+++ b/gst-libs/gst/video/gstvideoaggregator.c
@@ -898,14 +898,21 @@ gst_video_aggregator_default_update_caps (GstVideoAggregator * vagg,
GST_DEBUG_OBJECT (vagg,
"The output format will now be : %d with chroma : %s and colorimetry %s",
- best_format, gst_video_chroma_to_string (best_info.chroma_site),
- color_name);
+ best_format,
+ GST_STR_NULL (gst_video_chroma_to_string (best_info.chroma_site)),
+ GST_STR_NULL (color_name));
best_format_caps = gst_caps_copy (caps);
gst_caps_set_simple (best_format_caps, "format", G_TYPE_STRING,
- gst_video_format_to_string (best_format), "chroma-site", G_TYPE_STRING,
- gst_video_chroma_to_string (best_info.chroma_site), "colorimetry",
- G_TYPE_STRING, color_name, NULL);
+ gst_video_format_to_string (best_format), NULL);
+
+ if (best_info.chroma_site != GST_VIDEO_CHROMA_SITE_UNKNOWN)
+ gst_caps_set_simple (best_format_caps, "chroma-site", G_TYPE_STRING,
+ gst_video_chroma_to_string (best_info.chroma_site), NULL);
+ if (color_name != NULL)
+ gst_caps_set_simple (best_format_caps, "colorimetry", G_TYPE_STRING,
+ color_name, NULL);
+
g_free (color_name);
ret = gst_caps_merge (best_format_caps, gst_caps_ref (caps));