mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
videodecoder: Don't blindly assign DTS to PTS
DTS and PTS usually have a non-zero offset between them in MPEG-TS, so assigning DTS to PTS is almost always wrong. The other, newer timestamp recovery code does it correctly if we leave it as invalid.
This commit is contained in:
parent
ceb6585d26
commit
31312d586e
1 changed files with 10 additions and 11 deletions
|
@ -2633,21 +2633,20 @@ gst_video_decoder_decode_frame (GstVideoDecoder * decoder,
|
||||||
frame->dts = GST_BUFFER_DTS (frame->input_buffer);
|
frame->dts = GST_BUFFER_DTS (frame->input_buffer);
|
||||||
frame->duration = GST_BUFFER_DURATION (frame->input_buffer);
|
frame->duration = GST_BUFFER_DURATION (frame->input_buffer);
|
||||||
|
|
||||||
/* For keyframes, PTS = DTS */
|
/* For keyframes, PTS = DTS + constant_offset, usually 0 to 3 frame
|
||||||
|
* durations. */
|
||||||
/* FIXME upstream can be quite wrong about the keyframe aspect,
|
/* FIXME upstream can be quite wrong about the keyframe aspect,
|
||||||
* so we could be going off here as well,
|
* so we could be going off here as well,
|
||||||
* maybe let subclass decide if it really is/was a keyframe */
|
* maybe let subclass decide if it really is/was a keyframe */
|
||||||
if (GST_VIDEO_CODEC_FRAME_IS_SYNC_POINT (frame)) {
|
if (GST_VIDEO_CODEC_FRAME_IS_SYNC_POINT (frame) &&
|
||||||
if (!GST_CLOCK_TIME_IS_VALID (frame->pts)) {
|
GST_CLOCK_TIME_IS_VALID (frame->pts)
|
||||||
frame->pts = frame->dts;
|
&& GST_CLOCK_TIME_IS_VALID (frame->dts)) {
|
||||||
} else if (GST_CLOCK_TIME_IS_VALID (frame->dts)) {
|
|
||||||
/* just in case they are not equal as might ideally be,
|
/* just in case they are not equal as might ideally be,
|
||||||
* e.g. quicktime has a (positive) delta approach */
|
* e.g. quicktime has a (positive) delta approach */
|
||||||
priv->pts_delta = frame->pts - frame->dts;
|
priv->pts_delta = frame->pts - frame->dts;
|
||||||
GST_DEBUG_OBJECT (decoder, "PTS delta %d ms",
|
GST_DEBUG_OBJECT (decoder, "PTS delta %d ms",
|
||||||
(gint) (priv->pts_delta / GST_MSECOND));
|
(gint) (priv->pts_delta / GST_MSECOND));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
frame->abidata.ABI.ts = frame->dts;
|
frame->abidata.ABI.ts = frame->dts;
|
||||||
frame->abidata.ABI.ts2 = frame->pts;
|
frame->abidata.ABI.ts2 = frame->pts;
|
||||||
|
|
Loading…
Reference in a new issue