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

Steve Lhomme robux4 at ycbcr.xyz
Thu Sep 17 17:33:29 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 0e5a9a779d3..0698fd0f055 100644
--- a/src/misc/picture_fifo.c
+++ b/src/misc/picture_fifo.c
@@ -107,14 +107,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) ||
@@ -123,7 +124,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