Commit 15b6ea50 authored by Michael Smith's avatar Michael Smith
Browse files

ext/vorbis/vorbisenc.c: Allow very small discontinuities in the timestamps....

ext/vorbis/vorbisenc.c: Allow very small discontinuities in the timestamps. These we can't do anything useful with an...

Original commit message from CVS:
* ext/vorbis/vorbisenc.c:
(gst_vorbis_enc_buffer_check_discontinuous):
Allow very small discontinuities in the timestamps. These we can't
do anything useful with anyway (because vorbis's timestamps have
only sample granularity), and are commonly produced by elements with
minor bugs. Allow up to 1/2 a sample out.
Fixes #351742.
parent 7aea721e
2006-08-25 Michael Smith <msmith@fluendo.com>
* ext/vorbis/vorbisenc.c:
(gst_vorbis_enc_buffer_check_discontinuous):
Allow very small discontinuities in the timestamps. These we can't
do anything useful with anyway (because vorbis's timestamps have
only sample granularity), and are commonly produced by elements with
minor bugs. Allow up to 1/2 a sample out.
Fixes #351742.
2006-08-24 Wim Taymans <wim@fluendo.com>
 
* tests/examples/seek/seek.c: (seek_cb), (start_seek), (stop_seek),
......
......@@ -1003,16 +1003,27 @@ gst_vorbis_enc_buffer_check_discontinuous (GstVorbisEnc * vorbisenc,
if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) {
GST_DEBUG_OBJECT (vorbisenc, "Discont set on incoming buffer");
ret = TRUE;
} else if (vorbisenc->expected_ts != GST_CLOCK_TIME_NONE &&
} else if (GST_BUFFER_TIMESTAMP (buffer) != GST_CLOCK_TIME_NONE &&
vorbisenc->expected_ts != GST_CLOCK_TIME_NONE &&
GST_BUFFER_TIMESTAMP (buffer) != vorbisenc->expected_ts) {
GST_DEBUG_OBJECT (vorbisenc, "Expected TS % " GST_TIME_FORMAT
", buffer TS % " GST_TIME_FORMAT,
GST_TIME_ARGS (vorbisenc->expected_ts),
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
ret = TRUE;
/* It turns out that a lot of elements don't generate perfect streams due
* to rounding errors. So, we permit small errors (< 1/2 a sample) without
* causing a discont.
*/
int halfsample = GST_SECOND / vorbisenc->frequency / 2;
if ((GstClockTimeDiff) (GST_BUFFER_TIMESTAMP (buffer) -
vorbisenc->expected_ts) > halfsample) {
GST_DEBUG_OBJECT (vorbisenc, "Expected TS % " GST_TIME_FORMAT
", buffer TS % " GST_TIME_FORMAT,
GST_TIME_ARGS (vorbisenc->expected_ts),
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
ret = TRUE;
}
}
if (vorbisenc->expected_ts != GST_CLOCK_TIME_NONE) {
if (GST_BUFFER_TIMESTAMP (buffer) != GST_CLOCK_TIME_NONE &&
GST_BUFFER_DURATION (buffer) != GST_CLOCK_TIME_NONE) {
vorbisenc->expected_ts = GST_BUFFER_TIMESTAMP (buffer) +
GST_BUFFER_DURATION (buffer);
} else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment