[Bug 682589] h264parse parse data error when AVC head only 2 bytes

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Tue Aug 28 01:16:21 PDT 2012


https://bugzilla.gnome.org/show_bug.cgi?id=682589
  GStreamer | gst-plugins-bad | 0.11.x

--- Comment #5 from zhangyanping <zhangyanping210 at yahoo.com.cn> 2012-08-28 08:16:16 UTC ---
Hello all,

       I resoloved this problems.

       In gst\videoparsers]gsth264parse.c 

static GstBuffer *
gst_h264_parse_wrap_nal (GstH264Parse * h264parse, guint format, guint8 * data,
                         guint size)
{
      ......
      //old is this
      //buf = gst_buffer_new_allocate (NULL, nl + size, NULL); 

     //change to this
      buf = gst_buffer_new_allocate (NULL, 4 + size, NULL); 
     ......
}

Because the first 4 bytes are 00 00 00 01. If the nl is 2, the data buffer is
not enough, and will drop the last 2 bytes. So change it to 4 will be OK.

In the gstreamer-0.10 version, the codes like this:
/* make a buffer consisting of a 4-byte start code following by
 * (a copy of) given nal data */
static GstBuffer *
gst_h264_parse_make_nal (GstH264Parse * h264parse, const guint8 * data,
    guint len)
{
  GstBuffer *buf;

  buf = gst_buffer_new_and_alloc (4 + len);
  GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf), 1);
  memcpy (GST_BUFFER_DATA (buf) + 4, data, len);

  return buf;
}


Hope it will be useful to you, and release the 0.11 stable version  as soon as
possible.

Thanks.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list