videodecoder: Take DTS as PTS for keyframes as a last resort if we can't calculate any PTS

https://bugzilla.gnome.org/show_bug.cgi?id=704193
This commit is contained in:
Wim Taymans 2013-07-24 09:24:45 +02:00 committed by Sebastian Dröge
parent 0bd0c925e3
commit 409cb22253

View file

@ -2135,6 +2135,7 @@ gst_video_decoder_prepare_finish_frame (GstVideoDecoder *
{
GstVideoDecoderPrivate *priv = decoder->priv;
GList *l, *events = NULL;
gboolean sync;
#ifndef GST_DISABLE_GST_DEBUG
GST_LOG_OBJECT (decoder, "n %d in %" G_GSIZE_FORMAT " out %" G_GSIZE_FORMAT,
@ -2143,12 +2144,13 @@ gst_video_decoder_prepare_finish_frame (GstVideoDecoder *
gst_adapter_available (priv->output_adapter));
#endif
sync = GST_VIDEO_CODEC_FRAME_IS_SYNC_POINT (frame);
GST_LOG_OBJECT (decoder,
"finish frame %p (#%d) sync:%d PTS:%" GST_TIME_FORMAT " DTS:%"
GST_TIME_FORMAT,
frame, frame->system_frame_number,
GST_VIDEO_CODEC_FRAME_IS_SYNC_POINT (frame), GST_TIME_ARGS (frame->pts),
GST_TIME_ARGS (frame->dts));
sync, GST_TIME_ARGS (frame->pts), GST_TIME_ARGS (frame->dts));
/* Push all pending events that arrived before this frame */
for (l = priv->frames; l; l = l->next) {
@ -2298,6 +2300,11 @@ gst_video_decoder_prepare_finish_frame (GstVideoDecoder *
GST_LOG_OBJECT (decoder,
"Guessing timestamp %" GST_TIME_FORMAT " for frame...",
GST_TIME_ARGS (frame->pts));
} else if (sync && frame->dts != GST_CLOCK_TIME_NONE) {
frame->pts = frame->dts;
GST_LOG_OBJECT (decoder,
"Setting DTS as PTS %" GST_TIME_FORMAT " for frame...",
GST_TIME_ARGS (frame->pts));
}
}