mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
v4l2src: Set duration on buffers
Use framerate to estimate duration of buffers. Fixes #590362
This commit is contained in:
parent
58b9de4cca
commit
72af90ae31
1 changed files with 4 additions and 0 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue