mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 10:10:32 +00:00
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.
This commit is contained in:
parent
34eea4d5f2
commit
76d71da1c4
1 changed files with 10 additions and 3 deletions
|
@ -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 %"
|
||||
|
|
Loading…
Reference in a new issue