[vlc-commits] picture_fifo: rework the flush loop on picture

Steve Lhomme git at videolan.org
Wed Sep 23 16:17:51 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Sep 17 15:07:40 2020 +0200| [735e01f54255b1a42bcc4e206aa236aa81fce7b8] | committer: Steve Lhomme

picture_fifo: rework the flush loop on picture

We always check what to do with the picture rather than the the picture chain.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=735e01f54255b1a42bcc4e206aa236aa81fce7b8
---

 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 f75ae5b263..f999ec1a3f 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);
 



More information about the vlc-commits mailing list