Commit b215d4f2 authored by Seungha Yang's avatar Seungha Yang

videodecoder: Ensure EOS is notified to subclass on draning out

The previous ::parse() call might not called with at_eos == TRUE,
but if internal input adapter was completely consumed, baseclass
may not be prepared for have_frame() on finish() or drain().

This commit makes a chance to new have_frame() for subclass on EOS
even if nothing to be consumed by subclass.
parent 20f037e1
Pipeline #63408 failed with stages
in 101 minutes and 19 seconds
......@@ -881,7 +881,9 @@ gst_video_decoder_parse_available (GstVideoDecoder * dec, gboolean at_eos,
available = gst_adapter_available (priv->input_adapter);
while (available || new_buffer) {
/* call GstVideoDecoder::parse() even if adapter is empty for subclass
* to be able to request new frame from GstVideoDecoder::parse() call */
while (available || new_buffer || at_eos) {
new_buffer = FALSE;
/* current frame may have been parsed and handled,
* so we need to set up a new one when asking subclass to parse */
......@@ -902,6 +904,16 @@ gst_video_decoder_parse_available (GstVideoDecoder * dec, gboolean at_eos,
* Otherwise, this is an implementation bug, and we error out
* after 2 failed attempts */
available = gst_adapter_available (priv->input_adapter);
if (at_eos && !available && priv->current_frame) {
/* We cannot ensure whether subclass will return FLOW_NEED_DATA or FLOW_OK
* here. So when below conditions are met, terminates loop
* - nothing to be consumed by subclass
* - subclass didn't request new frame via _have_frame()
if (!priv->current_frame || available != was_available)
inactive = 0;
else if (++inactive == 2)
......@@ -930,7 +942,7 @@ gst_video_decoder_drain_out (GstVideoDecoder * dec, gboolean at_eos)
/* Forward mode, if unpacketized, give the child class
* a final chance to flush out packets */
if (!priv->packetized) {
ret = gst_video_decoder_parse_available (dec, TRUE, FALSE);
ret = gst_video_decoder_parse_available (dec, at_eos, FALSE);
if (at_eos) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment