From 90ce70aa406c964c80f1d3df857073cc01813be7 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Thu, 9 Jun 2005 16:44:31 +0000 Subject: sys/v4l2/gstv4l2src.c: Don't use bytesused/length of a buffer for GST_BUFFER_SIZE(), since length is the allocated le... Original commit message from CVS: * sys/v4l2/gstv4l2src.c: (gst_v4l2src_get): Don't use bytesused/length of a buffer for GST_BUFFER_SIZE(), since length is the allocated length in the kernel, which may be more, and bytesused is not set by all drivers and may be less if part of the frame was lost. Instead, use the calculated piximage size. Fixes #301718. --- ChangeLog | 9 +++++++++ sys/v4l2/gstv4l2src.c | 4 +--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ff99bd7d..609b18b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-06-09 Ronald S. Bultje + + * sys/v4l2/gstv4l2src.c: (gst_v4l2src_get): + Don't use bytesused/length of a buffer for GST_BUFFER_SIZE(), + since length is the allocated length in the kernel, which may + be more, and bytesused is not set by all drivers and may be + less if part of the frame was lost. Instead, use the calculated + piximage size. Fixes #301718. + 2005-06-09 Ronald S. Bultje * gst/adder/gstadder.c: (gst_adder_link): diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 45b60bde..b563d9c6 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -907,9 +907,7 @@ gst_v4l2src_get (GstPad * pad) g_assert (num != -1); GST_LOG_OBJECT (v4l2src, "buffer %d needs %d writes", num, v4l2src->need_writes + 1); - i = v4l2src->pool->buffers[num].buffer.bytesused > - 0 ? v4l2src->pool->buffers[num].buffer.bytesused : v4l2src->pool-> - buffers[num].length; + i = v4l2src->format.fmt.pix.sizeimage; /* check if this is the last buffer in the queue. If so do a memcpy to put it back asap to avoid framedrops and deadlocks because of stupid elements */ if (gst_atomic_int_read (&v4l2src->pool->refcount) == v4l2src->breq.count) { -- cgit v1.2.1