gst-libs/gst/audio/gstbaseaudiosink.c: Don't try to align a sample to an unknown value.

Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render):
Don't try to align a sample to an unknown value.
This commit is contained in:
Wim Taymans 2006-07-24 16:47:10 +00:00
parent f3ae89426a
commit d5a10b05c2
2 changed files with 13 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2006-07-24 Wim Taymans <wim@fluendo.com>
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render):
Don't try to align a sample to an unknown value.
2006-07-24 Wim Taymans <wim@fluendo.com> 2006-07-24 Wim Taymans <wim@fluendo.com>
* gst-libs/gst/audio/gstbaseaudiosink.c: * gst-libs/gst/audio/gstbaseaudiosink.c:

View file

@ -593,6 +593,12 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
goto no_align; goto no_align;
} }
if (G_UNLIKELY (sink->next_sample == -1)) {
GST_DEBUG_OBJECT (sink,
"no align possible: no previous sample position known");
goto no_align;
}
/* now try to align the sample to the previous one */ /* now try to align the sample to the previous one */
diff = ABS ((gint64) render_offset - (gint64) sink->next_sample); diff = ABS ((gint64) render_offset - (gint64) sink->next_sample);
@ -600,7 +606,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
* should be enough to compensate for various rounding errors in the timestamp * should be enough to compensate for various rounding errors in the timestamp
* and sample offset position. We always resync if we got a discont anyway and * and sample offset position. We always resync if we got a discont anyway and
* non-discont should be aligned by definition. */ * non-discont should be aligned by definition. */
if (diff < ringbuf->spec.rate / DIFF_TOLERANCE) { if (G_LIKELY (diff < ringbuf->spec.rate / DIFF_TOLERANCE)) {
GST_DEBUG_OBJECT (sink, GST_DEBUG_OBJECT (sink,
"align with prev sample, %" G_GINT64_FORMAT " < %lu", diff, "align with prev sample, %" G_GINT64_FORMAT " < %lu", diff,
ringbuf->spec.rate / DIFF_TOLERANCE); ringbuf->spec.rate / DIFF_TOLERANCE);