You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
lavu/fifo: fix a corner case in av_fifo_grow2()
When the fifo is grown by exactly the current write offset, it would end up with offset_w = nb_elems. If av_fifo_write_from_cb() is called in such a state, the user callback would get callled with *nb_elems=0, which will then cause the write to return without writing anything.
This commit is contained in:
@@ -115,7 +115,7 @@ int av_fifo_grow2(AVFifo *f, size_t inc)
|
|||||||
(f->offset_w - copy) * f->elem_size);
|
(f->offset_w - copy) * f->elem_size);
|
||||||
f->offset_w -= copy;
|
f->offset_w -= copy;
|
||||||
} else
|
} else
|
||||||
f->offset_w = f->nb_elems + copy;
|
f->offset_w = copy == inc ? 0 : f->nb_elems + copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
f->nb_elems += inc;
|
f->nb_elems += inc;
|
||||||
|
Reference in New Issue
Block a user