Age | Commit message (Collapse) | Author |
|
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
|
|
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.
|
|
offset_w might be updated after growing the FIFO
Fix ticket #9630
Tested-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Reviewed-by: mkver
Reviewed-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
|
|
Users should switch to the superior AVFifo API.
Unfortunately AVFifoBuffer fields cannot be marked as deprecated because
it would trigger a warning wherever fifo.h is #included, due to
inlined av_fifo_peek2().
|
|
This will not increase the FIFO beyond 1MB, unless the caller explicitly
specifies otherwise.
|
|
Many AVFifoBuffer users operate on fixed-size elements (e.g. pointers),
but the current FIFO API deals exclusively in bytes, requiring extra
complexity in all these callers.
Add a new AVFifo API creating a FIFO with an element size
that may be larger than a byte. All operations on such a FIFO then
operate on complete elements.
This API does not reuse AVFifoBuffer and its API at all, but instead uses
an opaque struct called AVFifo. The AVFifoBuffer API will be deprecated
in a future commit once all of its users have been switched to the new
API.
Not reusing AVFifoBuffer also allowed to use the full range of size_t
from the beginning.
|
|
The API currently allows creating FIFOs up to
- UINT_MAX: av_fifo_alloc(), av_fifo_realloc(), av_fifo_grow()
- SIZE_MAX: av_fifo_alloc_array()
However the usable limit is determined by
- rndx/wndx being uint32_t
- av_fifo_[size,space] returning int
so no FIFO should be larger than the smallest of
- INT_MAX
- UINT32_MAX
- SIZE_MAX
(which should be INT_MAX an all commonly used platforms).
Return an error on trying to allocate FIFOs larger than this limit.
|
|
Avoids code duplication. It furthermore properly checks
for buf_size to be > 0 before doing anything.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
|
|
Trying to write too much will currently overwrite previous data. Trying
to read too much will either av_assert2() in av_fifo_drain() or return
old data. Trying to peek too much will either av_assert2() in
av_fifo_generic_peek_at() or return old data.
Return an error code in all these cases, which is safer and more
consistent.
|
|
This object was never intended to be thread-safe, so these carry no
useful information.
|
|
av_realloc() the buffer and only move the part of the ring buffer that
needs it. Also avoids allocating a temporary fifo.
|
|
Turn it into a wrapper around av_fifo_alloc_array().
|
|
Fifo was reallocating always to twice of the requested size.
This fixes it to reallocate to requested size, or twice of the
original size - whichever is greater.
Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
|
|
* commit 'd12b5b2f135aade4099f4b26b0fe678656158c13':
build: Split test programs off into separate files
Some conversions done by: James Almer <jamrial@gmail.com>
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
|
|
This avoids spurious library rebuilds when only the test program
code is changed and simplifies the build system.
|
|
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
|
|
changing the context state and restoring it is not safe if another
thread writes data into the fifo
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
|
|
|
|
av_fifo_generic_write()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
|
|
version is 54 already
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
|
|
Allows to alloc fifo buffer by passing
number of elements and size of element.
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
|
|
78d3453c4a2efef9bc079e8f3458653beafcf990 until next major ABI bump
This unbreaks API, for example audacity has more build errors due to this
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
|
|
Function allows to free fifo and reset freed pointer.
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
|
|
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
|
|
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
|
|
* commit '6516632967da5e6bd7d6136e8678f826669ed26e':
tests: Only run noproxy test if networking is enabled
fifo: K&R formatting cosmetics
Conflicts:
libavformat/Makefile
libavutil/fifo.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
|
|
|
|
* commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967':
Remove pointless #undefs of previously forbidden functions.
fate: Add dependencies for bmp, cdxl, dfa, mp3
Conflicts:
doc/examples/muxing.c
libavfilter/filtfmts.c
libavutil/des.c
libavutil/eval.c
libavutil/log.c
libavutil/parseutils.c
tests/fate/mp3.mak
Merged-by: Michael Niedermayer <michaelni@gmx.at>
|
|
|
|
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
|
|
Prior to this a X bytes write could be seen as less than X bytes being
available if the check was done at an unfortunate moment.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
|
|
* qatar/master:
fifo: add FIFO API test program, and fate test
fifo: add av_fifo_peek2(), and deprecate av_fifo_peek()
postprocess.c: filter name needs to be double 0 terminated
doxygen: fix wrong comment syntax, //< vs. ///<
doxygen: drop pointless star from pointer variable names
Replace deprecated av_find_stream_info() by avformat_find_stream_info().
xmv: eliminate superfluous zeroing of zero data
configure: fix typo in avconv dependency list
Conflicts:
configure
doc/APIchanges
libavutil/Makefile
libavutil/avutil.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
|
|
Signed-off-by: Anton Khirnov <anton@khirnov.net>
|
|
|
|
|
|
With this change libavutil uses av_freep() everywhere where it makes sense.
Remaining av_free() use in it has the used pointer become inaccessible quickly
soo zeroing makes no sense.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
|
|
Signed-off-by: Mans Rullgard <mans@mansr.com>
|
|
Originally committed as revision 21997 to svn://svn.ffmpeg.org/ffmpeg/trunk
|
|
Patch by Olivier Guilyardi list et samalyse DOT c0m.
Originally committed as revision 18321 to svn://svn.ffmpeg.org/ffmpeg/trunk
|
|
consistent with av_fifo_generic_write.
Originally committed as revision 17914 to svn://svn.ffmpeg.org/ffmpeg/trunk
|
|
it easier to reuse the fifo.
Originally committed as revision 17901 to svn://svn.ffmpeg.org/ffmpeg/trunk
|
|
Originally committed as revision 17897 to svn://svn.ffmpeg.org/ffmpeg/trunk
|
|
Originally committed as revision 17876 to svn://svn.ffmpeg.org/ffmpeg/trunk
|
|
Originally committed as revision 17873 to svn://svn.ffmpeg.org/ffmpeg/trunk
|
|
soon.
Originally committed as revision 17870 to svn://svn.ffmpeg.org/ffmpeg/trunk
|
|
Yes this breaks ABI/API but ive already broken it and will bump avutil major
soon.
Originally committed as revision 17869 to svn://svn.ffmpeg.org/ffmpeg/trunk
|
|
Originally committed as revision 17867 to svn://svn.ffmpeg.org/ffmpeg/trunk
|
|
Originally committed as revision 17865 to svn://svn.ffmpeg.org/ffmpeg/trunk
|
|
Originally committed as revision 16840 to svn://svn.ffmpeg.org/ffmpeg/trunk
|
|
Originally committed as revision 16782 to svn://svn.ffmpeg.org/ffmpeg/trunk
|