]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gst-plugin-ducati.git/blobdiff - src/gstducatividdec.c
ducatividdec: delay flushing till the end of the codec processing
[glsdk/gst-plugin-ducati.git] / src / gstducatividdec.c
index 198b69ecb31382915f9fc9fdf106db8fe38ed46f..3239647942d101588e6a1bf037f80bf15806bf2c 100644 (file)
@@ -232,6 +232,7 @@ get_buffer_priv (GstDucatiVidDec * self, GstBuffer * buf)
         self->stride, self->padded_height);
 
     gst_ducati_buffer_priv_set (buf, priv);
+    gst_mini_object_unref (GST_MINI_OBJECT (priv));
   }
   return priv;
 }
@@ -312,12 +313,14 @@ codec_process (GstDucatiVidDec * self, gboolean send, gboolean flush,
   if (err) {
     GST_WARNING_OBJECT (self, "err=%d, extendedError=%08x",
         err, self->outArgs->extendedError);
+    gst_ducati_log_extended_error_info (self->outArgs->extendedError);
 
     err = VIDDEC3_control (self->codec, XDM_GETSTATUS,
         self->dynParams, self->status);
-    if (!err) {
+    if (err) {
       GST_WARNING_OBJECT (self, "XDM_GETSTATUS: err=%d, extendedError=%08x",
           err, self->status->extendedError);
+      gst_ducati_log_extended_error_info (self->status->extendedError);
     }
 
     if (flush)
@@ -495,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->needs_flushing = FALSE;
 
   if (G_UNLIKELY (self->first_in_buffer)) {
     goto out;
@@ -1035,6 +1039,7 @@ have_out_buf:
   if (err) {
     GST_ELEMENT_ERROR (self, STREAM, DECODE, (NULL),
         ("process returned error: %d %08x", err, self->outArgs->extendedError));
+    gst_ducati_log_extended_error_info (self->outArgs->extendedError);
     return GST_FLOW_ERROR;
   }
   if (ret != GST_FLOW_OK) {
@@ -1059,6 +1064,9 @@ have_out_buf:
     goto allocate_buffer;
   }
 
+  if (self->needs_flushing)
+    gst_ducati_viddec_codec_flush (self, FALSE);
+
   return GST_FLOW_OK;
 }
 
@@ -1093,6 +1101,7 @@ gst_ducati_viddec_event (GstPad * pad, GstEvent * event)
     case GST_EVENT_FLUSH_STOP:
       if (!gst_ducati_viddec_codec_flush (self, FALSE)) {
         GST_ERROR_OBJECT (self, "could not flush");
+        gst_event_unref (event);
         ret = FALSE;
       }
       gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);