1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-08-03 09:49:58 +02:00
Commit Graph

106556 Commits

Author SHA1 Message Date
James Almer
7c35aa60a5 avcodec/wmalosslessdec: ensure channel count in the private context and decoder context are consistent
Fixes: Out of array write
Fixes: 45613/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-4539073606320128
Fixes: 46008/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-4681245747970048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-29 16:34:56 -03:00
Paul B Mahol
96ebf7dceb avfilter/f_realtime: add support for commands 2022-03-29 20:36:54 +02:00
Michael Niedermayer
3a22bc03e6 avcodec/binkaudio: reset ch_offset on errors
Fixes: NULL pointer dereference
Fixes: 45955/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINKAUDIO_DCT_fuzzer-4842044192849920

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-03-29 17:48:35 +02:00
Niklas Haas
7fbf1dd47e MAINTAINERS: add Niklas Haas for vf_libplacebo.c
So I can merge my own changes to this filter after they pass peer
review, as well as keeping it in sync with upstream API changes / new
features.

Signed-off-by: Niklas Haas <git@haasn.dev>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-28 17:14:23 -03:00
Michael Niedermayer
31b22defcd avcodec/vmdaudio: Fix channels count bug
Fixes: division by zero
Fixes: 45811/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMDAUDIO_fuzzer-6412592581574656
Fixes: 45979/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMDAUDIO_fuzzer-5362043060879360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-28 19:56:12 +02:00
James Almer
5ee198f9aa swresample/rematrix: fix typo in clean_layout()
av_channel_layout_index_from_channel() takes an AVChannel value, not a mask.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-28 00:07:42 -03:00
James Almer
4a8f932fd9 avfilter/buffersrc: uninitialize the context ch_layout before overwritting it
av_buffersrc_parameters_set() can be called to set paramenters after the filter
was initialized with for example avfilter_graph_create_filter().

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-27 22:22:24 -03:00
Michael Niedermayer
c2d1597a8a avformat/aqtitledec: Skip unrepresentable durations
Fixes: signed integer overflow: -5 - 9223372036854775807 cannot be represented in type 'long'
Fixes: 45665/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-475618463934054

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-27 11:59:52 +02:00
Michael Niedermayer
8173a6c130 avformat/apm: Check channels
Fixes: division by 0
Fixes: 45643/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4957777905188864.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-27 11:59:51 +02:00
Michael Niedermayer
7ec28e1d4c avformat/cafdec: Do not store empty keys in read_info_chunk()
Fixes: Timeout
Fixes: 45543/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-5684953164152832

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-27 11:59:51 +02:00
Michael Niedermayer
6265f0b4e1 avformat: Do not search through the AVOption table for a option not in it repeatedly on each packet
This search takes alot of time especially when compared with small packets

46631 decicycles -> 15719 decicycles in read_frame_internal() for amr-nb in 3gp

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-27 11:58:54 +02:00
Michael Niedermayer
2e069f6b69 avformat/alp: Check num_channels
Fixes: division by 0
Fixes: 45615/clusterfuzz-testcase-minimized-ffmpeg_dem_ALP_fuzzer-582660348405350
Fixes: 45625/clusterfuzz-testcase-minimized-ffmpeg_dem_ALP_fuzzer-4821437943250944
Fixes: 45839/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5857286998851584.fuzz
Fixes: 45844/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6552705772945408

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-27 11:58:54 +02:00
Steve Lhomme
723065a346 dxva2_hevc: don't use frames as reference if they are not marked as such
Similar to how a frame is considered for referencing for the RefPicList array.
This will do the same for RefPicSetStCurrBefore, RefPicSetStCurrAfter and
RefPicSetLtCurr.

Fixes playback of http://www.gbbsoft.pl/!download/!/Film1.mp4
Ref. VLC issue https://code.videolan.org/videolan/vlc/-/issues/26738

Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
2022-03-27 10:00:15 +02:00
Kevin Wang
8ae15b5655 rtpenc_vp8: Use 15-bit PictureIDs
7-bit PictureIDs are not supported by WebRTC:
https://groups.google.com/g/discuss-webrtc/c/333-L02vuWA

In practice, 15-bit PictureIDs offer better compatibility.

Signed-off-by: Kevin Wang <kevin@muxable.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-26 00:42:00 +02:00
SomeRGuy
af6081273f avfilter/vf_subtitles: add additional font mime types
Since mkvmerge 19 has fonts types from RFC 8081 and mkvmerge 58 on windows use new file/magic library.

Signed-off-by: SomeRGuy <wwakabot@gmail.com>
2022-03-25 22:46:35 +01:00
James Almer
f2967490f1 avutil/channel_layout: return earlier on UNSPEC layouts in av_channel_layout_subset()
No point running all 64 iterations in the loop to never write anything to ret.
Also make ambisonic layouts check its mask too while at it.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-25 17:10:39 -03:00
James Almer
7602b4e4c2 avutil/tests/channel_layout: also test ambisonic layouts in av_channel_layout_subset()
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-25 17:10:39 -03:00
Andreas Rheinhardt
23cb87bb3c doc/examples/muxing: Remove outdated comment
This comment only applies to the scenario in which one uses
the AVCodecContexts embedded in AVStreams. Yet this code sample
stopped doing so in 9897d9f4e074cdc6c7f2409885ddefe300f18dc7;
and the last major version bump even removed the public
AVCodecContexts in AVStreams. So just remove this comment.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-25 19:22:55 +01:00
Andreas Rheinhardt
1970ee1045 avcodec/error_resilience: Remove write only ERContext.ref_count
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-25 19:07:52 +01:00
Andreas Rheinhardt
50c35d069a avcodec/h264dec: Constify slices' pointer to the parent context
Modifying the main context by a slice thread is racy;
so constify the pointer to it in H264SliceContext.
The code itself was already compatible with this change.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-25 19:07:41 +01:00
Andreas Rheinhardt
e944ab796d avcodec/h264dec: Move ERContext to H264Context
Since 7be2d2a70c only one context
is used. Moving it to H264Context from H264SliceContext is natural.

One could access the ERContext from H264SliceContext
via H264SliceContext.h264->er; yet H264SliceContext.h264 should
naturally be const-qualified, because slice threads should not
modify the main context. The ERContext is an exception
to this, as ff_er_add_slice() is intended to be called simultaneously
by multiple threads. And for this one needs a pointer whose
pointed-to-type is not const-qualified.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-25 19:07:31 +01:00
Andreas Rheinhardt
c4fcfa47df avcodec/h264_slice: Fix decoding undamaged input with slices
ff_er_frame_start() initializes ERContext.error_count
to three times the number of macroblocks to decode.
Later ff_er_add_slice() reduces this number by the amount
of macroblocks whose AC resp. DC resp. MV have been finished
(so every correctly decoded MB counts three times).
So the frame has been decoded correctly if error_count is zero
at the end.

The H.264 decoder uses multiple ERContexts when using
slice threading and therefore combines these error counts:
The first slice's ERContext is intended to be initialized
by ff_er_frame_start(), error_count of all the other
slice contexts is intended to be zeroed initially and
all afterwards all the error_counts are summed.

Yet commit 43b434210e
(probably unintentionally) changed the code to set
the first slice's error_count to zero as well.
This leads to bogus error messages in case one decodes
an input video using multiple slices with slice threading
with error concealment enabled (which is not the default)
("concealing 0 DC, 0 AC, 0 MV errors in [IPB] frame");
furthermore the returned frame is marked as corrupt as well
(ffmpeg reports "corrupt decoded frame in stream %d" for this).

This can be fixed easily given that only the first ERContext
is really used since 7be2d2a70c:
Don't reset the error_count; and don't sum the error counts as well.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-25 19:07:13 +01:00
Paul B Mahol
a660136daa avfilter/vsrc_life: set outlink frame_rate 2022-03-25 18:20:01 +01:00
Paul B Mahol
3d131545ea avfilter/vsrc_cellauto: set outlink frame_rate 2022-03-25 18:20:01 +01:00
Paul B Mahol
4fb5b0368f avfilter/vsrc_mandelbrot: set outlink frame_rate 2022-03-25 18:20:01 +01:00
Paul B Mahol
ccb33caf04 avfilter/vsrc_mandelbrot: rename misleading variable 2022-03-25 18:20:01 +01:00
Paul B Mahol
38804e0e23 avfilter/vsrc_mptestsrc: set outlink frame_rate 2022-03-25 18:20:01 +01:00
Paul B Mahol
5c2d333ecf avfilter/vsrc_gradients: set outlink frame_rate 2022-03-25 18:20:01 +01:00
Paul B Mahol
a45b71570a avfilter/vsrc_gradients: rename misleading variable 2022-03-25 18:20:01 +01:00
Paul B Mahol
75929ed62b avfilter/vsrc_sierpinski: set frame_rate to outlink 2022-03-25 18:20:01 +01:00
Paul B Mahol
d57a213998 avfilter/vsrc_sierpinski: rename misleading variable 2022-03-25 18:20:00 +01:00
Paul B Mahol
89083142fa fate: add crystalizer test 2022-03-25 18:18:44 +01:00
James Almer
cbeb827cfb avutil/tests/channel_layout: test av_channel_layout_check()
Should increase test coverage

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-25 12:09:21 -03:00
James Almer
95ac380252 avutil/tests/channel_layout: test the output of av_channel_layout_subset()
Should increase test coverage a bit

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-25 12:09:19 -03:00
James Almer
167c5a6afc avutil/tests/channel_layout: test the output of av_channel_layout_standard()
Should increase test coverage.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-25 11:46:51 -03:00
James Almer
f9ed91abc9 avutil/tests/channel_layout: test generating a custom layout using ambisonic channels and a non diegetic channel with a custom name
Should increase test coverage a bit

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-25 11:46:48 -03:00
James Almer
1e24fad867 doc/utils: add missing 22.2 layout entry
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-25 09:26:45 -03:00
James Almer
e4f6fce9e0 avutil/channel_layout: add missing check for AV_CHAN_NONE in av_channel_description
Prevents printing "user -1" on invalid channel ids.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-25 09:24:39 -03:00
James Almer
b04f14136e fftools/opt_cmdutils: fix printing known channel layouts
Look for the generic "USR" labels instead of "?" to skip channels with no
known names, and actually print the decomposition of standard channel layouts.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-25 08:42:45 -03:00
James Almer
6e04ace7fe avutil/channel_layout: don't try to print NULL string pointers in av_channel_{name,description}
Instead fallback to print USR%d for channels id < 64 without a known name.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-25 08:38:19 -03:00
Gyan Doshi
fa12d808d7 doc/encoders: update libwebpenc quality option
A private encoder option 'quality' was added in 716674b151, making
the doc entry obsolete.
2022-03-24 17:33:00 +05:30
Paul B Mahol
28d011516b avfilter/x86/vf_limiter: use movu, dst may not be always aligned
Happens with pad filter after limiter.
2022-03-24 09:44:09 +01:00
Andreas Rheinhardt
f4098bbc3b avcodec/bsf: Add FFBitStreamFilter, hide internals of BSFs
This patch is analogous to 20f9727018:
It hides the internal part of AVBitStreamFilter by adding a new
internal structure FFBitStreamFilter (declared in bsf_internal.h)
that has an AVBitStreamFilter as its first member; the internal
part of AVBitStreamFilter is moved to this new structure.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-23 23:45:45 +01:00
Andreas Rheinhardt
1dcd0adedd avformat: Remove unnecessary inclusions from libavcodec
Also improve the other headers a bit while at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-23 23:45:39 +01:00
Andreas Rheinhardt
33df1ba6b2 avcodec, avformat: Remove unnecessary inclusions of lavc/internal.h
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-23 23:45:39 +01:00
Andreas Rheinhardt
ef92c352e7 avfilter/vf_vpp_qsv: Remove unnecessary lavc and lavf headers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-23 23:45:38 +01:00
Andreas Rheinhardt
a9cc413496 avcodec/internal: Move FF_QSCALE_TYPE_* to mpegvideodec.h
These values are only used by mpegvideo-based decoders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-23 23:45:38 +01:00
Andreas Rheinhardt
8abfc327bd avfilter/qp_table: Stop using FF_QSCALE_TYPE_*
All FF_QSCALE_TYPE values used by libavfilter originate
from libavfilter (namely from ff_qp_table_extract());
no value is exchanged between libavcodec and libavutil.
The values that are exchanged (and used in libavfilter)
are of type enum AVVideoEncParamsType.

Therefore this patch stops using said FF_QSCALE_TYPE_*
in libavfilter and uses enum AVVideoEncParamsType
directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-23 23:45:38 +01:00
Andreas Rheinhardt
e142153bd7 avcodec/internal, avfilter/qp_table: Remove unused FF_QSCALE_TYPEs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-23 23:45:38 +01:00
Jaakko Perttilä
b1cbeabf5e ffmpeg: add packet duration to AVPacket logging
Especially useful when debugging subtitle output, but also shows
if values are set or not for demux and encoding.

Co-authored-by: Jan Ekström <jan.ekstrom@24i.com>

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2022-03-23 17:26:20 +02:00