mpeg2: fix PTS cache for GOP start.

If the GOP temporal sequence number (TSN) is interpolated from a valid
PTS, then we need to compensate that PTS corresponding to the start of
GOP with the next picture to be decoded, which shall be an I-frame,
based on its sequence number.

https://bugzilla.gnome.org/show_bug.cgi?id=748676
This commit is contained in:
Gwenole Beauchesne 2015-05-26 13:28:32 +02:00
parent d6255be939
commit efc07f6bb1

View file

@ -128,11 +128,16 @@ pts_eval(PTSGenerator *tsg, GstClockTime pic_pts, guint pic_tsn)
GstClockTime pts;
if (!GST_CLOCK_TIME_IS_VALID(tsg->gop_pts))
tsg->gop_pts = 0;
tsg->gop_pts = pts_get_duration(tsg, pic_tsn);
pts = pic_pts;
if (!GST_CLOCK_TIME_IS_VALID (pts))
pts = tsg->gop_pts + pts_get_duration(tsg, tsg->ovl_tsn * 1024 + pic_tsn);
else if (pts == tsg->gop_pts) {
/* The picture following the GOP header shall be an I-frame.
So we can compensate for the GOP start time from here */
tsg->gop_pts -= pts_get_duration(tsg, pic_tsn);
}
if (!GST_CLOCK_TIME_IS_VALID(tsg->max_pts) || tsg->max_pts < pts)
tsg->max_pts = pts;