mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
rpicamsrc: Fix buffer PTS calculation
Timestamps from MMAL are in microseconds, so make sure to convert to nanoseconds before using them to adjust the GStreamer buffer time
This commit is contained in:
parent
cda483cb3c
commit
e97b50af51
1 changed files with 6 additions and 4 deletions
|
@ -951,13 +951,15 @@ raspi_capture_fill_buffer(RASPIVID_STATE *state, GstBuffer **bufp,
|
||||||
mmal_port_parameter_get(state->encoder_output_port, ¶m.hdr);
|
mmal_port_parameter_get(state->encoder_output_port, ¶m.hdr);
|
||||||
|
|
||||||
if (param.value != -1 && param.value >= buffer->pts) {
|
if (param.value != -1 && param.value >= buffer->pts) {
|
||||||
GstClockTime offset = param.value - buffer->pts;
|
/* Convert microsecond RPi TS to GStreamer clock: */
|
||||||
|
GstClockTime offset = (param.value - buffer->pts) * 1000;
|
||||||
if (runtime >= offset)
|
if (runtime >= offset)
|
||||||
gst_pts = runtime - offset;
|
gst_pts = runtime - offset;
|
||||||
}
|
}
|
||||||
GST_LOG ("Buf PTS %" G_GINT64_FORMAT " DTS %" G_GINT64_FORMAT
|
GST_LOG ("Buf (uS) PTS %" G_GINT64_FORMAT " DTS %" G_GINT64_FORMAT
|
||||||
" STC %" G_GINT64_FORMAT " TS %" GST_TIME_FORMAT,
|
" STC %" G_GINT64_FORMAT " (latency %" G_GINT64_FORMAT
|
||||||
buffer->pts, buffer->dts, param.value,
|
"uS) TS %" GST_TIME_FORMAT,
|
||||||
|
buffer->pts, buffer->dts, param.value, param.value - buffer->pts,
|
||||||
GST_TIME_ARGS (gst_pts));
|
GST_TIME_ARGS (gst_pts));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue