mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-10 10:04:23 +00:00
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.
This commit is contained in:
parent
7aea721e66
commit
15b6ea50d6
2 changed files with 28 additions and 7 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue