From 7c0f885ad246efd18b21c35a9c7f3200828a652c Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sat, 31 Jan 2015 05:09:46 +1100 Subject: [PATCH] audiodecoder: Fix reverse playback when there's only one gather set. The decoder can fail to drain on EOS if there was only one gather set, because it will never have sent the segment event downstream and set the output segment, and fail to detect that the rate < 0.0 Make sure to send pending events before sending all the gather data for decode. --- gst-libs/gst/audio/gstaudiodecoder.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c index 2ba58aa725..0b768b1be9 100644 --- a/gst-libs/gst/audio/gstaudiodecoder.c +++ b/gst-libs/gst/audio/gstaudiodecoder.c @@ -1444,6 +1444,9 @@ gst_audio_decoder_drain (GstAudioDecoder * dec) if (dec->priv->drained && !dec->priv->gather) return GST_FLOW_OK; else { + /* Send any pending events before draining, as that + * may update the pending segment info */ + send_pending_events (dec); /* dispatch reverse pending buffers */ /* chain eventually calls upon drain as well, but by that time * gather list should be clear, so ok ... */ @@ -2052,7 +2055,7 @@ gst_audio_decoder_sink_eventfunc (GstAudioDecoder * dec, GstEvent * event) } /* prepare for next segment */ - /* Use the segment start as a base timstamp + /* Use the segment start as a base timestamp * in case upstream does not come up with anything better * (e.g. upstream BYTE) */ if (format != GST_FORMAT_TIME) {