mpegtspacketizer: avoid timestamp overflows

Cause timing to break in the pipeline that can lead to a stall

https://bugzilla.gnome.org/show_bug.cgi?id=733837
This commit is contained in:
Thiago Santos 2014-07-29 02:11:54 -03:00 committed by Thiago Santos
parent 4c2ce9eac7
commit 1685c45465

View file

@ -2178,8 +2178,13 @@ mpegts_packetizer_pts_to_ts (MpegTSPacketizer2 * packetizer,
*/ */
if (G_UNLIKELY (ABSDIFF (res, pcrtable->last_pcrtime) > 15 * GST_SECOND)) if (G_UNLIKELY (ABSDIFF (res, pcrtable->last_pcrtime) > 15 * GST_SECOND))
res = GST_CLOCK_TIME_NONE; res = GST_CLOCK_TIME_NONE;
else else {
res += pcrtable->base_time + pcrtable->skew - pcrtable->base_pcrtime; GstClockTime tmp = pcrtable->base_time + pcrtable->skew;
if (tmp + res > pcrtable->base_pcrtime)
res += tmp - pcrtable->base_pcrtime;
else
res = GST_CLOCK_TIME_NONE;
}
} else if (packetizer->calculate_offset && pcrtable->groups) { } else if (packetizer->calculate_offset && pcrtable->groups) {
gint64 refpcr = G_MAXINT64, refpcroffset; gint64 refpcr = G_MAXINT64, refpcroffset;
PCROffsetGroup *group = pcrtable->current->group; PCROffsetGroup *group = pcrtable->current->group;