[vlc-commits] picture_fifo: don't check each picture dates if we need to flush all pictures

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Sep 25 09:00:13 2020 +0200| [7babd8962b7bd03a8995ee2d8ce10ab4436c24b0] | committer: Steve Lhomme

picture_fifo: don't check each picture dates if we need to flush all pictures

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

 src/misc/picture_fifo.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/misc/picture_fifo.c b/src/misc/picture_fifo.c
index aa062b2cef..0cf4a83579 100644
--- a/src/misc/picture_fifo.c
+++ b/src/misc/picture_fifo.c
@@ -97,18 +97,21 @@ void picture_fifo_Flush(picture_fifo_t *fifo, vlc_tick_t date, bool flush_before
     vlc_picture_chain_Init(&flush_chain);
 
     vlc_mutex_lock(&fifo->lock);
-    vlc_picture_chain_t filter_chain;
-    vlc_picture_chain_GetAndClear(&fifo->pics, &filter_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))
-            vlc_picture_chain_Append( &flush_chain, picture );
-        else
-            PictureFifoPush(fifo, picture);
+    if (date == VLC_TICK_INVALID)
+        vlc_picture_chain_GetAndClear(&fifo->pics, &flush_chain);
+    else {
+        vlc_picture_chain_t filter_chain;
+        vlc_picture_chain_GetAndClear(&fifo->pics, &filter_chain);
+
+        while ( !vlc_picture_chain_IsEmpty( &filter_chain ) ) {
+            picture_t *picture = vlc_picture_chain_PopFront( &filter_chain );
+
+            if (( flush_before && picture->date <= date) ||
+                (!flush_before && picture->date >= date))
+                vlc_picture_chain_Append( &flush_chain, picture );
+            else
+                PictureFifoPush(fifo, picture);
+        }
     }
     vlc_mutex_unlock(&fifo->lock);
 



More information about the vlc-commits mailing list