Commit Graph

107467 Commits

Author SHA1 Message Date
Michael Niedermayer 009ef35d38 avcodec/hevc_filter: copy_CTB() only within width&height
Fixes: out of array access
Fixes: 49271/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5424984922652672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-22 17:25:25 +02:00
Michael Niedermayer 76112c2b41 avcodec/tiff: Check tile_length and tile_width
Fixes: Division by 0
Fixes: 49235/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5495613847896064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-22 17:25:25 +02:00
James Almer 5114ce1e2a avcodec/aacdec: remove skip samples multiplier
The amount of padding samples reported by containers take into account the
extended samplerate in HE-AAC.

Fixes ticket #9671.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-07-22 09:19:11 -03:00
Ting Fu 130d19bf20 lavf/sr: fix the segmentation fault caused by incorrect input frame free.
This issue would cause segmetaion fault when running srcnn model with
sr filter by TensorFlow backend. This filter would free the frame incorectly.

Signed-off-by: Ting Fu <ting.fu@intel.com>
2022-07-22 08:15:04 +08:00
Michael Niedermayer 4e145f1dcd avcodec/mss4: Check image size with av_image_check_size2()
Fixes: Timeout
Fixes: 48418/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MTS2_fuzzer-4834851466903552

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-21 19:30:14 +02:00
Michael Niedermayer 8af798171b avformat/mpc8: Check and propagate more errors
Fixes: Timeout
Fixes: 48846/clusterfuzz-testcase-minimized-ffmpeg_dem_MPC8_fuzzer-5278532493770752

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-21 19:28:52 +02:00
Michael Niedermayer ceff5d7b74 avformat/flvdec: Check for EOF in index reading
Fixes: Timeout
Fixes: 47992/clusterfuzz-testcase-minimized-ffmpeg_dem_LIVE_FLV_fuzzer-6020443879899136

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-21 19:28:27 +02:00
Michael Niedermayer b5de084aa6 avformat/nutdec: Check get_packetheader() in mainheader
Fixes; Timeout
Fixes: 48794/clusterfuzz-testcase-minimized-ffmpeg_dem_NUT_fuzzer-6524604713140224

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-21 19:27:52 +02:00
Michael Niedermayer 744ad45c44 avformat/mov: Check for EOF in mov_read_iloc()
Fixes: Timeout
Fixes: 49216/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6563000529584128

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-21 19:27:45 +02:00
Michael Niedermayer 9b23eb8a10 tools/target_dec_fuzzer: Adjust threshold for MWSC
Fixes: Timeout
Fixes: 49172/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MWSC_fuzzer-5213749102903296

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-21 19:27:38 +02:00
Michael Niedermayer 8ed78486fc avformat/asfdec_f: Use 64bit for packet start time
Fixes: signed integer overflow: 2147483647 + 32 cannot be represented in type 'int'
Fixes: 49014/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_fuzzer-6314973315334144

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-21 19:27:32 +02:00
Michael Niedermayer 614a4d1476 avcodec/exr: Check x/ysize
Fixes: OOM
Fixes: 48911/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6352002510094336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-21 19:27:27 +02:00
Michael Niedermayer f7d510b33f avcodec/ffv1dec: Fix AC_GOLOMB_RICE min size check
Found-by: mkver

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-21 08:54:22 +02:00
Michael Niedermayer 15785e044e avcodec/ffv1dec: consider run increase in minimal golomb frame size
Fixes: Timeout
Fixes: 49160/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-5672826144686080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-20 16:13:20 +02:00
Michael Niedermayer 3592b05c84 tools/target_dec_fuzzer: Adjust threshold for MMVIDEO
Fixes: Timeout
Fixes: 49003/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MMVIDEO_fuzzer-5550368423018496

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>
2022-07-20 16:13:20 +02:00
Michael Niedermayer 282589771a avcodec/mpeg4videoenc: fix encoding long frames
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-20 16:13:20 +02:00
Michael Niedermayer 3c43a7a354 avcodec/hdrdec: lines can be empty
Fixes: infinite loop
Fixes: 49223/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HDR_fuzzer-6603308596330496

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>
2022-07-20 16:12:08 +02:00
Wenbin Chen 636a629ff6 libavfilter/vf_overlay_qsv: Use format of first input to set output format for overlay_qsv
overlay_qsv hard coded to use nv12 as output format. Now use the format
of the first input to set output format.

For detailed information of supported format on different platform,
please see the "composition" rows in "Video Processing Features" at
below link:
https://www.intel.com/content/www/us/en/develop/documentation/media-capabilities-of-intel-hardware/top.html

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-07-20 12:35:23 +08:00
Wenbin Chen 52ad617af5 libavcodec/qsvenc: Use parameter from AVCodecContext to reset qsv codec
Using parameter from AVCodecContext to reset qsv codec is more suitable
for MFXVideoENCODE_Reset()'s usage. Per-frame metadata is more suitable
for the usage of mfxEncodeCtrl being passed to
MFXVideoENCODE_EncodeFrameAsync(). Now change it to use the value
from AVCodecContext.
Because q->param is passed to both "in" and "out" parameters when call
MFXVideoENCODE_Query(), the value in q->param may be changed. New
variables are added to store old configuration, so that we can detect
real parameter change.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-07-20 12:35:23 +08:00
Wenbin Chen 8b82c9cdc7 libavcodec/qsvenc: Change the parameter log to be thread safe
Dividing one line log into several av_log() call is not thread safe. Now
merge these strings into one av_log() call.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-07-20 12:35:23 +08:00
Timo Rothenpieler 926f355aff avfilter/vsrc_ddagrab: check for existence of DPI_AWARENESS_CONTEXT
Apparently some (broken?) Windows SDK versions define IDXGIOutput5
but not DPI_AWARENESS_CONTEXT. So we need to explicitly check for its
existence.
2022-07-19 13:57:38 +02:00
Anton Khirnov ecd0a7c5bd lavfi/vf_showinfo: print frame durations 2022-07-19 12:27:18 +02:00
Anton Khirnov 9c0401bd59 tests/api: use AVFrame.duration instead of AVFrame.pkt_duration 2022-07-19 12:27:18 +02:00
Anton Khirnov de3a135e0f ffmpeg: use AVFrame.duration instead of AVFrame.pkt_duration 2022-07-19 12:27:18 +02:00
Anton Khirnov ccb94ec5cf ffprobe: print AVFrame.duration 2022-07-19 12:27:18 +02:00
Anton Khirnov 2d90fc89f2 lavd: use AVFrame.duration instead of AVFrame.pkt_duration 2022-07-19 12:27:17 +02:00
Anton Khirnov 7d9ee6741c lavf: use AVFrame.duration instead of AVFrame.pkt_duration 2022-07-19 12:27:17 +02:00
Anton Khirnov 357ba45a5c lavfi: use AVFrame.duration instead of AVFrame.pkt_duration 2022-07-19 12:27:17 +02:00
Anton Khirnov ac2cda4296 lavc: use AVFrame.duration instead of AVFrame.pkt_duration 2022-07-19 12:27:17 +02:00
Anton Khirnov 4397f9a5a0 lavu/frame: add a duration field to AVFrame
The only duration field currently present in AVFrame is pkt_duration,
which is semantically restricted to those frames that are output by
decoders.

Add a new field that stores the frame's duration without regard for how
that frame was produced. Deprecate pkt_duration.
2022-07-19 12:27:17 +02:00
Matthieu Bouron 0a6bb7da55 swscale: add NV16 input/output
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-07-19 12:20:16 +02:00
Timo Rothenpieler 61c151a098 avfilter/vsrc_ddagrab: dynamically load SetThreadDpiAwarenessContext
It's a Windows 10 only function, and its presence alone prevents the
binary from loading on older Windows versions.
2022-07-19 01:29:00 +02:00
Andreas Rheinhardt d72a671c60 avcodec/wrapped_avframe: Don't presume AVPacket to be writable
It need not be writable; in fact, it is often not writable even if
the packet sent to the decoder was writable, because the generic code
calls av_packet_ref() on it. It is never writable if a user
drains the decoder after every packet, because in this case the decode
callback is called from avcodec_send_packet().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-18 21:10:16 +02:00
Andreas Rheinhardt 425b309fa4 avcodec/wrapped_avframe: Don't leak frame metadata, side-data
wrapped_avframe_decode() uses an AVFrame as dst in av_frame_move_ref()
after having called ff_decode_frame_props() to attach side-date
to this very frame. This leaks all the side-data and metadata
that ff_decode_frame_props() has attached.

This happens in various fate-filter-metadata tests since
6ca43a9675.

These particular leaks (which affect metadata-only)
could be fixed by not adding metadata side-data to AVPackets
in libavdevice if they are also available from the AVFrames.
Yet this would break users that extract the metadata from
AVPackets.

The changes to FATE happen because of the way av_dict_set()
works when it overwrites an already existing entry:
It overwrites the entry to be overwritten with the last entry
and adds the new entry at the end. The end result is that
the first entry of the dict is the second-to-last-entry of
the original dict, the last entry of the dict is the last
entry of the old dict and the first count - 2 entries
of the original dict are at positions 1..count - 2 in their
original order.

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-18 21:09:44 +02:00
Andreas Rheinhardt 21b23ceab3 avcodec: Make init-threadsafety the default
and remove FF_CODEC_CAP_INIT_THREADSAFE
All our native codecs are already init-threadsafe
(only wrappers for external libraries and hwaccels
are typically not marked as init-threadsafe yet),
so it is only natural for this to also be the default state.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-18 20:04:59 +02:00
Andreas Rheinhardt 6aad1204cc avcodec: Add FF_CODEC_CAP_NOT_INIT_THREADSAFE
This is in preparation of switching the default init-thread-safety
to a codec being init-thread-safe.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-18 19:58:56 +02:00
Andreas Rheinhardt c597510434 avcodec/pnmdec: Mark PHM decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-18 19:57:01 +02:00
Timo Rothenpieler 90810bb37c Changelog: move ddagrab addition to correct version 2022-07-18 13:52:48 +02:00
Timo Rothenpieler cb22d5ea3c avfilter/vsrc_ddagrab: fix checkheaders error 2022-07-18 13:08:39 +02:00
Zhao Zhili 811f2f91da avformat/mov: discard data streams with all zero sample_delta
Streams with all zero sample_delta in 'stts' have all zero dts.
They have higher chance be chose by mov_find_next_sample(), which
leads to seek again and again.

For example, GoPro created a 'GoPro SOS' stream:
  Stream #0:4[0x5](eng): Data: none (fdsc / 0x63736466), 13 kb/s (default)
    Metadata:
      creation_time   : 2022-06-21T08:49:19.000000Z
      handler_name    : GoPro SOS

With 'ffprobe -show_frames http://example.com/gopro.mp4', ffprobe
blocks until all samples in 'GoPro SOS' stream are consumed first.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-07-18 11:06:17 +08:00
Timo Rothenpieler f611255480 avfilter: add vsrc_ddagrab 2022-07-18 02:08:27 +02:00
Timo Rothenpieler 2f0d45571b avdevice/lavfi: pass forward video framerate 2022-07-18 00:32:57 +02:00
Timo Rothenpieler 6ca43a9675 avdevice/lavfi: output wrapped AVFrames
This avoids an extra copy of potentially quite big video frames.
Instead of copying the entire frames data into a rawvideo packet it
packs the frame into a wrapped avframe packet and passes it through
as-is.
Unfortunately, wrapped avframes are set up to be video frames, so the
audio frames continue to be copied.

Additionally, this enabled passing through video frames that previously
were impossible to process, like hardware frames or other special
formats that couldn't be packed into a rawvideo packet.
2022-07-18 00:32:55 +02:00
Timo Rothenpieler 63ce42019c avutil/hwcontext_d3d11va: add BGRA/RGBA10 formats support
Desktop duplication outputs those
2022-07-18 00:32:14 +02:00
Timo Rothenpieler 6cbb7d673d avutil/hwcontext_d3d11va: update hwctx flags from input texture
At least QSV relies on those being set correctly when deriving a hwctx.
2022-07-18 00:32:14 +02:00
Timo Rothenpieler 30bbc0a624 avutil/hwcontext_d3d11va: fix texture_infos writes on non-fixed-size pools 2022-07-18 00:32:14 +02:00
Timo Rothenpieler e18c575474 avutil/hwcontext_d3d11va: fix mixed declaration and code 2022-07-18 00:32:14 +02:00
Timo Rothenpieler 91a95e19c9 fftools/ffmpeg: make debug_ts print raw filter output 2022-07-18 00:32:14 +02:00
Marton Balint 64f04df379 avdevice/avdevice: fix return value of avdevice_list_devices()
According to API docs avdevice_list_devices(), avdevice_list_input_sources()
and avdevice_list_input_sinks() should return the number of autodetected
devices on success. This is redundant with AVDeviceInfoList->nb_devices so it
was not noticed earlier that none of the underlying device list functions work
like that.

Let's fix it in generic code to make it in line with the API docs.

Fixes ticket #9820.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-07-17 22:03:41 +02:00
Leo Izen 940169b8aa avcodec/libjxlenc: avoid hard failure with unspecified primaries
This patch prevents the libjxl encoder wrapper from failing to
encode images when the input video has untagged primaries. It will
instead assume BT.709/sRGB primaries and print a warning.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2022-07-17 01:46:48 +02:00