queuearray: Only clear dropped item if it is not returned

This commit is contained in:
Sebastian Dröge 2018-10-15 18:47:16 +03:00
parent 2481e542c7
commit fc3602aec8

View file

@ -607,6 +607,7 @@ gst_queue_array_drop_struct (GstQueueArray * array, guint idx,
/* simple case actual_idx == first item */
if (actual_idx == first_item_index) {
/* clear current head position if needed */
if (p_struct == NULL)
gst_queue_array_clear_idx (array, idx);
/* move the head plus one */
@ -619,6 +620,7 @@ gst_queue_array_drop_struct (GstQueueArray * array, guint idx,
/* simple case idx == last item */
if (actual_idx == last_item_index) {
/* clear current tail position if needed */
if (p_struct == NULL)
gst_queue_array_clear_idx (array, idx);
/* move tail minus one, potentially wrapping */
@ -630,6 +632,7 @@ gst_queue_array_drop_struct (GstQueueArray * array, guint idx,
/* non-wrapped case */
if (first_item_index < last_item_index) {
/* clear idx if needed */
if (p_struct == NULL)
gst_queue_array_clear_idx (array, idx);
g_assert (first_item_index < actual_idx && actual_idx < last_item_index);
@ -648,6 +651,7 @@ gst_queue_array_drop_struct (GstQueueArray * array, guint idx,
if (actual_idx < last_item_index) {
/* clear idx if needed */
if (p_struct == NULL)
gst_queue_array_clear_idx (array, idx);
/* actual_idx is before last_item_index, move data towards zero */
@ -663,6 +667,7 @@ gst_queue_array_drop_struct (GstQueueArray * array, guint idx,
if (actual_idx > first_item_index) {
/* clear idx if needed */
if (p_struct == NULL)
gst_queue_array_clear_idx (array, idx);
/* actual_idx is after first_item_index, move data to higher indices */