mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
queue2: flush differently, avoiding deadlocks
Don't flush the file by closing and opening it but instead use g_freopen. This avoids a deadlock in shutdown because we emit the temp-location property change with the wrong lock held.
This commit is contained in:
parent
affe0aef6f
commit
49c01cce93
1 changed files with 15 additions and 2 deletions
|
@ -1088,12 +1088,25 @@ gst_queue_close_temp_location_file (GstQueue * queue)
|
|||
queue->temp_file = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_queue_flush_temp_file (GstQueue * queue)
|
||||
{
|
||||
if (queue->temp_file == NULL)
|
||||
return;
|
||||
|
||||
GST_DEBUG_OBJECT (queue, "flushing temp file");
|
||||
|
||||
queue->temp_file = g_freopen (queue->temp_location, "wb+", queue->temp_file);
|
||||
|
||||
queue->writing_pos = 0;
|
||||
queue->reading_pos = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_queue_locked_flush (GstQueue * queue)
|
||||
{
|
||||
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
||||
gst_queue_close_temp_location_file (queue);
|
||||
gst_queue_open_temp_location_file (queue);
|
||||
gst_queue_flush_temp_file (queue);
|
||||
} else {
|
||||
while (!g_queue_is_empty (queue->queue)) {
|
||||
GstMiniObject *data = g_queue_pop_head (queue->queue);
|
||||
|
|
Loading…
Reference in a new issue