1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-07 11:13:41 +02:00
Commit Graph

95228 Commits

Author SHA1 Message Date
Michael Niedermayer
ec749ed222 avcodec/aacps: Fix integer overflows in hybrid_synthesis()
Fixes: signed integer overflow: -822667928 + -1399761199 cannot be represented in type 'int'
Fixes: 15756/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5645182051024896

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-11 22:43:14 +02:00
Michael Niedermayer
0e4a0e962c avcodec/mpeg4videodec: Fix integer overflow in mpeg4_decode_studio_block()
Fixes: signed integer overflow: 24023040 * 112 cannot be represented in type 'int'
Fixes: 16570/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5173275211071488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-11 22:42:19 +02:00
Michael Niedermayer
b6b9ac5698 avcodec/vp56rac: delay signaling an error on truncated input
A threshold of 1 is sufficient for simple_dump_cut.webm, 10 is used
just to be sure the next truncated file doesnt cause the same issue

Obvious alternative fixes are to simply accept that the file is broken or to
write some advanced error concealment or to
simply accept that the decoder wont stop at the end of input.

Fixes: Ticket 8069 (artifacts not the differing md5 which was there before 1afd246960)
Fixes: simple_dump_cut.webm
Fixes: regression of 1afd246960

fate-vp5 changes because the last frame is truncated and now handled
differently.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-11 22:36:33 +02:00
Maxime Jourdan
b81a1c5bea avcodec/v4l2_context: set frame SAR using VIDIOC_CROPCAP
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-11 13:07:42 -07:00
Aman Gupta
0085c4d478 avcodec/v4l2_buffers: use correct timebase for encoder/decoder
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-11 13:07:42 -07:00
Aman Gupta
80c9237b2f avcodec/v4l2_m2m_dec: fix compile
internal.h header required for FF_CODEC_CAP_SETS_PKT_DTS

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-11 11:29:48 -07:00
Maxime Jourdan
584ac1ad0b avcodec/v4l2_m2m_dec: fix dropped packets while decoding
* FFmpeg retrieves a packet from the bitstream
* It attempts to get an input buffer (from its own list or by dequeuing one from the driver)
* If no input buffer is found, the bitstream packet is dropped instead of scheduled for trying again later

It's an issue that showed especially at high speeds (like using `-f null -` as output parameters).

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-11 10:31:21 -07:00
Aman Gupta
fac834b2ae avcodec/v4l2_context: expose timeout for dequeue_frame
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-11 10:31:18 -07:00
Aman Gupta
3475758a37 avcodec/v4l2_m2m_dec: set pkt_dts on decoded frames to NOPTS
Without this ffmpeg will attempt to copy the dts from the
most recently enqueued packet into the most recently dequeued
frame, which does not account for the buffering inside v4l2
and is not accurate.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-11 10:28:56 -07:00
Aman Gupta
8dc973dc89 avcodec/v4l2_buffers: read height/width from the proper context
Frames are generally dequeued into capture buffers, so using
the output properties here was incorrect. It happened to work
fine for decoding, since the output/capture buffers have the same
dimensions.

For the v4l2 scaler, the dimensions can be different between output
and capture. Using the buffer's associated context makes this code
work correctly regardless of where the frame is coming from.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-11 10:28:56 -07:00
Paul B Mahol
efc73b13ac avfilter/vf_v360: remove pointless special case when allocating stuff 2019-09-11 16:43:10 +02:00
Paul B Mahol
7ce7002664 avfilter/vf_v360: refactor FoV calculation for stereographic
Move in out of loop.
2019-09-11 16:25:21 +02:00
Andriy Gelman
78b86c30d3 avcodec/h2645_parse: simplify memset call
Removed (new_size - pkt->nals_allocated) because this value is always 1
during the call.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-11 10:23:26 -03:00
Paul B Mahol
783ea9c1c5 avfilter/vf_v360: extend max limit to vertical fov 2019-09-11 15:12:56 +02:00
Paul B Mahol
cb41c2af92 avfilter/vf_v360: really fix FoV selection
Big thanks to Michael Koch for providing actual formula.
2019-09-11 15:12:56 +02:00
Jun Zhao
944d76a3e0 lavfi/sinc: fix memory leak in error handling path
free work&pi_wraps in error handling path to avoid memory leak.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-09-11 10:36:34 +08:00
Jun Zhao
44b55a8c9c lavfi/anequalizer: fix memory leak in error handling path
free the pad.name in error handling path to avoid memory leak.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-09-11 10:36:34 +08:00
Lynne
4ce1e13b54 checkasm: add opusdsp tests 2019-09-11 03:28:22 +01:00
Lynne
6b22e28f4c opusdsp: adjust and optimize C function to match assembly
The C and asm versions behaved differently _outside_ of the codec.

The C version returned pre-multiplied 'state' for the next execution
to use right away, while the assembly version outputted non-multiplied
'state' for the next execution to multiply to save instructions.
Since the initial state when initialized or seeking is always 0,
and since C and asm versions were never mixed, there was no issue.

However, comparing outputs directly in checkasm doesn't work without
dividing the initial state by CELT_EMPH_COEFF and multiplying the
returned state by CELT_EMPH_COEFF for the assembly function.

Since its actually faster to do this in C as well, copy the behavior the
asm versions use. As a reminder, the initial state 0 is divided by
CELT_EMPH_COEFF on seek and init (just in case in the future this is
changed, its technically more correct to init with CELT_EMPH_COEFF than 0,
however when seeking this will result in more audiable pops, unlike with 0
where the output gets in sync over a few samples).
2019-09-11 03:28:22 +01:00
Lukas Rusak
40a433e34b avcodec/v4l2_buffers: split out v4l2_buf_increase_ref helper
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 19:12:47 -07:00
Aman Gupta
d620b1f9de avcodec/v4l2_buffers: split out V4L2Buffer generation into helper method
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 19:12:47 -07:00
Aman Gupta
2b21bb4a87 avcodec/v4l2_buffers: split out AVFrame generation into helper method
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 19:12:47 -07:00
Aman Gupta
b3b958c19e avcodec/v4l2_buffers: teach ff_v4l2_buffer_avframe_to_buf about contiguous planar formats
This fixes h264_v4l2m2m encoding on the Raspberry Pi

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 19:05:31 -07:00
Aman Gupta
84540b2b84 avcodec/v4l2_m2m_enc: fix indentation and add M2MENC_CLASS macro
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 19:05:31 -07:00
Lukas Rusak
f9b0f88aa4 avcodec/v4l2_m2m_dec: fix indentation and add M2MDEC_CLASS macro
This just makes the M2MDEC_CLASS similar to how it is done in rkmpp. It looks
clean and has proper indentation

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 19:05:18 -07:00
Aman Gupta
c0c7946196 avcodec/v4l2_m2m: decouple v4l2_m2m helpers from AVCodecContext
This will allow re-use of the m2m backend with AVFilterContext

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 19:01:13 -07:00
Dave Stevenson
d61cf1b1eb avcodec/v4l2_buffers: Add handling for NV21 and YUV420P
The single planar support was for NV12 only.
Add NV21 and YUV420P support.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 18:56:40 -07:00
Aman Gupta
7bb6898b16 avcodec/v4l2_m2m: fix av_pix_fmt changing when multiple /dev/video* devices are probed
On the RPI, three different /dev/video devices exist (decoder, scaler, encoder).

When probing the devices in order, the originally requested pix fmt
would be mutated causing the wrong one to be chosen when a matching
device was finally found.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 18:52:37 -07:00
Aman Gupta
ac52e06e56 avcodec/v4l2_m2m: disable info logging during device probe
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 18:52:37 -07:00
Aman Gupta
ab4835f418 avcodec/v4l2_m2m_enc: add support for -force_key_frames
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 18:52:37 -07:00
Paul B Mahol
0f0f5188ac avfilter/vf_v360: remove w/h changing for flat output
Fixes crashes with bigger h/v fov.
2019-09-11 00:37:02 +02:00
Paul B Mahol
f705dc9a74 avfilter/vf_v360: increase h_fov max limit 2019-09-11 00:37:02 +02:00
Paul B Mahol
ccaeabd092 avfilter/vf_v360: fix fov calculation for stereographic output 2019-09-11 00:37:02 +02:00
Aman Gupta
7fddf4b266 avcodec/mediacodec_surface: define and use FFANativeWindow to mimic NDK interface
This will make it easy to switch to ANativeWindow_fromSurface
and ANativeWindow_release in the future.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 13:51:05 -07:00
Aman Gupta
8a3623e2fb avcodec/mediacodecdec: warn when input buffers are not configured with proper size
In rare circumstances, if the codec is not configured with the
proper parameters the input buffers can be allocated with a size
that's too small to hold an individual packet. Since MediaCodec
expects exactly one incoming buffer with a given PTS, it is not
valid to split data for a given PTS across two input buffers.

See https://developer.android.com/reference/android/media/MediaCodec#data-processing:

  > Do not submit multiple input buffers with the same timestamp

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 13:51:05 -07:00
Paul B Mahol
e26fb6a714 doc/filters: extend flip options in v360 filter 2019-09-10 20:29:43 +02:00
Paul B Mahol
5fcb3cbaf0 avfilter/vf_v360: increase v_fov max limit 2019-09-10 20:18:10 +02:00
Paul B Mahol
329505d908 avfilter/vf_v360: add support for stereographic as input projection 2019-09-10 18:58:51 +02:00
Michael Niedermayer
10ea6c3116 avcodec/pnm_parser: Use memchr() in pnm_parse()
Fixes: Timeout (45sec -> 0.5sec)
Fixes: 16942/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PPM_fuzzer-5085393073995776

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-09-10 17:21:54 +02:00
Nikolas Bowe
b794df43f3 avfilter/vf_fps: Avoid inlink fifo build up.
When duplicating frames we need to schedule for activation again, otherwise frames can build up in the inlink fifo.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-10 17:21:54 +02:00
Pascal Massimino
857fd2ad99 avcodec/webp: fix decoding for trailing junk
some bitstream have trailing junk, despite being valid webp data.
In case of apparent error, abort the loop and let *got_frame
decide whether this is an error or not.

fixes trac #8107 (/#7612)

Another possibility would be turning the loop into:
    while (!*got_frame) {...}

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-10 17:21:54 +02:00
Jun Zhao
3740bdee77 lavf/avidec: fix memory leak in error handling path
free the value in error handling path to avoid the memory leak.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-10 17:21:54 +02:00
Shiyou Yin
de5543d8d4 avcodec/mips: Fix a warnning of indentation not reflect the block structure.
The indentation of code dose not reflect the if block structure in
'apply_ltp_mips', and this will generate a warnning when build with
'-Wall' or '-Wmisleading-indentation'.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-10 17:21:53 +02:00
Nicolas Gaullier
cae5b36e20 avcodec/h264: Fix poc_lsb in open gop context
When no IDR nor mmco_reset is found, prev_poc_lsb is
undefined and shall not be assumed to be zero
2019-09-10 12:19:23 +02:00
Michael Niedermayer
9d1e98afee tools/target_dec_fuzzer: Adjust threshold for LSCR
Fixes: Timeout (12sec -> 3sec)
Fixes: 15327/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LSCR_fuzzer-5702887719567360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-09 23:04:53 +02:00
Paul B Mahol
2f071767d9 doc/filters: fix typo in v360 2019-09-09 22:47:36 +02:00
Aman Gupta
35b0e75b54 avcodec/mediacodec_surface: drop unnecessary local variable
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-09 13:25:12 -07:00
Aman Gupta
d0e6762768 avcodec/mediacodecdec_common: log codec name during configure/start failures
Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2019-09-09 13:25:09 -07:00
Aman Gupta
ca613dcc38 avcodec/mediacodecdec_common: ensure current input buffer is always used correctly
The loop may mutate the input buffer, so re-fetch it to ensure
the current one is always used.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2019-09-09 13:25:06 -07:00
Aman Gupta
f821d19531 avcodec/mediacodecdec_common: improve trace logging for end-of-stream
Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2019-09-09 13:25:03 -07:00