diff options
author | Jan Schmidt <thaytan@noraisin.net> | 2015-07-18 18:48:35 +0300 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2020-07-10 18:45:15 +0300 |
commit | e97b50af51b9e607ef48882bc1c813b9fd2cc3bc (patch) | |
tree | cd72909bf53e58a2fb9288ba48676cfd186cf8d0 /sys | |
parent | cda483cb3c18b6666efbdfaf5a4800e30b888606 (diff) |
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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/rpicamsrc/RaspiCapture.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/rpicamsrc/RaspiCapture.c b/sys/rpicamsrc/RaspiCapture.c index 2c18a8242..abe5346cd 100644 --- a/sys/rpicamsrc/RaspiCapture.c +++ b/sys/rpicamsrc/RaspiCapture.c @@ -951,13 +951,15 @@ raspi_capture_fill_buffer(RASPIVID_STATE *state, GstBuffer **bufp, mmal_port_parameter_get(state->encoder_output_port, ¶m.hdr); 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) gst_pts = runtime - offset; } - GST_LOG ("Buf PTS %" G_GINT64_FORMAT " DTS %" G_GINT64_FORMAT - " STC %" G_GINT64_FORMAT " TS %" GST_TIME_FORMAT, - buffer->pts, buffer->dts, param.value, + GST_LOG ("Buf (uS) PTS %" G_GINT64_FORMAT " DTS %" G_GINT64_FORMAT + " STC %" G_GINT64_FORMAT " (latency %" G_GINT64_FORMAT + "uS) TS %" GST_TIME_FORMAT, + buffer->pts, buffer->dts, param.value, param.value - buffer->pts, GST_TIME_ARGS (gst_pts)); } |