summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPeter Seiderer <ps.report@gmx.net>2014-11-14 13:48:51 +0100
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2015-04-02 17:40:19 -0400
commitf16fe891fb58c1a588bcf84b917eefb8777279b2 (patch)
tree5a920a7df1b8db9ac5381ae8bf355b9da593d4f9 /sys
parent8390288a6e34a240688f27516b88d0578f355057 (diff)
v4l2: use v4l2 capture device sequence counter
Use the v4l2 capture device sequence counter for setting the GstBuffer offset/offset_end values. https://bugzilla.gnome.org/show_bug.cgi?id=745441
Diffstat (limited to 'sys')
-rw-r--r--sys/v4l2/gstv4l2bufferpool.c2
-rw-r--r--sys/v4l2/gstv4l2src.c9
2 files changed, 9 insertions, 2 deletions
diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c
index dec617bc5..7c963cc57 100644
--- a/sys/v4l2/gstv4l2bufferpool.c
+++ b/sys/v4l2/gstv4l2bufferpool.c
@@ -1247,6 +1247,8 @@ gst_v4l2_buffer_pool_dqbuf (GstV4l2BufferPool * pool, GstBuffer ** buffer)
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_CORRUPTED);
GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
+ GST_BUFFER_OFFSET (outbuf) = group->buffer.sequence;
+ GST_BUFFER_OFFSET_END (outbuf) = group->buffer.sequence + 1;
done:
*buffer = outbuf;
diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c
index 28a2d0fda..e4b068702 100644
--- a/sys/v4l2/gstv4l2src.c
+++ b/sys/v4l2/gstv4l2src.c
@@ -778,8 +778,13 @@ retry:
}
/* set buffer metadata */
- GST_BUFFER_OFFSET (*buf) = v4l2src->offset++;
- GST_BUFFER_OFFSET_END (*buf) = v4l2src->offset;
+
+ /* use generated offset values only if there are not already valid ones
+ * set by the v4l2 device */
+ if (!GST_BUFFER_OFFSET_IS_VALID (*buf) || !GST_BUFFER_OFFSET_END_IS_VALID (*buf)) {
+ GST_BUFFER_OFFSET (*buf) = v4l2src->offset++;
+ GST_BUFFER_OFFSET_END (*buf) = v4l2src->offset;
+ }
if (G_LIKELY (abs_time != GST_CLOCK_TIME_NONE)) {
/* the time now is the time of the clock minus the base time */