[vlc-devel] [PATCH 1/4] picture_fifo: VLC_TICK_INVALID flushes the whole FIFO

Steve Lhomme robux4 at ycbcr.xyz
Tue Jul 3 12:00:01 CEST 2018


---
 include/vlc_picture_fifo.h | 1 +
 src/misc/picture_fifo.c    | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/vlc_picture_fifo.h b/include/vlc_picture_fifo.h
index 2f3a38cb23..5e213ae2a1 100644
--- a/include/vlc_picture_fifo.h
+++ b/include/vlc_picture_fifo.h
@@ -74,6 +74,7 @@ VLC_API void picture_fifo_Push( picture_fifo_t *, picture_t * );
 /**
  * It release all picture inside the fifo that have a lower or equal date
  * if flush_before or higher or equal to if not flush_before than the given one.
+ * Passing VLC_TICK_INVALID on the date releases all the pictures.
  *
  * All pictures inside the fifo will be released by picture_Release.
  */
diff --git a/src/misc/picture_fifo.c b/src/misc/picture_fifo.c
index f53cbcd899..ff373fb13b 100644
--- a/src/misc/picture_fifo.c
+++ b/src/misc/picture_fifo.c
@@ -118,7 +118,8 @@ void picture_fifo_Flush(picture_fifo_t *fifo, vlc_tick_t date, bool flush_before
         picture_t *next = picture->p_next;
 
         picture->p_next = NULL;
-        if (( flush_before && picture->date <= date) ||
+        if ((date == VLC_TICK_INVALID) ||
+            ( flush_before && picture->date <= date) ||
             (!flush_before && picture->date >= date))
             PictureFifoPush(&tmp, picture);
         else
@@ -141,7 +142,7 @@ void picture_fifo_OffsetDate(picture_fifo_t *fifo, vlc_tick_t delta)
 }
 void picture_fifo_Delete(picture_fifo_t *fifo)
 {
-    picture_fifo_Flush(fifo, INT64_MAX, true);
+    picture_fifo_Flush(fifo, VLC_TICK_INVALID, true);
     vlc_mutex_destroy(&fifo->lock);
     free(fifo);
 }
-- 
2.17.0



More information about the vlc-devel mailing list