gst/dvdlpcmdec/gstdvdlpcmdec.c: If an incoming timestamp is within one sample of our current timestamp, then keep it....

Original commit message from CVS:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (update_timestamps):
If an incoming timestamp is within one sample of our current
timestamp, then keep it. This prevents imprecision in the
PTS (which only has 90khz granularity) from affecting our stream.
This commit is contained in:
Jan Schmidt 2006-09-28 21:44:49 +00:00
parent 53ce6d70d6
commit 65d7dd9c60
3 changed files with 26 additions and 5 deletions

View file

@ -1,3 +1,10 @@
2006-09-28 Jan Schmidt <thaytan@mad.scientist.com>
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (update_timestamps):
If an incoming timestamp is within one sample of our current
timestamp, then keep it. This prevents imprecision in the
PTS (which only has 90khz granularity) from affecting our stream.
2006-09-28 Tim-Philipp Müller <tim at centricular dot net>
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_handle_src_query):

2
common

@ -1 +1 @@
Subproject commit a8c15b7a2c75fc2bd83850cb17cb05a1ee84ecaf
Subproject commit bdd0108b3540ffadeb82cee28b8867a8a6e7ae78

View file

@ -259,16 +259,30 @@ caps_parse_error:
static void
update_timestamps (GstDvdLpcmDec * dvdlpcmdec, GstBuffer * buf, int samples)
{
gboolean take_buf_ts = FALSE;
GST_BUFFER_DURATION (buf) =
gst_util_uint64_scale (samples, GST_SECOND, dvdlpcmdec->rate);
if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
/* Then leave it as-is, and save this timestamp */
if (GST_CLOCK_TIME_IS_VALID (dvdlpcmdec->timestamp)) {
GstClockTimeDiff one_sample = GST_SECOND / dvdlpcmdec->rate;
GstClockTimeDiff diff = GST_CLOCK_DIFF (GST_BUFFER_TIMESTAMP (buf),
dvdlpcmdec->timestamp);
if (diff > one_sample || diff < -one_sample)
take_buf_ts = TRUE;
} else {
take_buf_ts = TRUE;
}
} else if (!GST_CLOCK_TIME_IS_VALID (dvdlpcmdec->timestamp)) {
dvdlpcmdec->timestamp = dvdlpcmdec->segment_start;
}
if (take_buf_ts) {
/* Take buffer timestamp */
dvdlpcmdec->timestamp = GST_BUFFER_TIMESTAMP (buf);
} else {
if (!GST_CLOCK_TIME_IS_VALID (dvdlpcmdec->timestamp))
dvdlpcmdec->timestamp = dvdlpcmdec->segment_start;
GST_BUFFER_TIMESTAMP (buf) = dvdlpcmdec->timestamp;
}