{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:
parent
0aa0b89aaf
commit
0c72d0acdf
@ -2156,6 +2156,18 @@ gst_audio_decoder_sink_eventfunc (GstAudioDecoder * dec, GstEvent * event)
|
|||||||
ret = gst_audio_decoder_push_event (dec, event);
|
ret = gst_audio_decoder_push_event (dec, event);
|
||||||
break;
|
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:
|
case GST_EVENT_EOS:
|
||||||
GST_AUDIO_DECODER_STREAM_LOCK (dec);
|
GST_AUDIO_DECODER_STREAM_LOCK (dec);
|
||||||
gst_audio_decoder_drain (dec);
|
gst_audio_decoder_drain (dec);
|
||||||
|
@ -1071,6 +1071,25 @@ gst_video_decoder_sink_event_default (GstVideoDecoder * decoder,
|
|||||||
event = NULL;
|
event = NULL;
|
||||||
break;
|
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:
|
case GST_EVENT_EOS:
|
||||||
{
|
{
|
||||||
GstFlowReturn flow_ret = GST_FLOW_OK;
|
GstFlowReturn flow_ret = GST_FLOW_OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user