mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
queue2: fix locking around init_ranges
This fixes a segfault where the ready to paused state change causes freeing and allocation of new ranges while another thread is trying to use them.
This commit is contained in:
parent
0182c0d88b
commit
414911b90a
1 changed files with 5 additions and 0 deletions
|
@ -1198,6 +1198,7 @@ gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length,
|
||||||
queue->current->max_reading_pos = rpos;
|
queue->current->max_reading_pos = rpos;
|
||||||
update_cur_level (queue, queue->current);
|
update_cur_level (queue, queue->current);
|
||||||
}
|
}
|
||||||
|
GST_DEBUG_OBJECT (queue, "waiting for add");
|
||||||
GST_QUEUE2_WAIT_ADD_CHECK (queue, queue->srcresult, out_flushing);
|
GST_QUEUE2_WAIT_ADD_CHECK (queue, queue->srcresult, out_flushing);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2717,6 +2718,7 @@ gst_queue2_change_state (GstElement * element, GstStateChange transition)
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
||||||
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
||||||
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
||||||
if (!gst_queue2_open_temp_location_file (queue))
|
if (!gst_queue2_open_temp_location_file (queue))
|
||||||
|
@ -2733,6 +2735,7 @@ gst_queue2_change_state (GstElement * element, GstStateChange transition)
|
||||||
}
|
}
|
||||||
queue->segment_event_received = FALSE;
|
queue->segment_event_received = FALSE;
|
||||||
queue->starting_segment = NULL;
|
queue->starting_segment = NULL;
|
||||||
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||||
break;
|
break;
|
||||||
|
@ -2752,6 +2755,7 @@ gst_queue2_change_state (GstElement * element, GstStateChange transition)
|
||||||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||||
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
||||||
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
||||||
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
||||||
gst_queue2_close_temp_location_file (queue);
|
gst_queue2_close_temp_location_file (queue);
|
||||||
|
@ -2764,6 +2768,7 @@ gst_queue2_change_state (GstElement * element, GstStateChange transition)
|
||||||
gst_event_unref (queue->starting_segment);
|
gst_event_unref (queue->starting_segment);
|
||||||
queue->starting_segment = NULL;
|
queue->starting_segment = NULL;
|
||||||
}
|
}
|
||||||
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue