From 9262e000070239bf63bd8b2a1e4f6f34d79bfb5e Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 24 Aug 2012 22:12:48 +0200 Subject: [PATCH] videodecoder: parsing loop must ensure for a current frame --- gst-libs/gst/video/gstvideodecoder.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c index 0097241716..39f619577c 100644 --- a/gst-libs/gst/video/gstvideodecoder.c +++ b/gst-libs/gst/video/gstvideodecoder.c @@ -905,12 +905,13 @@ gst_video_decoder_handle_eos (GstVideoDecoder * dec) /* Forward mode, if unpacketized, give the child class * a final chance to flush out packets */ if (!priv->packetized) { - if (priv->current_frame == NULL) - priv->current_frame = gst_video_decoder_new_frame (dec); + while (ret == GST_FLOW_OK && gst_adapter_available (priv->input_adapter)) { + if (priv->current_frame == NULL) + priv->current_frame = gst_video_decoder_new_frame (dec); - while (ret == GST_FLOW_OK && gst_adapter_available (priv->input_adapter)) ret = decoder_class->parse (dec, priv->current_frame, priv->input_adapter, TRUE); + } } } else { /* Reverse playback mode */ @@ -1651,6 +1652,11 @@ gst_video_decoder_chain_forward (GstVideoDecoder * decoder, goto beach; do { + /* current frame may have been parsed and handled, + * so we need to set up a new one when asking subclass to parse */ + if (priv->current_frame == NULL) + priv->current_frame = gst_video_decoder_new_frame (decoder); + ret = klass->parse (decoder, priv->current_frame, priv->input_adapter, at_eos); } while (ret == GST_FLOW_OK && gst_adapter_available (priv->input_adapter));