mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-24 17:44:14 +00:00
ahcsrc: fix deadlock when flushing
_data_queue_item_free() calls gst_buffer_unref(), which calls gst_ahc_src_buffer_free_func(), which calls g_mutex_lock() on self->mutex and there you go... deadlock!
This commit is contained in:
parent
f1809c4d93
commit
9a53d79876
1 changed files with 8 additions and 6 deletions
|
@ -2255,7 +2255,7 @@ gst_ahc_src_on_preview_frame (jbyteArray array, gpointer user_data)
|
||||||
GstClockTime timestamp = GST_CLOCK_TIME_NONE;
|
GstClockTime timestamp = GST_CLOCK_TIME_NONE;
|
||||||
GstClockTime duration = 0;
|
GstClockTime duration = 0;
|
||||||
GstClock *clock;
|
GstClock *clock;
|
||||||
|
gboolean queued = FALSE;
|
||||||
|
|
||||||
g_mutex_lock (&self->mutex);
|
g_mutex_lock (&self->mutex);
|
||||||
|
|
||||||
|
@ -2315,14 +2315,16 @@ gst_ahc_src_on_preview_frame (jbyteArray array, gpointer user_data)
|
||||||
GST_DEBUG_OBJECT (self, "wrapping jni array %p->%p %p->%p", item,
|
GST_DEBUG_OBJECT (self, "wrapping jni array %p->%p %p->%p", item,
|
||||||
item->object, malloc_data, malloc_data->array);
|
item->object, malloc_data, malloc_data->array);
|
||||||
|
|
||||||
if (!gst_data_queue_push (self->queue, item)) {
|
queued = gst_data_queue_push (self->queue, item);
|
||||||
GST_INFO_OBJECT (self, "can't add buffer to queue");
|
|
||||||
/* Can't add buffer to queue. Must be flushing. */
|
|
||||||
_data_queue_item_free (item);
|
|
||||||
}
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
g_mutex_unlock (&self->mutex);
|
g_mutex_unlock (&self->mutex);
|
||||||
|
|
||||||
|
if (item && !queued) {
|
||||||
|
GST_INFO_OBJECT (self, "could not add buffer to queue");
|
||||||
|
/* Can't add buffer to queue. Must be flushing. */
|
||||||
|
_data_queue_item_free (item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue