[vlc-devel] [PATCH 4/4] picture_fifo: don't check each picture dates if we need to flush all pictures
Steve Lhomme
robux4 at ycbcr.xyz
Fri Sep 25 16:42:01 CEST 2020
---
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 aa062b2ceff..0cf4a835799 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);
--
2.26.2
More information about the vlc-devel
mailing list