mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 05:01:23 +00:00
video: Don't overshoot QoS earliest time by a factor of 2
By setting the earliest time to timestamp + 2 * diff there would be a difference of 1 * diff between the current clock time and the earliest time the element would let through in the future. If e.g. a frame is arriving 30s late at the sink, then not just all frames up to that point would be dropped but also 30s of frames after the current clock time. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7518>
This commit is contained in:
parent
b8a316275c
commit
ca23c3c762
10 changed files with 15 additions and 10 deletions
|
@ -1917,7 +1917,7 @@ gst_adaptive_demux_src_event (GstPad * pad, GstObject * parent,
|
||||||
gst_event_parse_qos (event, NULL, NULL, &diff, ×tamp);
|
gst_event_parse_qos (event, NULL, NULL, &diff, ×tamp);
|
||||||
/* Only take into account lateness if late */
|
/* Only take into account lateness if late */
|
||||||
if (diff > 0)
|
if (diff > 0)
|
||||||
earliest_time = timestamp + 2 * diff;
|
earliest_time = timestamp + MIN (2 * diff, GST_SECOND);
|
||||||
else
|
else
|
||||||
earliest_time = timestamp;
|
earliest_time = timestamp;
|
||||||
|
|
||||||
|
|
|
@ -1264,7 +1264,7 @@ gst_audio_visualizer_src_event (GstPad * pad, GstObject * parent,
|
||||||
if (diff >= 0)
|
if (diff >= 0)
|
||||||
/* we're late, this is a good estimate for next displayable
|
/* we're late, this is a good estimate for next displayable
|
||||||
* frame (see part-qos.txt) */
|
* frame (see part-qos.txt) */
|
||||||
scope->priv->earliest_time = timestamp + 2 * diff +
|
scope->priv->earliest_time = timestamp + MIN (2 * diff, GST_SECOND) +
|
||||||
scope->priv->frame_duration;
|
scope->priv->frame_duration;
|
||||||
else
|
else
|
||||||
scope->priv->earliest_time = timestamp + diff;
|
scope->priv->earliest_time = timestamp + diff;
|
||||||
|
|
|
@ -1667,7 +1667,8 @@ gst_video_aggregator_update_qos (GstVideoAggregator * vagg, gdouble proportion,
|
||||||
if (G_LIKELY (timestamp != GST_CLOCK_TIME_NONE)) {
|
if (G_LIKELY (timestamp != GST_CLOCK_TIME_NONE)) {
|
||||||
if (!live && G_UNLIKELY (diff > 0))
|
if (!live && G_UNLIKELY (diff > 0))
|
||||||
vagg->priv->earliest_time =
|
vagg->priv->earliest_time =
|
||||||
timestamp + 2 * diff + gst_util_uint64_scale_int_round (GST_SECOND,
|
timestamp + MIN (2 * diff,
|
||||||
|
GST_SECOND) + gst_util_uint64_scale_int_round (GST_SECOND,
|
||||||
GST_VIDEO_INFO_FPS_D (&vagg->info),
|
GST_VIDEO_INFO_FPS_D (&vagg->info),
|
||||||
GST_VIDEO_INFO_FPS_N (&vagg->info));
|
GST_VIDEO_INFO_FPS_N (&vagg->info));
|
||||||
else
|
else
|
||||||
|
|
|
@ -1834,7 +1834,8 @@ gst_video_decoder_src_event_default (GstVideoDecoder * decoder,
|
||||||
priv->proportion = proportion;
|
priv->proportion = proportion;
|
||||||
if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (timestamp))) {
|
if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (timestamp))) {
|
||||||
if (G_UNLIKELY (diff > 0)) {
|
if (G_UNLIKELY (diff > 0)) {
|
||||||
priv->earliest_time = timestamp + 2 * diff + priv->qos_frame_duration;
|
priv->earliest_time =
|
||||||
|
timestamp + MIN (2 * diff, GST_SECOND) + priv->qos_frame_duration;
|
||||||
} else {
|
} else {
|
||||||
priv->earliest_time = timestamp + diff;
|
priv->earliest_time = timestamp + diff;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1361,7 +1361,8 @@ gst_video_encoder_src_event_default (GstVideoEncoder * encoder,
|
||||||
priv->proportion = proportion;
|
priv->proportion = proportion;
|
||||||
if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (timestamp))) {
|
if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (timestamp))) {
|
||||||
if (G_UNLIKELY (diff > 0)) {
|
if (G_UNLIKELY (diff > 0)) {
|
||||||
priv->earliest_time = timestamp + 2 * diff + priv->qos_frame_duration;
|
priv->earliest_time =
|
||||||
|
timestamp + MIN (2 * diff, GST_SECOND) + priv->qos_frame_duration;
|
||||||
} else {
|
} else {
|
||||||
priv->earliest_time = timestamp + diff;
|
priv->earliest_time = timestamp + diff;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2536,7 +2536,7 @@ gst_adaptive_demux_src_event (GstPad * pad, GstObject * parent,
|
||||||
gst_event_parse_qos (event, NULL, NULL, &diff, ×tamp);
|
gst_event_parse_qos (event, NULL, NULL, &diff, ×tamp);
|
||||||
/* Only take into account lateness if late */
|
/* Only take into account lateness if late */
|
||||||
if (diff > 0)
|
if (diff > 0)
|
||||||
earliest_time = timestamp + 2 * diff;
|
earliest_time = timestamp + MIN (2 * diff, GST_SECOND);
|
||||||
else
|
else
|
||||||
earliest_time = timestamp;
|
earliest_time = timestamp;
|
||||||
|
|
||||||
|
|
|
@ -1288,7 +1288,7 @@ gst_deinterlace_update_qos (GstDeinterlace * self, gdouble proportion,
|
||||||
if (G_LIKELY (timestamp != GST_CLOCK_TIME_NONE)) {
|
if (G_LIKELY (timestamp != GST_CLOCK_TIME_NONE)) {
|
||||||
if (G_UNLIKELY (diff > 0))
|
if (G_UNLIKELY (diff > 0))
|
||||||
self->earliest_time =
|
self->earliest_time =
|
||||||
timestamp + 2 * diff + ((self->fields ==
|
timestamp + MIN (2 * diff, GST_SECOND) + ((self->fields ==
|
||||||
GST_DEINTERLACE_ALL) ? self->field_duration : 2 *
|
GST_DEINTERLACE_ALL) ? self->field_duration : 2 *
|
||||||
self->field_duration);
|
self->field_duration);
|
||||||
else
|
else
|
||||||
|
|
|
@ -534,7 +534,7 @@ gst_monoscope_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
/* we're late, this is a good estimate for next displayable
|
/* we're late, this is a good estimate for next displayable
|
||||||
* frame (see part-qos.txt) */
|
* frame (see part-qos.txt) */
|
||||||
monoscope->earliest_time =
|
monoscope->earliest_time =
|
||||||
timestamp + 2 * diff + monoscope->frame_duration;
|
timestamp + MIN (2 * diff, GST_SECOND) + monoscope->frame_duration;
|
||||||
else
|
else
|
||||||
monoscope->earliest_time = timestamp + diff;
|
monoscope->earliest_time = timestamp + diff;
|
||||||
GST_OBJECT_UNLOCK (monoscope);
|
GST_OBJECT_UNLOCK (monoscope);
|
||||||
|
|
|
@ -695,7 +695,8 @@ gst_shape_wipe_update_qos (GstShapeWipe * self, gdouble proportion,
|
||||||
self->proportion = proportion;
|
self->proportion = proportion;
|
||||||
if (G_LIKELY (timestamp != GST_CLOCK_TIME_NONE)) {
|
if (G_LIKELY (timestamp != GST_CLOCK_TIME_NONE)) {
|
||||||
if (G_UNLIKELY (diff > 0))
|
if (G_UNLIKELY (diff > 0))
|
||||||
self->earliest_time = timestamp + 2 * diff + self->frame_duration;
|
self->earliest_time =
|
||||||
|
timestamp + MIN (2 * diff, GST_SECOND) + self->frame_duration;
|
||||||
else
|
else
|
||||||
self->earliest_time = timestamp + diff;
|
self->earliest_time = timestamp + diff;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -816,7 +816,8 @@ gst_videomixer2_update_qos (GstVideoMixer2 * mix, gdouble proportion,
|
||||||
if (G_LIKELY (timestamp != GST_CLOCK_TIME_NONE)) {
|
if (G_LIKELY (timestamp != GST_CLOCK_TIME_NONE)) {
|
||||||
if (!mix->live && G_UNLIKELY (diff > 0))
|
if (!mix->live && G_UNLIKELY (diff > 0))
|
||||||
mix->earliest_time =
|
mix->earliest_time =
|
||||||
timestamp + 2 * diff + gst_util_uint64_scale_int_round (GST_SECOND,
|
timestamp + MIN (2 * diff,
|
||||||
|
GST_SECOND) + gst_util_uint64_scale_int_round (GST_SECOND,
|
||||||
GST_VIDEO_INFO_FPS_D (&mix->info), GST_VIDEO_INFO_FPS_N (&mix->info));
|
GST_VIDEO_INFO_FPS_D (&mix->info), GST_VIDEO_INFO_FPS_N (&mix->info));
|
||||||
else
|
else
|
||||||
mix->earliest_time = timestamp + diff;
|
mix->earliest_time = timestamp + diff;
|
||||||
|
|
Loading…
Reference in a new issue