Commit Graph

94589 Commits

Author SHA1 Message Date
Jun Zhao
f156f4ab23 lavfi/avfiltergraph: add check before free the format
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>
2019-08-20 10:06:17 +08:00
Jun Zhao
df6876d691 lavfi/af_adeclick: fix double free after ff_filter_frame fail
ff_filter_frame fail will free the frame, so we just returen after this
function fail.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-08-20 10:05:03 +08:00
Steven Liu
3708a2a909 avformat/hlsenc: reindent code
and remove redundant empty line
2019-08-20 09:56:38 +08:00
Steven Liu
939c17fcb3 avformat/hlsenc: remove unuse comment of the code 2019-08-20 09:45:47 +08:00
Jun Zhao
f36925201c lavf/hlsenc: free the old_filname to avoid memory leak
free the old_filname to avoid memory leak in error handle
path.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-08-20 08:44:42 +08:00
Limin Wang
eccb94c3ba lavf/hlsenc: fix one warning: unused variable 'filename' [-Wunused-variable]
Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-08-20 08:23:53 +08:00
Guo, Yejun
d0fa1a58da FATE/dnn: let fate/dnn tests depend on ffmpeg static libraries
background:
DNN (deep neural network) is a sub module of libavfilter, and FATE/dnn
is unit test for the DNN module, one unit test for one dnn layer.
The unit tests are not based on the APIs exported by libavfilter,
they just directly call into the functions within DNN submodule.

There is an issue when run the following command:
build$ ../ffmpeg/configure --disable-static --enable-shared
make
make fate-dnn-layer-pad

And part of error message:
tests/dnn/dnn-layer-pad-test.o: In function `test_with_mode_symmetric':
/work/media/ffmpeg/build/src/tests/dnn/dnn-layer-pad-test.c:73: undefined reference to `dnn_execute_layer_pad'

The root cause is that function dnn_execute_layer_pad is a LOCAL symbol
in libavfilter.so, and so the linker could not find it when build dnn-layer-pad-test.
To check it, just run: readelf -s libavfilter/libavfilter.so | grep dnn

So, add dependency in fate/dnn Makefile with ffmpeg static libraries.
This is the same method used in fate/checkasm

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2019-08-19 11:37:16 -03:00
Guo, Yejun
67889d4715 libavfilter/dnn/dnn_backend_tf: add tf.pad support for tensorflow backend with native model.
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2019-08-19 11:37:16 -03:00
Guo, Yejun
29aeeb3e3e libavfilter/dnn/dnn_backend_tf: fix typo that variable uninitialized.
if it is initialized randomly, the tensorflow lib will report
error message such as:
Attempt to add output -7920 of depth_to_space4 not in range [0, 1) to node with type Identity

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2019-08-19 11:37:16 -03:00
Eugene Lyapustin
596ecc295f avfilter/vf_v360: add dual fisheye format
Signed-off-by: Eugene Lyapustin <unishifft@gmail.com>
2019-08-19 09:07:38 +01:00
Eugene Lyapustin
d044252aac avfilter/vf_v360: add padding option for cubemap
Signed-off-by: Eugene Lyapustin <unishifft@gmail.com>
2019-08-19 09:06:27 +01:00
Eugene Lyapustin
b26094e217 avfilter: add v360 filter
Signed-off-by: Eugene Lyapustin <unishifft@gmail.com>
2019-08-19 09:06:07 +01:00
Michael Niedermayer
1965161ef6 avcodec/anm: Check input size for a frame with just a stop code
Fixes: Timeout (11sec -> 6sec)
Fixes: 16344/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ANM_fuzzer-5673032000995328

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-18 22:12:55 +02:00
Steven Liu
cff309097a avformat/hlsenc: merge mpegts and fmp4 workflow to one workflow
write mpegts or fmp4 context into buffer, and flush the buffer into
output file when split fragment. merge two format split workflow into
one workflow

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-08-18 08:22:32 +08:00
Limin Wang
df6e341b04 lavf/dump: use error log level for invalid size
Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-08-18 08:17:57 +08:00
Limin Wang
6866c54ee4 avfilter/showinfo: support Content Light Level information
show real information instead of the unknown side data type message for HDR10 stream

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-08-17 14:47:13 -03:00
Marton Balint
95fa73a2b4 avformat/avio: remove 4k limit from avio_printf
We do this by switching to AVBPrint.

v2: Also set IO context error flag in case of ENOMEM.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-17 18:39:49 +02:00
Marton Balint
61b4daf78c avformat/assenc: optimize writing dialogs
An example where the preivously added API can be useful.

Also fixes ticket #6390.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-17 18:39:49 +02:00
Marton Balint
a82f8f2f10 avformat/avio: add avio_print_string_array and avio_print
These functions can be used to print a variable number of strings consecutively
to the IO context. Unlike av_bprintf, no temporary buffer is necessary.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-17 18:39:49 +02:00
Limin Wang
6a3bdf3148 fate: add accurate_rnd+bitexact sws_flags for fate-gifenc
This fixes make fate issue for frame thread scale in my local testing

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-17 17:33:16 +02:00
Limin Wang
ad3ef00ce5 avfilter/f_select: yuv will use Y plane only for scenecut detect
At the moment scene change detection score uses all planes to detect scene
changes. In this regard this is similar how the frozen frames detection works.
However, in classic encoding scene change detection typically only uses the Y
plane.

We might get more resonable scores for scene change if we also use only
the Y plane for calculating the score if the pixel format is YUV. Although
this will require additional work once packed YUV formats are added,
because for the moment the generic scene sad score calculation has no way
to ignore some components in a packed format.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-17 17:15:19 +02:00
Andreas Rheinhardt
c294f38c91 avformat/matroskadec: Fix seeking
matroska_reset_status (a function that is used during seeking (among
other things)) used an int for the return value of avio_seek which
returns an int64_t. Checking the return value then indicated an error
even though the seek was successfull for targets in the range of
2GB-4GB, 6GB-8GB, ... This error implied that the status hasn't been
reset and in particular, the old level was still considered to be in
force, so that ebml_parse returned errors because the newly parsed
elements were of course not contained in the previously active and still
wrongly considered active master element any more.

Addresses ticket #8084.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-08-16 21:33:54 -03:00
Guo, Yejun
ddd92ba2c6 convert_from_tensorflow.py: support conv2d with dilation
conv2d with dilation > 1 generates tens of nodes in graph, it is not
easy to parse each node one by one, so we do special tricks to parse
the conv2d layer.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2019-08-15 14:58:19 -03:00
Guo, Yejun
2c01434d60 convert_from_tensorflow.py: add option to dump graph for visualization in tensorboard
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2019-08-15 14:58:19 -03:00
Lynne
aac382e9e5 aarch64/opusdsp: do not clobber register v8
A part of v8-v15 needs to be preserved across calls.
2019-08-15 13:29:22 +01:00
Jun Zhao
3aeb681f07 libavdevice: Update the class name as uniform style
Update the class name to uniform indev/outdev style.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-08-15 09:29:55 +08:00
tomajsjiang
9c3adb7ce2 lavf/utils: fix error like "offset 0x1f85: partial file"
fix error like "offset 0x1f85: partial file", the root cause is when
read the mp4 file from http, and the moov in the end of the mp4 file,
reconfig the buffer will drop some data.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: Zhongxing Jiang <tomajsjiang@tencent.com>
2019-08-15 09:27:18 +08:00
tomajsjiang
3d1506c630 lavf/avio: add a ffio_realloc_buf API for AVIO buffer realloc
Add new API ffio_realloc_buf for AVIO buffer realloc.

Signed-off-by: Zhongxing Jiang <tomajsjiang@tencent.com>
2019-08-15 09:27:11 +08:00
James Almer
03ba386833 avcodec/libdav1d: allow setting frame size limit in pixels
Signed-off-by: James Almer <jamrial@gmail.com>
2019-08-14 22:01:05 -03:00
Shiyou Yin
e1039b09c4 avutil/mips: remove redundant code in TRANSPOSE16x8_UB_UB.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-15 01:26:21 +02:00
Andreas Rheinhardt
789dcfaf58 avformat/mux: Use av_packet_rescale_ts
ff_write_chained essentially duplicated the functionality of
av_packet_rescale_ts. This has been changed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-15 01:26:21 +02:00
Andreas Rheinhardt
1147759552 avformat/mux: Use const AVPacket * in compare functions
There is no reason for these functions to modify the given packets at
all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-15 01:26:21 +02:00
Michael Niedermayer
e301736862 avcodec/flicvideo: Optimize and Simplify FLI_COPY in flic_decode_frame_24BPP() by using bytestream2_get_buffer()
Fixes: Timeout (31sec  -> 22sec)
Fixes: 16217/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5658084189405184

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-15 01:26:21 +02:00
Michael Niedermayer
c812db814e avcodec/loco: Check left column value
Fixes: Timeout (42sec -> 379 ms)
Fixes: 16323/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LOCO_fuzzer-5679178099195904

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-15 01:26:21 +02:00
Michael Niedermayer
df7e79a5c3 tools/target_dec_fuzzer: adjust pixel threshold for MSRLE, as it allows coding gigantic images on tiny input
Fixes: Timeout (12sec ->2sec)
Fixes: 16125/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSRLE_fuzzer-5650846364205056

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-15 01:26:21 +02:00
Andreas Rheinhardt
f2d522f2a8 fftools: Use right function signature and pointers
The option tables of the various fftools (in particular ffprobe) are
arrays of OptionDef; said type contains a union of a pointer to void and
a function pointer of type int (*)(void *, const char *, const char *)
as well as a size_t. Some entries (namely the common entry for writing a
report as well as several more of ffprobe's entries) used the pointer to
void to store a pointer to functions of type int (*)(const char *) or
type int (*)(const char *, const char *); nevertheless, when the functions
are actually called in write_option (in cmdutils.c), it is done via a
pointer of the first type.

There are two things wrong here:
1. Pointer to void can be converted to any pointer to incomplete or
object type and back; but they are nevertheless not completely generic
pointers: There is no provision in the C standard that guarantees their
convertibility with function pointers. C90 lacks a generic function
pointer, C99 made every function pointer a generic function pointer and
still disallows the convertibility with void *.
2. The signature of the called function differs from the signature
of the pointed-to type. This is undefined behaviour in C99 (given that
C90 lacks a way to convert function pointers at all, it doesn't say
anything about such a situation). It only works because none of the
functions this patch is about make any use of their parameters at all.

Therefore this commit changes the type of the relevant functions
to match the type used for the call and uses the union's function
pointer to store it. This is legal even in C90.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-15 01:26:21 +02:00
Michael Niedermayer
cdea0206ef avcodec/ffwavesynth: Fixes invalid shift with pink noise seeking
Fixes: left shift of negative value -961533698048
Fixes: 16242/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5738550670131200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-15 01:26:21 +02:00
Michael Niedermayer
c4a88fb546 avcodec/ffwavesynth: Fix integer overflow for some corner case values
Fixes: left shift of negative value -14671840
Fixes: 16000/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5145977817661440

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-15 01:26:21 +02:00
Marton Balint
5974463767 avformat/mpegtsenc: remove deprecated resend_headers option
Deprecated since 2014.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-14 23:25:28 +02:00
Marton Balint
88ac76be79 avformat/mpegtsenc: fix PCR generation intervals
PCR generation was based on counting packets for both CBR and VBR streams.
Couting packets might have worked for CBR streams (when muxrate was specified)
but it only took into account the packets of a service (or the packets of the
PCR stream lately), so even that was problematic for multi program streams.

The new code works on actual timestamps for both CBR and VBR streams. For VBR
streams the behaviour of the old code is simulated by selecting a PCR interval
which is the highest multiple of the frame duration but still less than 100 ms.

It should be trivial to add support for setting the PCR interval for VBR
streams as well in a later patch.

The accuracy of PCR packets for CBR streams was greatly improved by preemtively
sending them at PCR intervals even if sending the payload of another stream
is in progress.

This may fix these tickets:
- #5750
- #7524

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-14 23:24:11 +02:00
Marton Balint
a4d984ad33 avformat/mpegtsenc: use increasing numbers in default service names
Maybe we should use service ID instead of increasing numbers?

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-14 22:50:11 +02:00
Marton Balint
9de40bf624 avformat/mpegtsenc: remove section_write_packet forward declaration
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-14 22:50:11 +02:00
Marton Balint
47ea654bd8 avformat/mpegtsenc: factorize setting up services
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-14 22:50:11 +02:00
Marton Balint
d770e0f401 avformat/mpegtsenc: fix incorrect PCR selection with multiple programs
The MPEG-TS muxer had a serious bug related to the use of multiple programs:
in that case, the PCR pid selection was incomplete for all services except one.
This patch solves this problem and selects a stream to become PCR for each
service, preferably the video stream.

This patch also moves pcr calculation attributes to MpegTSWriteStream from
MpegTSService. PCR is a per-stream and not per-service thing, so it was
misleading to refer to it as something that is per-service.

Also remove *service from MpegTSWriteStream because a stream can belong to
multiple services so it was misleading to select one for each stream.

You can check the result with this example command:

./ffmpeg -loglevel verbose -y -f lavfi -i \
  "testsrc=s=64x64:d=10,split=2[out0][tmp1];[tmp1]vflip[out1];sine=d=10,asetnsamples=1152[out2]" \
  -flags +bitexact -fflags +bitexact -sws_flags +accurate_rnd+bitexact  \
  -codec:v libx264 -codec:a mp2 -pix_fmt yuv420p \
  -map '0✌️0' \
  -map '0✌️1' \
  -map '0🅰️0'  \
  -program st=0:st=2 -program st=1:st=2 -program st=2 -program st=0 -f mpegts out.ts

You should now see this:

[mpegts @ 0x37505c0] service 1 using PCR in pid=256
[mpegts @ 0x37505c0] service 2 using PCR in pid=257
[mpegts @ 0x37505c0] service 3 using PCR in pid=258
[mpegts @ 0x37505c0] service 4 using PCR in pid=256

Fixes ticket #8039.

v2: a video is stream is preferred if there are no programs, just like before
the patch.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-14 22:50:11 +02:00
Marton Balint
a1c7014847 ffplay: properly detect all window size changes
SDL_WINDOWEVENT_SIZE_CHANGED should be used instead of SDL_WINDOWEVENT_RESIZED
because SDL_WINDOWEVENT_RESIZED is only emitted if the resize happened due to
an external event.

Fixes ticket #8072.

Additional references:
https://bugzilla.libsdl.org/show_bug.cgi?id=4760
https://wiki.libsdl.org/SDL_WindowEventID

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-08-14 21:57:46 +02:00
Andreas Rheinhardt
8fcc5d963e avfilter/vf_convolution: Fix build failures
98e419cb added SIMD for the convolution filter for x64 systems. As
usual, it used a check of the form
if (ARCH_X86_64)
    ff_convolution_init_x86(s);
and thereby relied on the compiler eliminating this pseudo-runtime check
at compiletime for non x64 systems (for which ff_convolution_init_x86
isn't defined) to compile. But vf_convolution.c contains more than one
filter and if the convolution filter is disabled, but one of the other
filters (prewitt, sobel, roberts) is enabled, the build will fail on x64,
because ff_convolution_init_x86 isn't defined in this case.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-08-14 14:37:47 +08:00
Michael Niedermayer
52939a2c57 avcodec/indeo2: Check remaining input more often
Fixes: Timeout (95sec -> 30ms)
Fixes: 14765/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO2_fuzzer-5692455527120896

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpe
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-13 22:14:03 +02:00
Michael Niedermayer
fbbc8ba67f avcodec/diracdec: Check that slices are fewer than pixels
Fixes: Timeout (197sec ->144ms)
Fixes: 15034/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5733549405110272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-13 22:14:03 +02:00
Michael Niedermayer
1e2e47e348 tools/target_dec_fuzzer: Print max_pixels and iterations at the end
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-13 16:48:38 +02:00
Lars Kiesow
74d4bc0fa0 libavfilter/vf_scale: Ensure scaled video is divisible by n
This patch adds a new option to the scale filter which ensures that the
output resolution is divisible by the given integer when used together
with `force_original_aspect_ratio`. This works similar to using `-n` in
the `w` and `h` options.

This option respects the value set for `force_original_aspect_ratio`,
increasing or decreasing the resolution accordingly.

The use case for this is to set a fixed target resolution using `w` and
`h`, to use the `force_original_aspect_ratio` option to make sure that
the video always fits in the defined bounding box regardless of aspect
ratio, but to also make sure that the calculated output resolution is
divisible by n so in can be encoded with certain encoders/options if
that is required.

Signed-off-by: Lars Kiesow <lkiesow@uos.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-13 16:48:38 +02:00