ducatividdec: only heed bytesConsumed when not in entire frame mode
[glsdk/gst-plugin-ducati.git] / src / gstducatividdec.c
index 11135dc5c0e07a57e79dd591fbdff5382992f5f4..c3c8737dba0c4bc631210a38bb9acb6aa8377ccf 100644 (file)
@@ -1093,23 +1093,27 @@ have_out_buf:
 
   self->first_in_buffer = FALSE;
 
-  /* The copy could be avoided by playing with the buffer pointer,
-     but it seems to be rare and for not many bytes */
-  GST_DEBUG_OBJECT (self, "Consumed %d/%d (%d) bytes, %d left",
-      self->outArgs->bytesConsumed, self->in_size,
-      self->inArgs->numBytes,
-      self->in_size - self->outArgs->bytesConsumed);
-  if (self->outArgs->bytesConsumed > 0) {
-    if (self->outArgs->bytesConsumed > self->in_size) {
-      GST_WARNING_OBJECT (self, "Codec claims to have used more bytes than supplied");
-      self->in_size = 0;
-    } else {
-      if (self->outArgs->bytesConsumed < self->in_size) {
-        memmove (self->input, self->input + self->outArgs->bytesConsumed,
-            self->in_size - self->outArgs->bytesConsumed);
+  if (self->params->inputDataMode != IVIDEO_ENTIREFRAME) {
+    /* The copy could be avoided by playing with the buffer pointer,
+       but it seems to be rare and for not many bytes */
+    GST_DEBUG_OBJECT (self, "Consumed %d/%d (%d) bytes, %d left",
+        self->outArgs->bytesConsumed, self->in_size,
+        self->inArgs->numBytes,
+        self->in_size - self->outArgs->bytesConsumed);
+    if (self->outArgs->bytesConsumed > 0) {
+      if (self->outArgs->bytesConsumed > self->in_size) {
+        GST_WARNING_OBJECT (self, "Codec claims to have used more bytes than supplied");
+        self->in_size = 0;
+      } else {
+        if (self->outArgs->bytesConsumed < self->in_size) {
+          memmove (self->input, self->input + self->outArgs->bytesConsumed,
+              self->in_size - self->outArgs->bytesConsumed);
+        }
+        self->in_size -= self->outArgs->bytesConsumed;
       }
-      self->in_size -= self->outArgs->bytesConsumed;
     }
+  } else {
+    self->in_size = 0;
   }
 
   if (self->outArgs->outBufsInUseFlag) {