diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2012-08-20 09:52:34 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2013-09-13 16:29:46 +0200 |
commit | 9af04d80a5238b529f03724d884ed594da9077dd (patch) | |
tree | 860f44d080a91395a8b221d670210a5aa3d6c566 | |
parent | 6a7f63a8180a51450634e6b8dbcc7e97c6df8228 (diff) | |
download | gst-plugins-good-9af04d80a5238b529f03724d884ed594da9077dd.tar.gz gst-plugins-good-9af04d80a5238b529f03724d884ed594da9077dd.tar.xz |
v4l2: fix copying of encoded buffers
The existence of a GstVideoFormatInfo does not guarantee, that
the buffer contains video frames, so the format must be checked.
Also, for encoded buffers the length is variable and must be set.
https://bugzilla.gnome.org/show_bug.cgi?id=698949
-rw-r--r-- | sys/v4l2/gstv4l2object.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index fee5c3b7a..678645c11 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -2534,7 +2534,10 @@ gboolean gst_v4l2_object_copy (GstV4l2Object * v4l2object, GstBuffer * dest, GstBuffer * src) { - if (v4l2object->info.finfo) { + const GstVideoFormatInfo *finfo = v4l2object->info.finfo; + + if (finfo && (finfo->format != GST_VIDEO_FORMAT_UNKNOWN || + finfo->format != GST_VIDEO_FORMAT_ENCODED)) { GstVideoFrame src_frame, dest_frame; GST_DEBUG_OBJECT (v4l2object->element, "copy video frame"); @@ -2560,6 +2563,7 @@ gst_v4l2_object_copy (GstV4l2Object * v4l2object, GstBuffer * dest, gst_buffer_map (src, &map, GST_MAP_READ); gst_buffer_fill (dest, 0, map.data, map.size); gst_buffer_unmap (src, &map); + gst_buffer_resize (dest, 0, map.size); } GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, v4l2object->element, "slow copy into buffer %p", dest); |