[vlc-commits] picture_fifo: replace picture_fifo_Peek with picture_fifo_IsEmpty
Steve Lhomme
git at videolan.org
Mon Sep 21 07:13:51 CEST 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Sep 18 13:35:58 2020 +0200| [9d04aca6c07700a481054b7ab193b3cb10dc14d1] | committer: Steve Lhomme
picture_fifo: replace picture_fifo_Peek with picture_fifo_IsEmpty
The only use of picture_fifo_Peek() is to check whether the FIFO is empty.
No need to get a picture and release it just after for that.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9d04aca6c07700a481054b7ab193b3cb10dc14d1
---
include/vlc_picture_fifo.h | 8 ++------
src/libvlccore.sym | 2 +-
src/misc/picture_fifo.c | 8 +++-----
src/video_output/video_output.c | 6 +-----
4 files changed, 7 insertions(+), 17 deletions(-)
diff --git a/include/vlc_picture_fifo.h b/include/vlc_picture_fifo.h
index a5b44e9d87..bb91095ae6 100644
--- a/include/vlc_picture_fifo.h
+++ b/include/vlc_picture_fifo.h
@@ -57,13 +57,9 @@ VLC_API void picture_fifo_Delete( picture_fifo_t * );
VLC_API picture_t * picture_fifo_Pop( picture_fifo_t * ) VLC_USED;
/**
- * It returns the first picture_t pointer from the fifo but does not
- * remove it. The picture returned has been hold for you so you
- * must call picture_Release on it.
- *
- * If the fifo is empty, it return NULL without waiting.
+ * It returns whether the fifo is empty or not.
*/
-VLC_API picture_t * picture_fifo_Peek( picture_fifo_t * ) VLC_USED;
+VLC_API bool picture_fifo_IsEmpty( picture_fifo_t * );
/**
* It saves a picture_t into the fifo.
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 2f9abb6dae..fec60a194c 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -309,7 +309,7 @@ picture_Export
picture_fifo_Delete
picture_fifo_Flush
picture_fifo_New
-picture_fifo_Peek
+picture_fifo_IsEmpty
picture_fifo_Pop
picture_fifo_Push
picture_New
diff --git a/src/misc/picture_fifo.c b/src/misc/picture_fifo.c
index 3c0f6d3df9..f75ae5b263 100644
--- a/src/misc/picture_fifo.c
+++ b/src/misc/picture_fifo.c
@@ -91,15 +91,13 @@ picture_t *picture_fifo_Pop(picture_fifo_t *fifo)
return picture;
}
-picture_t *picture_fifo_Peek(picture_fifo_t *fifo)
+bool picture_fifo_IsEmpty(picture_fifo_t *fifo)
{
vlc_mutex_lock(&fifo->lock);
- picture_t *picture = fifo->first;
- if (picture)
- picture_Hold(picture);
+ bool empty = fifo->first == NULL;
vlc_mutex_unlock(&fifo->lock);
- return picture;
+ return empty;
}
void picture_fifo_Flush(picture_fifo_t *fifo, vlc_tick_t date, bool flush_before)
{
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index dc5e602002..16c3b95dab 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -364,11 +364,7 @@ bool vout_IsEmpty(vout_thread_t *vout)
if (!sys->decoder_fifo)
return true;
- picture_t *picture = picture_fifo_Peek(sys->decoder_fifo);
- if (picture)
- picture_Release(picture);
-
- return !picture;
+ return picture_fifo_IsEmpty(sys->decoder_fifo);
}
void vout_DisplayTitle(vout_thread_t *vout, const char *title)
More information about the vlc-commits
mailing list