Skip to content
Snippets Groups Projects
Commit 7babd896 authored by Steve Lhomme's avatar Steve Lhomme
Browse files

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

parent 7150f0b5
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment