codecparsers: include resync marker in video packet size
authorZhao Halley <halley.zhao@intel.com>
Tue, 6 Dec 2011 00:21:19 +0000 (08:21 +0800)
committerThibault Saunier <thibault.saunier@collabora.com>
Tue, 6 Dec 2011 20:05:52 +0000 (17:05 -0300)
gst-libs/gst/codecparsers/gstmpeg4parser.c

index eb9eceb..664aa04 100644 (file)
@@ -394,7 +394,7 @@ gst_mpeg4_next_resync (GstMpeg4Packet * packet,
   if (off2 == -1)
     return GST_MPEG4_PARSER_NO_PACKET_END;
 
-  packet->size = off1 - off2;
+  packet->size = off2 - off1;
 
   return GST_MPEG4_PARSER_OK;
 }
@@ -478,7 +478,11 @@ find_end:
     return GST_MPEG4_PARSER_NO_PACKET_END;
   }
 
-  packet->size = (gsize) off2 - off1 - 3;
+  if (packet->type == GST_MPEG4_RESYNC) {
+    packet->size = (gsize) off2 - off1;
+  } else {
+    packet->size = (gsize) off2 - off1 - 3;
+  }
 
   GST_DEBUG ("Complete packet of type %x found at: %d, Size: %" G_GSSIZE_FORMAT,
       packet->type, packet->offset, packet->size);