mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
mpeg2: fix GOP timestamps when incorrect data is received.
Some streams have incorrect GOP timestamps, or nothing set at all. i.e. GOP time is 00:00:00 for all GOPs. Try to recover in this case from demuxer timestamps, which are monotonic. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
fc3edde05c
commit
baa80d9753
1 changed files with 6 additions and 0 deletions
|
@ -490,6 +490,12 @@ decode_gop(GstVaapiDecoderMpeg2 *decoder, guchar *buf, guint buf_size)
|
|||
|
||||
pts = GST_SECOND * (gop.hour * 3600 + gop.minute * 60 + gop.second);
|
||||
pts += gst_util_uint64_scale(gop.frame, GST_SECOND * priv->fps_d, priv->fps_n);
|
||||
if (priv->gop_pts != GST_CLOCK_TIME_NONE && pts <= priv->gop_pts) {
|
||||
/* Try to fix GOP timestamps, based on demux timestamps */
|
||||
pts = gst_adapter_prev_timestamp(priv->adapter, NULL);
|
||||
if (pts != GST_CLOCK_TIME_NONE)
|
||||
pts -= priv->pts_diff;
|
||||
}
|
||||
priv->gop_pts = pts;
|
||||
if (!priv->pts_diff)
|
||||
priv->pts_diff = priv->seq_pts - priv->gop_pts;
|
||||
|
|
Loading…
Reference in a new issue