From 1a2bcc769c698dcd6aa902c71134d8277b95c422 Mon Sep 17 00:00:00 2001 From: Youness Alaoui Date: Wed, 24 Oct 2012 15:25:54 -0400 Subject: [PATCH] androidcamera: Fix timestamping issue --- sys/androidcamera/gstahcsrc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/androidcamera/gstahcsrc.c b/sys/androidcamera/gstahcsrc.c index 8d761151af..fe44ff4c51 100644 --- a/sys/androidcamera/gstahcsrc.c +++ b/sys/androidcamera/gstahcsrc.c @@ -131,6 +131,7 @@ gst_ahc_src_init (GstAHCSrc * self, GstAHCSrcClass * klass) self->data = NULL; self->queue = gst_data_queue_new (_data_queue_check_full, NULL); self->start = FALSE; + self->previous_ts = GST_CLOCK_TIME_NONE; } static void @@ -513,21 +514,18 @@ gst_ahc_src_on_preview_frame (jbyteArray data, gpointer user_data) gst_object_ref (clock); current_ts = gst_clock_get_time (clock) - base_time; + gst_object_unref (clock); if (GST_CLOCK_TIME_IS_VALID (self->previous_ts)) { timestamp = self->previous_ts; duration = current_ts - self->previous_ts; + self->previous_ts = current_ts; } else { /* Drop the first buffer */ + self->previous_ts = current_ts; gst_ah_camera_add_callback_buffer (self->camera, data); return; } - self->previous_ts = current_ts; - gst_object_unref (clock); - gst_base_src_set_do_timestamp (GST_BASE_SRC (self), FALSE); - } else { - gst_base_src_set_do_timestamp (GST_BASE_SRC (self), TRUE); } - //GST_WARNING_OBJECT (self, "Received data buffer %p", data); malloc_data = g_slice_new0 (FreeFuncBuffer); malloc_data->self = self;