v4l2src: Set duration on buffers

Use framerate to estimate duration of buffers.

Fixes #590362
This commit is contained in:
Thiago Santos 2009-10-14 07:38:26 -03:00
parent 58b9de4cca
commit 72af90ae31

View file

@ -906,6 +906,7 @@ gst_v4l2src_create (GstPushSrc * src, GstBuffer ** buf)
if (G_LIKELY (ret == GST_FLOW_OK && *buf)) { if (G_LIKELY (ret == GST_FLOW_OK && *buf)) {
GstClock *clock; GstClock *clock;
GstClockTime timestamp; GstClockTime timestamp;
GstClockTime duration = GST_CLOCK_TIME_NONE;
GST_BUFFER_OFFSET (*buf) = v4l2src->offset++; GST_BUFFER_OFFSET (*buf) = v4l2src->offset++;
GST_BUFFER_OFFSET_END (*buf) = v4l2src->offset; GST_BUFFER_OFFSET_END (*buf) = v4l2src->offset;
@ -938,11 +939,14 @@ gst_v4l2src_create (GstPushSrc * src, GstBuffer ** buf)
timestamp -= latency; timestamp -= latency;
else else
timestamp = 0; timestamp = 0;
duration = latency;
} }
} }
/* FIXME: use the timestamp from the buffer itself! */ /* FIXME: use the timestamp from the buffer itself! */
GST_BUFFER_TIMESTAMP (*buf) = timestamp; GST_BUFFER_TIMESTAMP (*buf) = timestamp;
GST_BUFFER_DURATION (*buf) = duration;
} }
return ret; return ret;
} }