1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00
Commit Graph

99492 Commits

Author SHA1 Message Date
Timo Rothenpieler
13c74291ec avcodec/cuviddec: avoid copy of uninitialized extradata pointer 2020-10-01 21:28:55 +02:00
Timo Rothenpieler
c75756d047 avcodec/cuviddec: use correct type for extradata_size 2020-10-01 20:49:59 +02:00
Timo Rothenpieler
bba6262080 avcodec/cuviddec: fix copy&paste error 2020-10-01 20:20:48 +02:00
Andreas Rheinhardt
22a2386a56 avformat/movenc: Fix stack overflow when remuxing timecode tracks
There are two possible kinds of timecode tracks (with tag "tmcd") in the
mov muxer: Tracks created internally by the muxer and timecode tracks
sent by the user. If any of the latter exists, the former are
deactivated. The former all belong to another track, the source
track; the latter don't have a source track set, but the index of the
source track is initially zeroed by av_mallocz_array(). This is a
problem since 3d894db700: Said commit added
a function that calculates the duration of tracks and the duration of
timecode tracks is calculated by rescaling the duration (calculated by
the very same function) of the source track. This gives an infinite
recursion if the first track (the one that will be treated as source
track for all timecode tracks) is a timecode track itself, leading to a
stack overflow.

This commit fixes this by not using the nonexistent source track
when calculating the duration of timecode tracks not created internally
by the mov muxer.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-01 14:30:34 +02:00
Andreas Rheinhardt
66eadb3926 avcodec/utils: Reindentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-01 13:35:28 +02:00
Andreas Rheinhardt
b8e0ceda11 avcodec/utils: Also free encoder extradata on avcodec_open2() error
It is owned by libavcodec for encoders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-01 13:34:57 +02:00
Andreas Rheinhardt
d1dcc20126 avcodec/utils: Don't forget cleaning up when allocating priv_data fails
Allocating an AVCodecContext's priv_data used to be the first object
allocated in avcodec_open2(), so it was unnecessary to goto free_and_end
(which does the cleanup) upon error here. But this is no longer so since
f3a29b750a.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-01 13:19:42 +02:00
Andreas Rheinhardt
c6e54d14c5 avcodec/utils: Improve check for freeing codec private options
Don't check for AVCodec.priv_data_size (which is always true if
AVCodec.priv_class is set). Instead check for AVCodecContext.priv_data
to actually exist.

(Note: av_opt_free(NULL) is a no-op.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-01 13:18:18 +02:00
Andreas Rheinhardt
502c5fe101 avcodec/utils: Remove always-true check
The first thing avcodec_open2() allocates is the AVCodecInternal. If
allocating it fails, a jump to end occurs; but if an error happens after
its allocation, a jump to free_and_end happens which frees all
allocations performed so far and then jumps to end. Yet free_and_end
contained a check for AVCodecInternal (after having already dereferenced
it to check whether ff_thread_free() needs to be called) which is of
course always true. So remove it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-01 12:50:57 +02:00
Anton Khirnov
33b4b788aa opusdec: do not fail when LBRR frames are present
Decode and discard them.

Fixes ticket 4641.
2020-10-01 11:16:17 +02:00
Nicolas George
3bf5cc9c58 fate: add scale filters for big-endian architectures.
Filters mostly work in native endianness, but they must output
a specified endianness, usually little: that requires a final
conversion for big endian.

I do not know what's the deal with gif-deal: inserting explicitly
the filters that are implicitly inserted result in less frames in
output. Probably a strange problem of duration.
2020-09-30 16:39:34 +02:00
Andreas Rheinhardt
9d8f9b2e40 swresample/audioconvert: Fix left shift of negative value
Fixes ticket #8219.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-30 10:50:45 +02:00
James Almer
aa5e49e46d avcodec/av1dec: call ff_cbs_flush() on decoder flush
Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-29 21:38:27 -03:00
James Almer
3392c1b05e avcodec/av1dec: fix check for active sequence header
We clear the AV1RawSequenceHeader pointer on flush, not the relevant AVBufferRef.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-29 21:38:27 -03:00
James Almer
ea4b10249d avcodec/av1dec: parse dimensions from the sequence header in extradata
Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-29 21:38:27 -03:00
James Almer
421906dddb avcodec/cbs_vp9: implement a CodedBitstreamType.flush() callback
Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-29 21:38:27 -03:00
James Almer
0c84253353 avcodec/cbs_h2645: implement CodedBitstreamType.flush() callbacks
Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-29 21:38:27 -03:00
James Almer
dfd184eed5 avcodec/cbs_av1: implement a CodedBitstreamType.flush() callback
Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-29 21:38:27 -03:00
James Almer
515b6419ca avcodec/cbs: add a flush callback to CodedBitstreamType
Used to reset the codec's private internal state.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-29 21:38:27 -03:00
Paul B Mahol
23d0754165 avfilter/vf_v360: stop using floats variables in xyz_to_octahedron
Use proper integer variables.
2020-09-30 00:09:22 +02:00
Timo Rothenpieler
a96743a05c avcodec/cuviddec: handle arbitrarily sized extradata 2020-09-29 23:29:04 +02:00
Andreas Rheinhardt
5bc74d06da avcodec/utils: Only call codec->close if init has been called
avcodec_open2() also called the AVCodec's close function if an error
happened before init had ever been called if the AVCodec has the
FF_CODEC_CAP_INIT_CLEANUP flag set. This is against the documentation of
said flag: "The codec allows calling the close function for deallocation
even if the init function returned a failure."

E.g. the SVQ3 decoder is not ready to be closed if init has never been
called.

Fixes: NULL dereference
Fixes: 25762/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SVQ3_fuzzer-5716279070294016

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

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-29 21:18:19 +02:00
Mark Thompson
4fceb2634e Revert "avfilter/setparams: add FF_FILTER_FLAG_HWFRAME_AWARE"
This reverts commit 5bbf58ab87.

The setparams filters are not hwframe aware, so the default context
passthrough behaviour is needed to allow using them with hardware frames.
2020-09-29 17:07:43 +01:00
Paul B Mahol
12585c87e6 avfilter/vf_v360: simplify input flipping 2020-09-29 14:21:22 +02:00
Paul B Mahol
86b29c0cd0 avfilter/vf_v360: split maps into slices 2020-09-29 14:21:20 +02:00
Mingyu Yin
ad2546e3b3 dnn/native: add native support for dense
Signed-off-by: Mingyu Yin <mingyu.yin@intel.com>
2020-09-29 14:19:55 +08:00
Rick Kern
adcdf0bc60 libavcodec/videotoolboxenc: Fix crash when frame received after error
Signed-off-by: Rick Kern <kernrj@gmail.com>
2020-09-28 21:48:23 -04:00
Tian Qi
9837f5a643 avcodec/videotoolboxenc: move pthread_cond_signal after add buffer to the queue
In the VT encoding insertion by FFmpeg,
and vtenc_q_push is callback to add the encoded data
to the singly linked list group in VTEncContext,
and consumers are notified to fetch it.
However, because it first informs consumers of pthread_cond_signal,
and then inserts the data into the tail,
there is a multi-thread safety hazard.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Rick Kern <kernrj@gmail.com>
2020-09-28 21:46:40 -04:00
Tian Qi
1cbea3f9ca avcodec/videotoolboxenc: don't wait when flushing data
because there is run in thread mode, few times will block
the workflow at the wait, so check the status is flushing data,
don't wait when flushing data.

Signed-off-by: Tian Qi <tianqi@kuaishou.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Rick Kern <kernrj@gmail.com>
2020-09-28 21:46:30 -04:00
Zhao Zhili
d80d91d213 avcodec/videotoolboxenc: fix use after destroy
The lock is used in clear_frame_queue().

Signed-off-by: Rick Kern <kernrj@gmail.com>
2020-09-28 21:46:23 -04:00
Zhao Zhili
419d2524a8 avcodec/videotoolboxenc: fix align issue
bool a53_cc is accessed as int:
src/libavutil/opt.c:129:9: runtime error: store to misaligned
address 0x7fbf454121a3 for type 'int', which requires 4 byte alignment

Signed-off-by: Rick Kern <kernrj@gmail.com>
2020-09-28 21:45:54 -04:00
Harry Mallon
e16788a323 avcodec/videotoolboxenc: Allow full range 10bit pixel format input
Signed-off-by: Harry Mallon <harry.mallon@codex.online>
Signed-off-by: Rick Kern <kernrj@gmail.com>
2020-09-28 20:46:36 -04:00
Harry Mallon
80384a6ec3 avcodec/videotoolboxenc: Set profile (main/main10) on HEVC encode
Signed-off-by: Harry Mallon <harry.mallon@codex.online>
Signed-off-by: Rick Kern <kernrj@gmail.com>
2020-09-28 20:46:05 -04:00
Michael Niedermayer
ddf2ba5497 avcodec/mv30: Fix several integer overflows in idct_1d()
Fixes: signed integer overflow: -1846510390 + -361755993 cannot be represented in type 'int'
Fixes: 23941/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5654696631730176

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-09-29 00:43:26 +02:00
Michael Niedermayer
165d6b876b avcodec/pgxdec: Fix invalid shift in write_frame_*
Fixes: left shift of negative value -121
Fixes: 23911/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGX_fuzzer-4986800258154496

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-09-29 00:43:26 +02:00
Andreas Rheinhardt
4106013523 avformat/movenc: Fix segfault upon allocation error
Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-28 20:41:20 +02:00
Michael Niedermayer
24352ca792 avformat/iff: Check data_size not overflowing int64
Fixes: Infinite loop
Fixes: 25844/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5660803318153216

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>
2020-09-28 20:22:30 +02:00
Anton Khirnov
56ff01e6ec pthread_frame: use av_buffer_replace() to simplify code 2020-09-28 11:33:36 +02:00
Anton Khirnov
16f8b96dfa mpegvideo: use av_buffer_replace() to simplify code 2020-09-28 11:33:36 +02:00
Anton Khirnov
eff289ce9f hevcdec: use av_buffer_replace() to simplify code 2020-09-28 11:33:36 +02:00
Anton Khirnov
68918d3b7f lavu/buffer: add a convenience function for replacing buffers
A common pattern e.g. in libavcodec is replacing/updating buffer
references: unref old one, ref new one. This function allows simplifying
such code and avoiding unnecessary refs+unrefs if the references are
already equivalent.
2020-09-28 11:33:35 +02:00
Pavel Koshevoy
5bbf58ab87 avfilter/setparams: add FF_FILTER_FLAG_HWFRAME_AWARE
Allow setparams to be used with hw backed frames and
avoid an assertion failure in avfilter_config_links.
2020-09-27 19:15:44 -06:00
Jun Zhao
5bf22519ce lavf/hls: add AC-3/EAC-3 to allowed extensions file list
Add AC-3/EAC-3 to allowed extensions file list.

From HTTP Live Streaming 2nd Edition draft-pantos-hls-rfc8216bis-07
section 3.1.3.Packed Audio, HLS demuxer need to support MP3/AC-3/EAC-3.

Reviewd-by: Steven Liu <liuqi05@kuaishou.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-09-28 09:12:09 +08:00
Jun Zhao
ef868fa4a1 examples/muxing: misc style fixes
misc style fixes.

Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-09-28 09:11:21 +08:00
Paul B Mahol
6db1b1af4c avfilter/vf_v360: add octahedron format 2020-09-27 22:40:26 +02:00
Andrew Klaassen
a6e72fb46d vf_colorspace: Added linear trc.
This patch adds the coefficients for the linear gamma function (1,0,1,0)
to the colorspace filter.

Signed-off-by: Andrew Klaassen <clawsoon@yahoo.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2020-09-27 09:14:46 -04:00
Paul B Mahol
a3a6b56200 avcodec: add Argonaut Games Video decoder 2020-09-27 09:56:13 +02:00
Andreas Rheinhardt
e575d59afe tests/fate-run: Always overwrite output files for md5 tests
Otherwise the result of such tests will not accurately reflect the
current state.

Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-27 09:51:31 +02:00
Zane van Iperen
ce30c3d5b9
avformat/argo_brp: use header frame counts
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-27 09:11:36 +10:00
Zane van Iperen
3ffb15a105
avformat/argo_brp: allow v1.1 ASF streams to have a non-22050 sample rate in certain circumstances
It seems that in files where the BASF block isn't first, v1.1 ASF streams are
allowed to be non-22050. Either this format is really inconsistent, or
FX Fighter and Croc just ignored the sample rate field, requiring the v1.1
restriction in the first place.

This bumps the version to 1.2 in these streams so they're not "corrected".

Found in Alien Odyssey games files in:
./GRAPHICS/COMMBUNK/{{COMADD1,COMM2_{1,2,3E},COMM3_{2,3,4,5,6}},FADE{1,2}}.BRP

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-27 09:11:36 +10:00