[MOVED FROM BAD 037/134] 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:
Sebastian Dröge 2010-05-22 07:44:27 +02:00
parent c90e9b3127
commit 951b3a1594

View file

@ -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, &timestamp); gst_event_parse_qos (event, &proportion, &diff, &timestamp);
GST_OBJECT_LOCK (base_video_decoder); GST_OBJECT_LOCK (base_video_decoder);
base_video_decoder->proportion = proportion; base_video_decoder->proportion = proportion;
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; 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,