mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
androidcamera: Drop frames if we don't have a clock and var rename
This commit is contained in:
parent
691ab727b0
commit
acb15e4178
1 changed files with 9 additions and 5 deletions
|
@ -440,6 +440,7 @@ end:
|
||||||
gst_ahc_parameters_free (params);
|
gst_ahc_parameters_free (params);
|
||||||
|
|
||||||
if (ret && self->start) {
|
if (ret && self->start) {
|
||||||
|
GST_DEBUG_OBJECT (self, "Starting preview");
|
||||||
ret = gst_ah_camera_start_preview (self->camera);
|
ret = gst_ah_camera_start_preview (self->camera);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
/* Need to reset callbacks after every startPreview */
|
/* Need to reset callbacks after every startPreview */
|
||||||
|
@ -512,7 +513,7 @@ _data_queue_item_free (GstDataQueueItem * item)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_ahc_src_on_preview_frame (jbyteArray data, gpointer user_data)
|
gst_ahc_src_on_preview_frame (jbyteArray array, gpointer user_data)
|
||||||
{
|
{
|
||||||
GstAHCSrc *self = GST_AHC_SRC (user_data);
|
GstAHCSrc *self = GST_AHC_SRC (user_data);
|
||||||
JNIEnv *env = gst_dvm_get_env ();
|
JNIEnv *env = gst_dvm_get_env ();
|
||||||
|
@ -523,7 +524,7 @@ gst_ahc_src_on_preview_frame (jbyteArray data, gpointer user_data)
|
||||||
GstClockTime duration = 0;
|
GstClockTime duration = 0;
|
||||||
GstClock *clock;
|
GstClock *clock;
|
||||||
|
|
||||||
if (data == NULL) {
|
if (array == NULL) {
|
||||||
GST_DEBUG_OBJECT (self, "Size of array in queue is too small, dropping it");
|
GST_DEBUG_OBJECT (self, "Size of array in queue is too small, dropping it");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -542,15 +543,18 @@ gst_ahc_src_on_preview_frame (jbyteArray data, gpointer user_data)
|
||||||
} else {
|
} else {
|
||||||
/* Drop the first buffer */
|
/* Drop the first buffer */
|
||||||
self->previous_ts = current_ts;
|
self->previous_ts = current_ts;
|
||||||
gst_ah_camera_add_callback_buffer (self->camera, data);
|
gst_ah_camera_add_callback_buffer (self->camera, array);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
gst_ah_camera_add_callback_buffer (self->camera, array);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
//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 = gst_object_ref (self);
|
malloc_data->self = gst_object_ref (self);
|
||||||
malloc_data->array = (*env)->NewGlobalRef (env, data);
|
malloc_data->array = (*env)->NewGlobalRef (env, array);
|
||||||
malloc_data->data = (*env)->GetByteArrayElements (env, data, NULL);
|
malloc_data->data = (*env)->GetByteArrayElements (env, array, NULL);
|
||||||
|
|
||||||
buffer = gst_buffer_new ();
|
buffer = gst_buffer_new ();
|
||||||
GST_BUFFER_DATA (buffer) = (guint8 *) malloc_data->data;
|
GST_BUFFER_DATA (buffer) = (guint8 *) malloc_data->data;
|
||||||
|
|
Loading…
Reference in a new issue