mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
Improve and fix LATENCY query handling
This now follows the design docs everywhere, especially the maximum latency handling. https://bugzilla.gnome.org/show_bug.cgi?id=744106
This commit is contained in:
parent
5dd1a28906
commit
7dc03df3de
2 changed files with 16 additions and 15 deletions
|
@ -1728,25 +1728,27 @@ static void
|
||||||
gst_x264_enc_set_latency (GstX264Enc * encoder)
|
gst_x264_enc_set_latency (GstX264Enc * encoder)
|
||||||
{
|
{
|
||||||
GstVideoInfo *info = &encoder->input_state->info;
|
GstVideoInfo *info = &encoder->input_state->info;
|
||||||
|
gint max_delayed_frames;
|
||||||
|
GstClockTime latency;
|
||||||
|
|
||||||
|
max_delayed_frames = x264_encoder_maximum_delayed_frames (encoder->x264enc);
|
||||||
|
|
||||||
if (info->fps_n) {
|
if (info->fps_n) {
|
||||||
GstClockTime latency;
|
|
||||||
gint max_delayed_frames;
|
|
||||||
max_delayed_frames = x264_encoder_maximum_delayed_frames (encoder->x264enc);
|
|
||||||
latency = gst_util_uint64_scale_ceil (GST_SECOND * info->fps_d,
|
latency = gst_util_uint64_scale_ceil (GST_SECOND * info->fps_d,
|
||||||
max_delayed_frames, info->fps_n);
|
max_delayed_frames, info->fps_n);
|
||||||
|
|
||||||
GST_INFO_OBJECT (encoder,
|
|
||||||
"Updating latency to %" GST_TIME_FORMAT " (%d frames)",
|
|
||||||
GST_TIME_ARGS (latency), max_delayed_frames);
|
|
||||||
|
|
||||||
gst_video_encoder_set_latency (GST_VIDEO_ENCODER (encoder), latency,
|
|
||||||
GST_CLOCK_TIME_NONE);
|
|
||||||
} else {
|
} else {
|
||||||
/* We can't do live as we don't know our latency */
|
/* FIXME: Assume 25fps. This is better than reporting no latency at
|
||||||
gst_video_encoder_set_latency (GST_VIDEO_ENCODER (encoder),
|
* all and then later failing in live pipelines
|
||||||
0, GST_CLOCK_TIME_NONE);
|
*/
|
||||||
|
latency = gst_util_uint64_scale_ceil (GST_SECOND * 1,
|
||||||
|
max_delayed_frames, 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GST_INFO_OBJECT (encoder,
|
||||||
|
"Updating latency to %" GST_TIME_FORMAT " (%d frames)",
|
||||||
|
GST_TIME_ARGS (latency), max_delayed_frames);
|
||||||
|
|
||||||
|
gst_video_encoder_set_latency (GST_VIDEO_ENCODER (encoder), latency, latency);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -4335,8 +4335,7 @@ gst_asf_demux_handle_src_query (GstPad * pad, GstObject * parent,
|
||||||
GST_TIME_ARGS (min), GST_TIME_ARGS (max));
|
GST_TIME_ARGS (min), GST_TIME_ARGS (max));
|
||||||
|
|
||||||
GST_OBJECT_LOCK (demux);
|
GST_OBJECT_LOCK (demux);
|
||||||
if (min != -1)
|
min += demux->latency;
|
||||||
min += demux->latency;
|
|
||||||
if (max != -1)
|
if (max != -1)
|
||||||
max += demux->latency;
|
max += demux->latency;
|
||||||
GST_OBJECT_UNLOCK (demux);
|
GST_OBJECT_UNLOCK (demux);
|
||||||
|
|
Loading…
Reference in a new issue