imperxflexsrc: fix timestamps

Previous implementation was trying to be too clever. If we want absolute
timestamps we can use the timestamp/x-unix reference time meta.
This commit is contained in:
Joshua M. Doe 2019-10-30 14:51:39 -04:00
parent b500b4b24b
commit d705291cbd

View File

@ -640,9 +640,16 @@ gst_framelinksrc_callback (void *lpUserData, VCECLB_FrameInfoEx * pFrameInfo)
static guint64 last_frame_number = 0; static guint64 last_frame_number = 0;
static guint64 buffers_processed = 0; static guint64 buffers_processed = 0;
static guint64 total_dropped_frames = 0; static guint64 total_dropped_frames = 0;
GstClock *clock;
GstClockTime timestamp;
g_assert (src != NULL); g_assert (src != NULL);
clock = gst_element_get_clock (GST_ELEMENT (src));
timestamp = GST_CLOCK_DIFF (gst_element_get_base_time (GST_ELEMENT (src)),
gst_clock_get_time (clock));
gst_object_unref (clock);
/* check for DMA errors */ /* check for DMA errors */
if (pFrameInfo->dma_status == VCECLB_DMA_STATUS_FRAME_DROP) { if (pFrameInfo->dma_status == VCECLB_DMA_STATUS_FRAME_DROP) {
/* TODO: save this in dropped frame total? */ /* TODO: save this in dropped frame total? */
@ -691,9 +698,8 @@ gst_framelinksrc_callback (void *lpUserData, VCECLB_FrameInfoEx * pFrameInfo)
src->buffer = gst_framelinksrc_create_buffer_from_frameinfo (src, pFrameInfo); src->buffer = gst_framelinksrc_create_buffer_from_frameinfo (src, pFrameInfo);
GST_BUFFER_TIMESTAMP (src->buffer) = GST_BUFFER_TIMESTAMP (src->buffer) = timestamp;
GST_CLOCK_DIFF (gst_element_get_base_time (GST_ELEMENT (src)),
src->acq_start_time + pFrameInfo->timestamp * GST_USECOND);
GST_BUFFER_OFFSET (src->buffer) = buffers_processed; GST_BUFFER_OFFSET (src->buffer) = buffers_processed;
++buffers_processed; ++buffers_processed;