{audio,video}decoder: Forward SEGMENT_DONE events immediately and drain decoders

Otherwise we're going to wait with draining until the next data comes, which
is a bit suboptimal and might take a long time... or maybe never happens.
This commit is contained in:
Sebastian Dröge 2015-04-06 19:20:00 -07:00
parent 0aa0b89aaf
commit 0c72d0acdf
2 changed files with 31 additions and 0 deletions

View file

@ -2156,6 +2156,18 @@ gst_audio_decoder_sink_eventfunc (GstAudioDecoder * dec, GstEvent * event)
ret = gst_audio_decoder_push_event (dec, event);
break;
case GST_EVENT_SEGMENT_DONE:
GST_AUDIO_DECODER_STREAM_LOCK (dec);
gst_audio_decoder_drain (dec);
GST_AUDIO_DECODER_STREAM_UNLOCK (dec);
/* Forward SEGMENT_DONE because no buffer or serialized event might come after
* SEGMENT_DONE and nothing could trigger another _finish_frame() call. */
if (dec->priv->pending_events)
send_pending_events (dec);
ret = gst_audio_decoder_push_event (dec, event);
break;
case GST_EVENT_EOS:
GST_AUDIO_DECODER_STREAM_LOCK (dec);
gst_audio_decoder_drain (dec);

View file

@ -1071,6 +1071,25 @@ gst_video_decoder_sink_event_default (GstVideoDecoder * decoder,
event = NULL;
break;
}
case GST_EVENT_SEGMENT_DONE:
{
GstFlowReturn flow_ret = GST_FLOW_OK;
flow_ret = gst_video_decoder_drain_out (decoder, TRUE);
ret = (flow_ret == GST_FLOW_OK);
/* Forward SEGMENT_DONE immediately. This is required
* because no buffer or serialized event might come
* after SEGMENT_DONE and nothing could trigger another
* _finish_frame() call.
*
* The subclass can override this behaviour by overriding
* the ::sink_event() vfunc and not chaining up to the
* parent class' ::sink_event() until a later time.
*/
forward_immediate = TRUE;
break;
}
case GST_EVENT_EOS:
{
GstFlowReturn flow_ret = GST_FLOW_OK;