summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2017-12-21 13:47:52 +0200
committerSebastian Dröge <sebastian@centricular.com>2017-12-21 13:47:52 +0200
commitd431ef71907ba6c7be78777e4ac9f5794af5d60e (patch)
tree577b19144c9444c2fa0f032480b66ce6ca9b9f6d
parent70104857b019a9df82091572672fd8d91ee17ab0 (diff)
downloadbuffer: Don't hold the mutex while posint the download-complete message
Something might handle it from a sync message handler and call back into downloadbuffer, causing a deadlock.
-rw-r--r--plugins/elements/gstdownloadbuffer.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/elements/gstdownloadbuffer.c b/plugins/elements/gstdownloadbuffer.c
index beff9dba3..6f67e78b6 100644
--- a/plugins/elements/gstdownloadbuffer.c
+++ b/plugins/elements/gstdownloadbuffer.c
@@ -1277,19 +1277,19 @@ write_error:
}
completed:
{
+ GstMessage *complete_message;
+
GST_LOG_OBJECT (dlbuf, "we completed the download");
dlbuf->write_pos = dlbuf->upstream_size;
dlbuf->filling = FALSE;
update_levels (dlbuf, dlbuf->max_level.bytes);
msg = update_buffering (dlbuf);
-
- gst_element_post_message (GST_ELEMENT_CAST (dlbuf),
- gst_message_new_element (GST_OBJECT_CAST (dlbuf),
- gst_structure_new ("GstCacheDownloadComplete",
- "location", G_TYPE_STRING, dlbuf->temp_location, NULL)));
-
+ complete_message = gst_message_new_element (GST_OBJECT_CAST (dlbuf),
+ gst_structure_new ("GstCacheDownloadComplete",
+ "location", G_TYPE_STRING, dlbuf->temp_location, NULL));
GST_DOWNLOAD_BUFFER_MUTEX_UNLOCK (dlbuf);
+ gst_element_post_message (GST_ELEMENT_CAST (dlbuf), complete_message);
if (msg != NULL)
gst_element_post_message (GST_ELEMENT_CAST (dlbuf), msg);