ff_merge_samplerates will be deallocate a or b in some case, so
add a check before free the format.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
Temporarily keep the old method for ffmpeg_filters.c choose_pix_fmt and
avfiltergraph.c pick_format() until a paletted pixel format without alpha is
introduced.
Signed-off-by: Marton Balint <cus@passwd.hu>
For now, check the image size.
Inspired by a patch from Paul B Mahol.
Invalid sizes would be detected later by allocation failures,
detecting problems earlier is cleaner.
Not used by anything at all since we don't auto insert lavr filters.
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
avfilter_graph_request_oldest() does work that should be done by
either the filter or the application.
The principle of this function, calling ff_request_frame() from
outside the filter was always shaky. This version is less elegant
since it requires making special cases for each filter, but it
is more robust since it no longer calls ff_request_frame()
directly without notifying the filter.
Eventually, avfilter_graph_request_oldest() will be deprecated
for a function to just run the graph.
With min_samples, if a frame arrives but is too small, it clears
frame_wanted_out. In most cases, the destination filter would be
activated again later because of frame_wanted_out on its own
outputs, but not sinks.
avfilter_graph_request_oldest() is doing the work of the sink
itself, and is therefore allowed to use frame_blocked_in.
A lot of changes happen at the same time:
- Add a framequeue fifo to AVFilterLink.
- split AVFilterLink.status into status_in and status_out: requires
changes to the few filters and programs that use it directly
(f_interleave, split, filtfmts).
- Add a field ready to AVFilterContext, marking when the filter is ready
and its activation priority.
- Add flags to mark blocked links.
- Change ff_filter_frame() to enqueue the frame.
- Change all filtering functions to update the ready field and the
blocked flags.
- Update ff_filter_graph_run_once() to use the ready field.
- buffersrc: always push the frame immediately.
Restore a check added in 440af105f2
but lost sometime after. avfilter_graph_set_auto_convert() will
have an effect once again.
Signed-off-by: Burt P <pburt0@gmail.com>
When a filter is no longer part of a graph, its pointers should be cleared
so no stale pointers remain.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Instead of calling the input filter request_frame() method,
ff_request_frame() now marks the link and returns immediately.
buffersink is changed to activate the marked filters until
a frame is obtained.
This field is used for fast comparison between link ages,
it is in AV_TIME_BASE units, in other words microseconds,
µs =~ us.
Renaming it allows a second field in link time base units.
Commit bf0d2d6030 introduced
av_warn_unused_result to avfilter/formats, whose associated warnings
were mostly fixed in 6aaac24d72. This
fixes the issues in avfilter/avfiltergraph.
Tested with FATE.
Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Many of the functions from avfilter/formats can return errors, usually AVERROR(ENOMEM).
This propagates the return values.
All of these were found by using av_warn_unused_result, demonstrating its utility.
Tested with FATE. I am least sure of the changes to avfilter/filtergraph,
since I don't know what/how reduce_format is intended to behave and how it should
react to errors.
Fixes: CID 1325680, 1325679, 1325678.
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Previous version Reviewed-by: Nicolas George <george@nsup.org>
Previous version Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
When merging the formats around the automatically inserted
convert filters, the refcount of the format lists can not be 0.
Coverity does not detect it, and suspects a memory leak,
because if refcount is 0 the newly allocated lists are not
stored anywhere. That gives CIDs 1224282, 1224283 and 1224284.
Lists with refcount 0 are used in can_merge_formats(), so the
asserts can not be moved inside the merge functions.
Define positive return values as non errors and leave further meaning undefined
This allows future extensions to use these values
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This prevents the unneeded insertion of multiple aresample filters in some cases
The format merging is moved to avoid having to call the channel layout
merge twice. The channel layout merge code uses different structures and
is not compatible with the added dry run wrappers.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Prior to this it was possible that format reduction was ended
before it fully propagated leading to failure later in picking
formats.
No testcase with unmodified source exists, the case was reproduced
with less aggressive list merging though.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
query_formats() returning EAGAIN is not considered a progress
in the format negotiation.
If the filter returns EAGAIN but did set some of its formats
lists, it could be considered a partial success and counted
as progress in the negotiation. Not counting it is not a
problem because it currently only happens in the first round,
where there will always be some progress on the other filters.