h265parse: Don't override upstream framerate

The framerate should only be replaced (and corrected for alternating field)
when it is parsed from the bitstream. Otherwise, the upstream framerate
from caps should be trusted and assumed correct.

Related to gst-plugins-bad!2020

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4884>
This commit is contained in:
Nicolas Dufresne 2023-03-23 20:04:49 -04:00 committed by Tim-Philipp Müller
parent ee6c086b5c
commit e1793a27b8
2 changed files with 6 additions and 9 deletions

View file

@ -1,7 +1,7 @@
event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)1;
event caps: video/x-h265, alignment=(string)au, bit-depth-chroma=(uint)8, bit-depth-luma=(uint)8, chroma-format=(string)4:2:0, codec_data=(buffer)0101400000004000000000003cf000fcfdf8f800000f03200001001840010c01ffff01400000030040000003000003003c250240210001003642010101400000030040000003000003003ca009881a7779e96e44a1735010202ed00000030010000004b51affde103e805df7c2010422000100074401c07181cdb2, colorimetry=(string)2:0:0:1, framerate=(fraction)75/1, height=(int)200, level=(string)2, parsed=(boolean)true, profile=(string)main, stream-format=(string)hvc1, tier=(string)main, width=(int)300;
event caps: video/x-h265, alignment=(string)au, bit-depth-chroma=(uint)8, bit-depth-luma=(uint)8, chroma-format=(string)4:2:0, codec_data=(buffer)0101400000004000000000003cf000fcfdf8f800000f03200001001840010c01ffff01400000030040000003000003003c250240210001003642010101400000030040000003000003003ca009881a7779e96e44a1735010202ed00000030010000004b51affde103e805df7c2010422000100074401c07181cdb2, colorimetry=(string)2:0:0:1, framerate=(fraction)75/2, height=(int)200, level=(string)2, parsed=(boolean)true, profile=(string)main, stream-format=(string)hvc1, tier=(string)main, width=(int)300;
event segment: format=TIME, start=0:00:00.000000000, offset=0:00:00.000000000, stop=none, time=0:00:00.000000000, base=0:00:00.000000000, position=0:00:00.000000000
event tag: GstTagList-stream, taglist=(taglist)"taglist\,\ video-codec\=\(string\)\"H.265\\\ \\\(Main\\\ Profile\\\)\"\;";
buffer: dts=0:00:00.000000000, dur=0:00:00.006666666, flags=discont marker header last
buffer: dts=0:00:00.006666666, dur=0:00:00.006666666, flags=header delta-unit last
buffer: dts=0:00:00.000000000, dur=0:00:00.013333333, flags=discont marker header last
buffer: dts=0:00:00.013333333, dur=0:00:00.013333333, flags=header delta-unit last
event eos: (no structure)

View file

@ -2168,7 +2168,7 @@ gst_h265_parse_update_src_caps (GstH265Parse * h265parse, GstCaps * caps)
}
/* 0/1 is set as the default in the codec parser */
if (vui->timing_info_present_flag) {
if (vui->timing_info_present_flag && !h265parse->framerate_from_caps) {
gint fps_num = 0, fps_den = 1;
if (!(sps->fps_num == 0 && sps->fps_den == 1)) {
@ -2179,8 +2179,7 @@ gst_h265_parse_update_src_caps (GstH265Parse * h265parse, GstCaps * caps)
fps_num = sps->vui_params.time_scale;
fps_den = sps->vui_params.num_units_in_tick;
if (gst_h265_parse_is_field_interlaced (h265parse)
&& h265parse->framerate_from_caps) {
if (gst_h265_parse_is_field_interlaced (h265parse)) {
gint new_fps_num, new_fps_den;
if (!gst_util_fraction_multiply (fps_num, fps_den, 1, 2, &new_fps_num,
@ -2193,7 +2192,6 @@ gst_h265_parse_update_src_caps (GstH265Parse * h265parse, GstCaps * caps)
fps_num = new_fps_num;
fps_den = new_fps_den;
}
h265parse->framerate_from_caps = FALSE;
}
}
@ -2216,7 +2214,6 @@ gst_h265_parse_update_src_caps (GstH265Parse * h265parse, GstCaps * caps)
h265parse->parsed_par_n, h265parse->parsed_par_d);
modified = TRUE;
}
}
if (vui->video_signal_type_present_flag &&
@ -2289,7 +2286,7 @@ gst_h265_parse_update_src_caps (GstH265Parse * h265parse, GstCaps * caps)
&h265parse->parsed_fps_d);
gst_base_parse_set_frame_rate (GST_BASE_PARSE (h265parse),
fps_num, fps_den, 0, 0);
val = sps->profile_tier_level.interlaced_source_flag ? GST_SECOND / 2 :
val = gst_h265_parse_is_field_interlaced (h265parse) ? GST_SECOND / 2 :
GST_SECOND;
h265parse->framerate_from_caps = TRUE;