[vlc-commits] picture_fifo: use vlc_picture_chain_GetAndClear

Steve Lhomme git at videolan.org
Tue Oct 6 13:27:27 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Sep 25 08:51:43 2020 +0200| [7150f0b54143561a2d174244ddd41fcf79becf64] | committer: Steve Lhomme

picture_fifo: use vlc_picture_chain_GetAndClear

Rename the picture chains to make it clearer who does what.

Use vlc_picture_chain_t for the local picture chains, not a full
picture_fifo_t which is supposed to have a lock.

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

 src/misc/picture_fifo.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/misc/picture_fifo.c b/src/misc/picture_fifo.c
index 076e8d43dd..aa062b2cef 100644
--- a/src/misc/picture_fifo.c
+++ b/src/misc/picture_fifo.c
@@ -92,27 +92,27 @@ void picture_fifo_Flush(picture_fifo_t *fifo, vlc_tick_t date, bool flush_before
 {
     picture_t *picture;
 
-    vlc_mutex_lock(&fifo->lock);
+    vlc_picture_chain_t flush_chain;
 
-    vlc_picture_chain_t old_chain = fifo->pics;
-    PictureFifoReset(fifo);
+    vlc_picture_chain_Init(&flush_chain);
 
-    picture_fifo_t tmp;
-    PictureFifoReset(&tmp);
+    vlc_mutex_lock(&fifo->lock);
+    vlc_picture_chain_t filter_chain;
+    vlc_picture_chain_GetAndClear(&fifo->pics, &filter_chain);
 
-    while ( !vlc_picture_chain_IsEmpty( &old_chain ) ) {
-        picture_t *picture = vlc_picture_chain_PopFront( &old_chain );
+    while ( !vlc_picture_chain_IsEmpty( &filter_chain ) ) {
+        picture_t *picture = vlc_picture_chain_PopFront( &filter_chain );
 
         if ((date == VLC_TICK_INVALID) ||
             ( flush_before && picture->date <= date) ||
             (!flush_before && picture->date >= date))
-            PictureFifoPush(&tmp, picture);
+            vlc_picture_chain_Append( &flush_chain, picture );
         else
             PictureFifoPush(fifo, picture);
     }
     vlc_mutex_unlock(&fifo->lock);
 
-    while ((picture = PictureFifoPop(&tmp)) != NULL)
+    while ((picture = vlc_picture_chain_PopFront(&flush_chain)) != NULL)
         picture_Release(picture);
 }
 void picture_fifo_Delete(picture_fifo_t *fifo)



More information about the vlc-commits mailing list