Commit a25ba128 authored by Nicolas Dufresne's avatar Nicolas Dufresne
Browse files

h265parse: Don't add latency when not needed

We no longer add latency when doing AU->AU, AU->NAL and NAL->NAL
parsing.
parent cecf09d0
......@@ -1641,7 +1641,7 @@ gst_h265_parse_update_src_caps (GstH265Parse * h265parse, GstCaps * caps)
gint fps_num = h265parse->fps_num;
gint fps_den = h265parse->fps_den;
gint width, height;
GstClockTime latency;
GstClockTime latency = 0;
caps = gst_caps_copy (sink_caps);
......@@ -1664,13 +1664,21 @@ gst_h265_parse_update_src_caps (GstH265Parse * h265parse, GstCaps * caps)
gst_structure_get_fraction (s, "framerate", &fps_num, &fps_den);
/* but not necessarily or reliably this */
if (fps_num > 0 && fps_den > 0) {
if (fps_den > 0) {
GST_INFO_OBJECT (h265parse, "setting framerate in caps");
gst_caps_set_simple (caps, "framerate",
GST_TYPE_FRACTION, fps_num, fps_den, NULL);
gst_base_parse_set_frame_rate (GST_BASE_PARSE (h265parse),
fps_num, fps_den, 0, 0);
latency = gst_util_uint64_scale (GST_SECOND, fps_den, fps_num);
/* If we know the frame duration, and if we are not in one of the zero
* latency pattern, add one frame of latency */
if (fps_num > 0 &&
h265parse->in_align != GST_H265_PARSE_ALIGN_AU &&
!(h265parse->in_align == GST_H265_PARSE_ALIGN_NAL &&
h265parse->align == GST_H265_PARSE_ALIGN_NAL))
latency = gst_util_uint64_scale (GST_SECOND, fps_den, fps_num);
gst_base_parse_set_latency (GST_BASE_PARSE (h265parse), latency,
latency);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment