v4l2object: Ask for a decent buffer size when dealing with encoded formats

https://bugzilla.gnome.org/show_bug.cgi?id=720568
This commit is contained in:
Nicolas Dufresne 2013-12-12 12:18:45 -05:00
parent 86646ce03b
commit 0c8ec43a12

View file

@ -74,6 +74,8 @@ GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
#define DEFAULT_PROP_FREQUENCY 0
#define DEFAULT_PROP_IO_MODE GST_V4L2_IO_AUTO
#define ENCODED_BUFFER_SIZE (1 * 1024 * 1024)
enum
{
PROP_0,
@ -2656,6 +2658,10 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps)
format.fmt.pix_mp.plane_fmt[i].bytesperline =
v4l2object->bytesperline[i];
if (GST_VIDEO_INFO_FORMAT (&info) == GST_VIDEO_FORMAT_ENCODED) {
format.fmt.pix_mp.plane_fmt[0].sizeimage = ENCODED_BUFFER_SIZE;
}
if (v4l2_ioctl (fd, VIDIOC_S_FMT, &format) < 0)
goto set_fmt_failed;
@ -2719,6 +2725,10 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps)
/* try to ask our prefered stride */
format.fmt.pix.bytesperline = v4l2object->bytesperline[0];
if (GST_VIDEO_INFO_FORMAT (&info) == GST_VIDEO_FORMAT_ENCODED) {
format.fmt.pix.sizeimage = ENCODED_BUFFER_SIZE;
}
if (v4l2_ioctl (fd, VIDIOC_S_FMT, &format) < 0)
goto set_fmt_failed;