summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-03-19 09:17:38 +0100
committerOlivier Crête <olivier.crete@collabora.com>2015-04-20 17:32:28 -0400
commit34d03c15a14e9ea46ef2f3201f12b90755154296 (patch)
treee89e8ad8510b3435960f081ea0f8f26d3b2dd168
parent3bdca112833c36bb8b9119441270640971d1170d (diff)
downloadlibnice-34d03c15a14e9ea46ef2f3201f12b90755154296.tar.gz
nicesrc: Keep the mutex locked whenever accessing the queue
https://bugs.freedesktop.org/show_bug.cgi?id=89673
-rw-r--r--gst/gstnicesrc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gst/gstnicesrc.c b/gst/gstnicesrc.c
index f1e17c5..0f1b9d1 100644
--- a/gst/gstnicesrc.c
+++ b/gst/gstnicesrc.c
@@ -205,9 +205,10 @@ gst_nice_src_read_callback (NiceAgent *agent,
buffer = gst_buffer_new_and_alloc (len);
memcpy (GST_BUFFER_DATA (buffer), buf, len);
#endif
+ GST_OBJECT_LOCK (nicesrc);
g_queue_push_tail (nicesrc->outbufs, buffer);
-
g_main_loop_quit (nicesrc->mainloop);
+ GST_OBJECT_UNLOCK (nicesrc);
}
static gboolean
@@ -285,12 +286,15 @@ gst_nice_src_create (
return GST_FLOW_WRONG_STATE;
#endif
}
- GST_OBJECT_UNLOCK (basesrc);
-
- if (g_queue_is_empty (nicesrc->outbufs))
+ if (g_queue_is_empty (nicesrc->outbufs)) {
+ GST_OBJECT_UNLOCK (basesrc);
g_main_loop_run (nicesrc->mainloop);
+ GST_OBJECT_LOCK (basesrc);
+ }
*buffer = g_queue_pop_head (nicesrc->outbufs);
+ GST_OBJECT_UNLOCK (basesrc);
+
if (*buffer != NULL) {
GST_LOG_OBJECT (nicesrc, "Got buffer, pushing");
return GST_FLOW_OK;