Allocate buffers from downstream element
authorHarinarayan Bhatta <harinarayan@ti.com>
Thu, 3 Apr 2014 10:05:00 +0000 (15:35 +0530)
committerHarinarayan Bhatta <harinarayan@ti.com>
Thu, 3 Apr 2014 10:05:00 +0000 (15:35 +0530)
Due to setting "first_out_buffer" to true by default, this plugin
does not use buffers allocated by downstream peer element. Changing
this to allow for downstream elements such as VPE plugin to allocate
and supply buffers to the decoder.

Signed-off-by: Harinarayan Bhatta <harinarayan@ti.com>
src/gstducatividdec.c

index 38a94b5bb58db072f4f372c775be0570082e3520..6b51ca84d9a5119adf99158cbd3c8bcc354f3d09 100644 (file)
@@ -187,7 +187,7 @@ codec_create (GstDucatiVidDec * self)
   }
 
   self->first_in_buffer = TRUE;
-  self->first_out_buffer = TRUE;
+  self->first_out_buffer = FALSE;
 
   version = dce_alloc (VERSION_LENGTH);
   if (version) {
@@ -472,7 +472,7 @@ codec_process (GstDucatiVidDec * self, gboolean send, gboolean flush,
       GST_INFO_OBJECT (self, "changing interlace field in caps");
       gst_caps_set_simple (caps, "interlaced", G_TYPE_BOOLEAN, interlaced,
           NULL);
-      gst_drm_buffer_pool_set_caps (self->pool, caps);
+      if (self->pool) gst_drm_buffer_pool_set_caps (self->pool, caps);
       if (!gst_pad_set_caps (self->srcpad, caps)) {
         GST_ERROR_OBJECT (self,
             "downstream didn't want to change interlace mode");
@@ -524,7 +524,7 @@ codec_process (GstDucatiVidDec * self, gboolean send, gboolean flush,
        */
       pool = self->pool;
       self->pool = NULL;
-      gst_drm_buffer_pool_destroy (pool);
+      if (pool) gst_drm_buffer_pool_destroy (pool);
     }
 
     if (send) {
@@ -1658,7 +1658,7 @@ gst_ducati_viddec_init (GstDucatiVidDec * self, GstDucatiVidDecClass * klass)
   self->fps_d = -1;
 
   self->first_in_buffer = TRUE;
-  self->first_out_buffer = TRUE;
+  self->first_out_buffer = FALSE;
   self->interlaced = FALSE;
   self->send_crop_event = TRUE;