[vlc-devel] commit: Fixed a huge regression in block_FifoPut. (Laurent Aimar )
git version control
git at videolan.org
Sat Jan 30 13:13:10 CET 2010
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Jan 30 12:54:21 2010 +0100| [5505394d73876ed0f0c0fa127a1ed6cc4d87d984] | committer: Laurent Aimar
Fixed a huge regression in block_FifoPut.
It was broken as soon as a linked list of buffers was pushed.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5505394d73876ed0f0c0fa127a1ed6cc4d87d984
---
src/misc/block.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/misc/block.c b/src/misc/block.c
index 433c742..1d06fec 100644
--- a/src/misc/block.c
+++ b/src/misc/block.c
@@ -571,18 +571,21 @@ void block_FifoPace (block_fifo_t *fifo, size_t max_depth, size_t max_size)
size_t block_FifoPut( block_fifo_t *p_fifo, block_t *p_block )
{
size_t i_size = 0, i_depth = 0;
+ block_t *p_last;
if (p_block == NULL)
return 0;
- for (block_t *b = p_block; b != NULL; b = b->p_next)
+ for (p_last = p_block; ; p_last = p_last->p_next)
{
- i_size += b->i_buffer;
+ i_size += p_last->i_buffer;
i_depth++;
+ if (!p_last->p_next)
+ break;
}
vlc_mutex_lock (&p_fifo->lock);
*p_fifo->pp_last = p_block;
- p_fifo->pp_last = &p_block->p_next;
+ p_fifo->pp_last = &p_last->p_next;
p_fifo->i_depth += i_depth;
p_fifo->i_size += i_size;
/* We queued at least one block: wake up one read-waiting thread */
More information about the vlc-devel
mailing list