[vlc-devel] [PATCH v2 07/24] picture_fifo: rework the flush loop on picture

Steve Lhomme robux4 at ycbcr.xyz
Fri Sep 18 16:45:13 CEST 2020


We always check what to do with the picture rather than the the picture chain.
---
 src/misc/picture_fifo.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/misc/picture_fifo.c b/src/misc/picture_fifo.c
index f349a89ce88..dbab0bf9bf7 100644
--- a/src/misc/picture_fifo.c
+++ b/src/misc/picture_fifo.c
@@ -105,14 +105,15 @@ void picture_fifo_Flush(picture_fifo_t *fifo, vlc_tick_t date, bool flush_before
 
     vlc_mutex_lock(&fifo->lock);
 
-    picture = fifo->first;
+    picture_t *old_fifo = fifo->first;
     PictureFifoReset(fifo);
 
     picture_fifo_t tmp;
     PictureFifoReset(&tmp);
 
-    while (picture) {
-        picture_t *next = picture->p_next;
+    while (old_fifo) {
+        picture = old_fifo;
+        old_fifo = old_fifo->p_next;
 
         picture->p_next = NULL;
         if ((date == VLC_TICK_INVALID) ||
@@ -121,7 +122,6 @@ void picture_fifo_Flush(picture_fifo_t *fifo, vlc_tick_t date, bool flush_before
             PictureFifoPush(&tmp, picture);
         else
             PictureFifoPush(fifo, picture);
-        picture = next;
     }
     vlc_mutex_unlock(&fifo->lock);
 
-- 
2.26.2



More information about the vlc-devel mailing list