avdec_h264 can't decide on src caps

Sebastian Dröge sebastian at centricular.com
Fri Oct 30 04:11:51 PDT 2015


On Do, 2015-10-29 at 15:49 +0000, Klaas Jan Russcher wrote:
> The problem was indeed that the encoder did not receive any data. I
> set property "disable-passthrough" of the h264parse to true and then
> is showed for each pushed buffer "received invalid RTP payload".
> 
> I had no idea what I was doing wrong. Then I saw that GstBuffer has a
> function gst_buffer_memcmp(). In the following code I compared
> 'buffer' to 'data'. To my surprise 'buffer' and 'data' weren't the
> same.
> Code (not working):
> 	GstBuffer *buffer = video.PullBuffer();
> 	bufferSize = gst_buffer_get_size( buffer );
> 	unsigned char *data = new unsigned char[bufferSize];
> 	memcpy( data, buffer, bufferSize );
> 
> Then I replaced memcpy with gst_buffer_extract(). gst_buffer_memcmp()
> shown now that 'buffer' is the same as 'data'.
> Code (working):
> 	GstBuffer *buffer = video.PullBuffer();
> 	bufferSize = gst_buffer_get_size( buffer );
> 	unsigned char *data = new unsigned char[bufferSize];
> 	gst_buffer_extract( buffer, 0, data, bufferSize );
> 
> Is there anybody who can tell me what the difference is between
> memcpy and gst_buffer_extract? To my knowledge they do exactly the
> same, but apparently gst_buffer_extract does something

You're memcpying the data into a GstBuffer pointer. I'm surprised this
didn't crash :)

gst_buffer_extract() is basically:

  GstMapInfo map;
  gst_buffer_map(buffer, &map, GST_MAP_READ);
  memcpy(data, map.data, map.size);
  gst_buffer_unmap(buffer, &map);

Hope this helps!

-- 
Sebastian Dröge, Centricular Ltd · http://www.centricular.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20151030/90889168/attachment.sig>


More information about the gstreamer-devel mailing list