h264parse: Avoid setting wrong colorimetry info if the stream doesn't contain it

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3543>
This commit is contained in:
Thibault Saunier 2022-12-07 12:28:55 -03:00 committed by GStreamer Marge Bot
parent 010ede30dd
commit e49e0198f1

View file

@ -2146,16 +2146,20 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps)
GstVideoColorimetry ci = { 0, }; GstVideoColorimetry ci = { 0, };
gchar *old_colorimetry = NULL; gchar *old_colorimetry = NULL;
if (vui->video_full_range_flag)
ci.range = GST_VIDEO_COLOR_RANGE_0_255;
else
ci.range = GST_VIDEO_COLOR_RANGE_16_235;
ci.matrix = gst_video_color_matrix_from_iso (vui->matrix_coefficients); ci.matrix = gst_video_color_matrix_from_iso (vui->matrix_coefficients);
ci.transfer = ci.transfer =
gst_video_transfer_function_from_iso (vui->transfer_characteristics); gst_video_transfer_function_from_iso (vui->transfer_characteristics);
ci.primaries = gst_video_color_primaries_from_iso (vui->colour_primaries); ci.primaries = gst_video_color_primaries_from_iso (vui->colour_primaries);
if (ci.matrix != GST_VIDEO_COLOR_MATRIX_UNKNOWN
&& ci.transfer != GST_VIDEO_TRANSFER_UNKNOWN
&& ci.primaries != GST_VIDEO_COLOR_PRIMARIES_UNKNOWN) {
if (vui->video_full_range_flag)
ci.range = GST_VIDEO_COLOR_RANGE_0_255;
else
ci.range = GST_VIDEO_COLOR_RANGE_16_235;
}
old_colorimetry = old_colorimetry =
gst_video_colorimetry_to_string (&h264parse->parsed_colorimetry); gst_video_colorimetry_to_string (&h264parse->parsed_colorimetry);
colorimetry = gst_video_colorimetry_to_string (&ci); colorimetry = gst_video_colorimetry_to_string (&ci);