[aravis] gv_stream: use machine time for buffer timestamp if tick frequency is not set.



commit 826aae8cbf490f302e5cdf389a4ddc4603e414a4
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Fri Jun 22 16:13:15 2012 +0200

    gv_stream: use machine time for buffer timestamp if tick frequency is not set.
    
    On some cameras, GevTimestampTickFrequency register does not exist. In
    this case, we now use the local machine time as the buffer time stamp.

 src/arvgvstream.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/arvgvstream.c b/src/arvgvstream.c
index be1a000..6ec8ca1 100644
--- a/src/arvgvstream.c
+++ b/src/arvgvstream.c
@@ -201,8 +201,15 @@ _process_data_leader (ArvGvStreamThreadData *thread_data,
 	frame->buffer->pixel_format = arv_gvsp_packet_get_pixel_format (packet);
 	frame->buffer->frame_id = arv_gvsp_packet_get_frame_id (packet);
 
-	frame->buffer->timestamp_ns = arv_gvsp_packet_get_timestamp (packet,
-								     thread_data->timestamp_tick_frequency);
+	if (G_LIKELY (thread_data->timestamp_tick_frequency != 0))
+		frame->buffer->timestamp_ns = arv_gvsp_packet_get_timestamp (packet,
+									     thread_data->timestamp_tick_frequency);
+	else {
+		GTimeVal time;
+
+		g_get_current_time (&time);
+		frame->buffer->timestamp_ns = ((guint64) time.tv_sec * 1000000000LL) + ((guint64) time.tv_usec * 1000) ;
+	}
 
 	if (frame->packet_data[packet_id].time_us > 0) {
 		thread_data->n_resent_packets++;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]