ducatividdec: delay flushing till the end of the codec processing
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Tue, 17 Jul 2012 09:58:07 +0000 (09:58 +0000)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Tue, 17 Jul 2012 10:17:32 +0000 (10:17 +0000)
This avoids resetting various state in the middle of processing,
which could lead to buffer leaks, and generally more confusing flow.

src/gstducatih264dec.c
src/gstducatividdec.c
src/gstducatividdec.h

index fa8a8c1da13ecba1c861da3adf01103a4ca4a88b..47456150e086669e681c08c4a73ec1d4270986ca 100644 (file)
@@ -118,7 +118,7 @@ gst_ducati_h264dec_handle_error (GstDucatiVidDec * self, gint ret,
       self->inArgs->inputID = 0;
     }
 
       self->inArgs->inputID = 0;
     }
 
-    gst_ducati_viddec_codec_flush (self, FALSE);
+    self->needs_flushing = TRUE;
   }
 
   ret = parent_class->handle_error (self, ret, extended_error,
   }
 
   ret = parent_class->handle_error (self, ret, extended_error,
index ebb852d5efdb3ba355e4e51cf3512e400975be32..3239647942d101588e6a1bf037f80bf15806bf2c 100644 (file)
@@ -498,6 +498,7 @@ gst_ducati_viddec_codec_flush (GstDucatiVidDec * self, gboolean eos)
   self->ts_may_be_pts = TRUE;
   self->ts_is_pts = FALSE;
   self->wait_keyframe = TRUE;
   self->ts_may_be_pts = TRUE;
   self->ts_is_pts = FALSE;
   self->wait_keyframe = TRUE;
+  self->needs_flushing = FALSE;
 
   if (G_UNLIKELY (self->first_in_buffer)) {
     goto out;
 
   if (G_UNLIKELY (self->first_in_buffer)) {
     goto out;
@@ -1063,6 +1064,9 @@ have_out_buf:
     goto allocate_buffer;
   }
 
     goto allocate_buffer;
   }
 
+  if (self->needs_flushing)
+    gst_ducati_viddec_codec_flush (self, FALSE);
+
   return GST_FLOW_OK;
 }
 
   return GST_FLOW_OK;
 }
 
index a7cae6a081592e709ed4e35754d103e1f889f6ed..0b5e2a536541ce8c1a1c996e55b24c1b8a6e1c25 100644 (file)
@@ -114,6 +114,8 @@ struct _GstDucatiVidDec
 
   gboolean wait_keyframe;
 
 
   gboolean wait_keyframe;
 
+  gboolean needs_flushing;
+
 #define NDTS 32
   GstClockTime dts_queue[NDTS];
   gint dts_ridx, dts_widx;
 #define NDTS 32
   GstClockTime dts_queue[NDTS];
   gint dts_ridx, dts_widx;