mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
basevideodecoder: Take the frame duration into account when calculating the earliest time
This formula is used in many other elements too. Fixes bug #619318.
This commit is contained in:
parent
71ebf1add6
commit
179555c45b
1 changed files with 17 additions and 1 deletions
|
@ -353,12 +353,28 @@ gst_base_video_decoder_src_event (GstPad * pad, GstEvent * event)
|
||||||
gdouble proportion;
|
gdouble proportion;
|
||||||
GstClockTimeDiff diff;
|
GstClockTimeDiff diff;
|
||||||
GstClockTime timestamp;
|
GstClockTime timestamp;
|
||||||
|
GstClockTime duration;
|
||||||
|
|
||||||
gst_event_parse_qos (event, &proportion, &diff, ×tamp);
|
gst_event_parse_qos (event, &proportion, &diff, ×tamp);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (base_video_decoder);
|
GST_OBJECT_LOCK (base_video_decoder);
|
||||||
base_video_decoder->proportion = proportion;
|
base_video_decoder->proportion = proportion;
|
||||||
base_video_decoder->earliest_time = timestamp + diff;
|
if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (timestamp))) {
|
||||||
|
if (G_UNLIKELY (diff > 0)) {
|
||||||
|
if (base_video_decoder->state.fps_n > 0)
|
||||||
|
duration =
|
||||||
|
gst_util_uint64_scale (GST_SECOND,
|
||||||
|
base_video_decoder->state.fps_d,
|
||||||
|
base_video_decoder->state.fps_n);
|
||||||
|
else
|
||||||
|
duration = 0;
|
||||||
|
base_video_decoder->earliest_time = timestamp + 2 * diff + duration;
|
||||||
|
} else {
|
||||||
|
base_video_decoder->earliest_time = timestamp + diff;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
base_video_decoder->earliest_time = GST_CLOCK_TIME_NONE;
|
||||||
|
}
|
||||||
GST_OBJECT_UNLOCK (base_video_decoder);
|
GST_OBJECT_UNLOCK (base_video_decoder);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (base_video_decoder,
|
GST_DEBUG_OBJECT (base_video_decoder,
|
||||||
|
|
Loading…
Reference in a new issue