mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
androidcamera: Fix timestamping issue
This commit is contained in:
parent
25896c5ab7
commit
1a2bcc769c
1 changed files with 4 additions and 6 deletions
|
@ -131,6 +131,7 @@ gst_ahc_src_init (GstAHCSrc * self, GstAHCSrcClass * klass)
|
||||||
self->data = NULL;
|
self->data = NULL;
|
||||||
self->queue = gst_data_queue_new (_data_queue_check_full, NULL);
|
self->queue = gst_data_queue_new (_data_queue_check_full, NULL);
|
||||||
self->start = FALSE;
|
self->start = FALSE;
|
||||||
|
self->previous_ts = GST_CLOCK_TIME_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -513,21 +514,18 @@ gst_ahc_src_on_preview_frame (jbyteArray data, gpointer user_data)
|
||||||
|
|
||||||
gst_object_ref (clock);
|
gst_object_ref (clock);
|
||||||
current_ts = gst_clock_get_time (clock) - base_time;
|
current_ts = gst_clock_get_time (clock) - base_time;
|
||||||
|
gst_object_unref (clock);
|
||||||
if (GST_CLOCK_TIME_IS_VALID (self->previous_ts)) {
|
if (GST_CLOCK_TIME_IS_VALID (self->previous_ts)) {
|
||||||
timestamp = self->previous_ts;
|
timestamp = self->previous_ts;
|
||||||
duration = current_ts - self->previous_ts;
|
duration = current_ts - self->previous_ts;
|
||||||
|
self->previous_ts = current_ts;
|
||||||
} else {
|
} else {
|
||||||
/* Drop the first buffer */
|
/* Drop the first buffer */
|
||||||
|
self->previous_ts = current_ts;
|
||||||
gst_ah_camera_add_callback_buffer (self->camera, data);
|
gst_ah_camera_add_callback_buffer (self->camera, data);
|
||||||
return;
|
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);
|
//GST_WARNING_OBJECT (self, "Received data buffer %p", data);
|
||||||
malloc_data = g_slice_new0 (FreeFuncBuffer);
|
malloc_data = g_slice_new0 (FreeFuncBuffer);
|
||||||
malloc_data->self = self;
|
malloc_data->self = self;
|
||||||
|
|
Loading…
Reference in a new issue