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
This commit is contained in:
Peter Seiderer 2014-11-14 13:48:51 +01:00 committed by Nicolas Dufresne
parent 8390288a6e
commit f16fe891fb
2 changed files with 9 additions and 2 deletions

View file

@ -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;

View file

@ -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 */