Commit a2f64f8a authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Allow block_FifoPut(fifo,NULL)

parent d8ab9784
...@@ -401,12 +401,17 @@ void block_FifoEmpty( block_fifo_t *p_fifo ) ...@@ -401,12 +401,17 @@ void block_FifoEmpty( block_fifo_t *p_fifo )
vlc_mutex_unlock( &p_fifo->lock ); vlc_mutex_unlock( &p_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)
*/
size_t block_FifoPut( block_fifo_t *p_fifo, block_t *p_block ) size_t block_FifoPut( block_fifo_t *p_fifo, block_t *p_block )
{ {
size_t i_size = 0; size_t i_size = 0;
vlc_mutex_lock( &p_fifo->lock ); vlc_mutex_lock( &p_fifo->lock );
do while (p_block != NULL)
{ {
i_size += p_block->i_buffer; i_size += p_block->i_buffer;
...@@ -416,10 +421,9 @@ size_t block_FifoPut( block_fifo_t *p_fifo, block_t *p_block ) ...@@ -416,10 +421,9 @@ size_t block_FifoPut( block_fifo_t *p_fifo, block_t *p_block )
p_fifo->i_size += p_block->i_buffer; p_fifo->i_size += p_block->i_buffer;
p_block = p_block->p_next; p_block = p_block->p_next;
}
} while( p_block ); /* We queued one block: wake up one read-waiting thread */
/* warn there is data in this fifo */
vlc_cond_signal( &p_fifo->wait ); vlc_cond_signal( &p_fifo->wait );
vlc_mutex_unlock( &p_fifo->lock ); vlc_mutex_unlock( &p_fifo->lock );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment