summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2013-03-31 13:46:30 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2013-03-31 13:46:30 +0200
commit76d71da1c4a90730a4dfa5a595bb48e1cdd3fa8f (patch)
treebef42c1e96761779ca9377cd519ff663c0c09dc3
parent34eea4d5f27f430b475bd04de5ed90bee9fceb68 (diff)
audiodecoder: don't make negative timestamp
Clamp timestamp interpollation to 0 to avoid going negative. This should not happen, really, but until the interpolation is improved this seems better.
-rw-r--r--gst-libs/gst/audio/gstaudiodecoder.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c
index 9901d0c4f..e8908a1dc 100644
--- a/gst-libs/gst/audio/gstaudiodecoder.c
+++ b/gst-libs/gst/audio/gstaudiodecoder.c
@@ -1488,13 +1488,20 @@ gst_audio_decoder_flush_decode (GstAudioDecoder * dec)
timestamp = GST_CLOCK_TIME_NONE;
while (priv->queued) {
GstBuffer *buf = GST_BUFFER_CAST (priv->queued->data);
+ GstClockTime duration;
+
+ duration = GST_BUFFER_DURATION (buf);
/* duration should always be valid for raw audio */
- g_assert (GST_BUFFER_DURATION_IS_VALID (buf));
+ g_assert (GST_CLOCK_TIME_IS_VALID (duration));
/* interpolate (backward) if needed */
- if (G_LIKELY (timestamp != -1))
- timestamp -= GST_BUFFER_DURATION (buf);
+ if (G_LIKELY (timestamp != -1)) {
+ if (timestamp > duration)
+ timestamp -= duration;
+ else
+ timestamp = 0;
+ }
if (!GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
GST_LOG_OBJECT (dec, "applying reverse interpolated ts %"