[vlc-devel] [PATCH] block: zero counters on block_FifoEmpty()

RĂ©mi Denis-Courmont remi at remlab.net
Wed Jun 3 18:31:29 CEST 2020


Call vlc_fifo_DequeueAllUnlocked() so that the block and byte counters
are correctly reset to zero.

Refs #24811.
---
 include/vlc_block.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/vlc_block.h b/include/vlc_block.h
index b57b4698cb..1acf4aa925 100644
--- a/include/vlc_block.h
+++ b/include/vlc_block.h
@@ -642,7 +642,12 @@ static inline void vlc_fifo_Cleanup(void *fifo)
  */
 static inline void block_FifoEmpty(block_fifo_t *fifo)
 {
-    block_ChainRelease((block_t *)vlc_queue_DequeueAll(vlc_fifo_queue(fifo)));
+    block_t *block;
+
+    vlc_fifo_Lock(fifo);
+    block = vlc_fifo_DequeueAllUnlocked(fifo);
+    vlc_fifo_Unlock(fifo);
+    block_ChainRelease(block);
 }
 
 /**
-- 
2.27.0



More information about the vlc-devel mailing list