[vlc-commits] block: remove block_FifoPace()

Rémi Denis-Courmont git at videolan.org
Thu Mar 19 18:56:16 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Mar 17 20:08:02 2015 +0200| [98503a2fe7e07fe82069e836a87ebad7e8ad98ad] | committer: Rémi Denis-Courmont

block: remove block_FifoPace()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=98503a2fe7e07fe82069e836a87ebad7e8ad98ad
---

 include/vlc_block.h |    2 --
 src/libvlccore.sym  |    1 -
 src/misc/fifo.c     |   40 ----------------------------------------
 3 files changed, 43 deletions(-)

diff --git a/include/vlc_block.h b/include/vlc_block.h
index 6fcf5f2..e8589f6 100644
--- a/include/vlc_block.h
+++ b/include/vlc_block.h
@@ -297,7 +297,6 @@ static inline block_t *block_ChainGather( block_t *p_list )
  ****************************************************************************
  * - block_FifoNew : create and init a new fifo
  * - block_FifoRelease : destroy a fifo and free all blocks in it.
- * - block_FifoPace : wait for a fifo to drain to a specified number of packets or total data size
  * - block_FifoEmpty : free all blocks in a fifo
  * - block_FifoPut : put a block
  * - block_FifoGet : get a packet from the fifo (and wait if it is empty)
@@ -311,7 +310,6 @@ static inline block_t *block_ChainGather( block_t *p_list )
 
 VLC_API block_fifo_t *block_FifoNew( void ) VLC_USED VLC_MALLOC;
 VLC_API void block_FifoRelease( block_fifo_t * );
-VLC_API void block_FifoPace( block_fifo_t *fifo, size_t max_depth, size_t max_size );
 VLC_API void block_FifoEmpty( block_fifo_t * );
 VLC_API void block_FifoPut( block_fifo_t *, block_t * );
 VLC_API block_t * block_FifoGet( block_fifo_t * ) VLC_USED;
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 555f1db..13427ba 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -27,7 +27,6 @@ block_FifoCount
 block_FifoEmpty
 block_FifoGet
 block_FifoNew
-block_FifoPace
 block_FifoPut
 block_FifoRelease
 block_FifoShow
diff --git a/src/misc/fifo.c b/src/misc/fifo.c
index dd97a19..b93ab11 100644
--- a/src/misc/fifo.c
+++ b/src/misc/fifo.c
@@ -43,7 +43,6 @@ struct block_fifo_t
 {
     vlc_mutex_t         lock;                         /* fifo data lock */
     vlc_cond_t          wait;      /**< Wait for data */
-    vlc_cond_t          wait_room; /**< Wait for queue depth to shrink */
 
     block_t             *p_first;
     block_t             **pp_last;
@@ -204,9 +203,6 @@ block_t *vlc_fifo_DequeueUnlocked(block_fifo_t *fifo)
     assert(fifo->i_size >= block->i_buffer);
     fifo->i_size -= block->i_buffer;
 
-    /* We don't know how many threads can queue new packets now. */
-    vlc_cond_broadcast(&fifo->wait_room);
-
     return block;
 }
 
@@ -233,9 +229,6 @@ block_t *vlc_fifo_DequeueAllUnlocked(block_fifo_t *fifo)
     fifo->i_depth = 0;
     fifo->i_size = 0;
 
-    /* We don't know how many threads can queue new packets now. */
-    vlc_cond_broadcast(&fifo->wait_room);
-
     return block;
 }
 
@@ -253,7 +246,6 @@ block_fifo_t *block_FifoNew( void )
 
     vlc_mutex_init( &p_fifo->lock );
     vlc_cond_init( &p_fifo->wait );
-    vlc_cond_init( &p_fifo->wait_room );
     p_fifo->p_first = NULL;
     p_fifo->pp_last = &p_fifo->p_first;
     p_fifo->i_depth = p_fifo->i_size = 0;
@@ -268,7 +260,6 @@ block_fifo_t *block_FifoNew( void )
 void block_FifoRelease( block_fifo_t *p_fifo )
 {
     block_ChainRelease( p_fifo->p_first );
-    vlc_cond_destroy( &p_fifo->wait_room );
     vlc_cond_destroy( &p_fifo->wait );
     vlc_mutex_destroy( &p_fifo->lock );
     free( p_fifo );
@@ -288,37 +279,6 @@ void block_FifoEmpty(block_fifo_t *fifo)
 }
 
 /**
- * Wait until the FIFO gets below a certain size (if needed).
- *
- * Note that if more than one thread writes to the FIFO, you cannot assume that
- * the FIFO is actually below the requested size upon return (since another
- * thread could have refilled it already). This is typically not an issue, as
- * this function is meant for (relaxed) congestion control.
- *
- * This function may be a cancellation point and it is cancel-safe.
- *
- * @param fifo queue to wait on
- * @param max_depth wait until the queue has no more than this many blocks
- *                  (use SIZE_MAX to ignore this constraint)
- * @param max_size wait until the queue has no more than this many bytes
- *                  (use SIZE_MAX to ignore this constraint)
- * @return nothing.
- */
-void block_FifoPace (block_fifo_t *fifo, size_t max_depth, size_t max_size)
-{
-    vlc_testcancel ();
-
-    vlc_mutex_lock (&fifo->lock);
-    while ((fifo->i_depth > max_depth) || (fifo->i_size > max_size))
-    {
-         mutex_cleanup_push (&fifo->lock);
-         vlc_cond_wait (&fifo->wait_room, &fifo->lock);
-         vlc_cleanup_pop ();
-    }
-    vlc_mutex_unlock (&fifo->lock);
-}
-
-/**
  * Immediately queue one block at the end of a FIFO.
  * @param fifo queue
  * @param block head of a block list to queue (may be NULL)



More information about the vlc-commits mailing list