summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2023-03-23 20:04:49 -0400
committerTim-Philipp Müller <tim@centricular.com>2023-06-18 11:30:18 +0100
commite1793a27b842329d3ed2819da485bf4db3d181d5 (patch)
treecf4659a28d398949198d05d55d6212a23b61f3ee
parentee6c086b5cbca3d06c57ab7dabb25d73894b641d (diff)
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>
-rw-r--r--subprojects/gst-integration-testsuites/testsuites/validate/h265parse/alternate/flow-expectations/log-fakesink-sink-expected6
-rw-r--r--subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c9
2 files changed, 6 insertions, 9 deletions
diff --git a/subprojects/gst-integration-testsuites/testsuites/validate/h265parse/alternate/flow-expectations/log-fakesink-sink-expected b/subprojects/gst-integration-testsuites/testsuites/validate/h265parse/alternate/flow-expectations/log-fakesink-sink-expected
index 0419ad2d21..1339641822 100644
--- a/subprojects/gst-integration-testsuites/testsuites/validate/h265parse/alternate/flow-expectations/log-fakesink-sink-expected
+++ b/subprojects/gst-integration-testsuites/testsuites/validate/h265parse/alternate/flow-expectations/log-fakesink-sink-expected
@@ -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)
diff --git a/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c b/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c
index 9a80140c86..114859fed4 100644
--- a/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c
+++ b/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c
@@ -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;