Commit 34d03c15 authored by Sebastian Dröge's avatar Sebastian Dröge Committed by Olivier Crête

nicesrc: Keep the mutex locked whenever accessing the queue

https://bugs.freedesktop.org/show_bug.cgi?id=89673
parent 3bdca112
...@@ -205,9 +205,10 @@ gst_nice_src_read_callback (NiceAgent *agent, ...@@ -205,9 +205,10 @@ gst_nice_src_read_callback (NiceAgent *agent,
buffer = gst_buffer_new_and_alloc (len); buffer = gst_buffer_new_and_alloc (len);
memcpy (GST_BUFFER_DATA (buffer), buf, len); memcpy (GST_BUFFER_DATA (buffer), buf, len);
#endif #endif
GST_OBJECT_LOCK (nicesrc);
g_queue_push_tail (nicesrc->outbufs, buffer); g_queue_push_tail (nicesrc->outbufs, buffer);
g_main_loop_quit (nicesrc->mainloop); g_main_loop_quit (nicesrc->mainloop);
GST_OBJECT_UNLOCK (nicesrc);
} }
static gboolean static gboolean
...@@ -285,12 +286,15 @@ gst_nice_src_create ( ...@@ -285,12 +286,15 @@ gst_nice_src_create (
return GST_FLOW_WRONG_STATE; return GST_FLOW_WRONG_STATE;
#endif #endif
} }
GST_OBJECT_UNLOCK (basesrc); if (g_queue_is_empty (nicesrc->outbufs)) {
GST_OBJECT_UNLOCK (basesrc);
if (g_queue_is_empty (nicesrc->outbufs))
g_main_loop_run (nicesrc->mainloop); g_main_loop_run (nicesrc->mainloop);
GST_OBJECT_LOCK (basesrc);
}
*buffer = g_queue_pop_head (nicesrc->outbufs); *buffer = g_queue_pop_head (nicesrc->outbufs);
GST_OBJECT_UNLOCK (basesrc);
if (*buffer != NULL) { if (*buffer != NULL) {
GST_LOG_OBJECT (nicesrc, "Got buffer, pushing"); GST_LOG_OBJECT (nicesrc, "Got buffer, pushing");
return GST_FLOW_OK; return GST_FLOW_OK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment