ffmpeg.git
13 months agoavformat/mov: parse sdtp atom and set the pkt disposable flag accordingly
Matthieu Bouron [Fri, 27 Sep 2019 12:57:09 +0000 (14:57 +0200)]
avformat/mov: parse sdtp atom and set the pkt disposable flag accordingly

Allows the creation of the sdtp atom while remuxing MP4 to MP4. This
atom is required by Apple devices (iPhone, Apple TV) in order to accept
2160p medias.

13 months agoavcodec/zmbvenc: Correct offset in buffer
Andreas Rheinhardt [Thu, 10 Oct 2019 09:47:41 +0000 (11:47 +0200)]
avcodec/zmbvenc: Correct offset in buffer

zmbvenc allocates a buffer for a picture with padding on all four sides:
The stride is choosen so large that it already contains padding on the
right; the height also includes padding rows. The padding on the right
of each row is also reused as padding for the left of the next row. So
one still needs to add padding on the left for the first row. This is done
by offsetting the actual pointer used to access the picture from the
pointer returned by av_mallocz and the formula for this offset was
wrong, because it ignored that a pixel can take more than one byte when
calculating the offset resulting from the left padding of the first row.

This fixes accesses outside of the allocated buffer that were reported
in tickets #7980 and #7994. No writes were ever attempted outside of
the buffer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agofftools/ffmpeg: Improve streamcopy
Andreas Rheinhardt [Fri, 11 Oct 2019 04:06:58 +0000 (06:06 +0200)]
fftools/ffmpeg: Improve streamcopy

do_streamcopy() has a packet that gets zero-initialized first, then gets
initialized via av_init_packet() after which some of its fields are
oerwritten again with the actually desired values (unless it's EOF): The
side data is copied into the packet with av_copy_packet_side_data() and
if the source packet is refcounted, the packet will get a new reference
to the source packet's data. Furthermore, the flags are copied and the
timestamp related fields are overwritten with new values.

This commit replaces this by using av_packet_ref() to both initialize
the packet as well as populate its fields with the right values (unless
it's EOF again in which case the packet will still be initialized). The
differences to the current approach are as follows:
a) There is no call to a deprecated function (av_copy_packet_side_data())
any more.
b) Several fields that weren't copied before are now copied from the source
packet to the new packet (e.g. pos). Some of them (the timestamp related
fields) may be immediately overwritten again and some don't seem to be
used at all (e.g. pos), but in return using av_packet_ref() allows to forgo
the initializations.
c) There was no check for whether copying side data fails or not. This
has been changed: Now the program is exited in this case.

Using av_packet_ref() does not lead to unnecessary copying of data,
because the source packets are already always refcounted (they originate
from av_read_frame()).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/qdmc: Check input space in qdmc_get_vlc()
Michael Niedermayer [Thu, 10 Oct 2019 16:26:44 +0000 (18:26 +0200)]
avcodec/qdmc: Check input space in qdmc_get_vlc()

Fixes: Timeout (125sec -> 0.4sec)
Fixes: 18059/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDMC_fuzzer-5656195825664000

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>
13 months agoavformat/mpjpegdec: ensure seekback for latest chunk
Moritz Barsnick [Sun, 6 Oct 2019 22:19:30 +0000 (00:19 +0200)]
avformat/mpjpegdec: ensure seekback for latest chunk

Not only the first, but each latest chunk must be cached to allow
seekback after finding the mime boundary.

Fixes trac #5023 and #5921.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavformat/mpjpegdec: fix strict boundary search string
Moritz Barsnick [Sun, 6 Oct 2019 22:19:29 +0000 (00:19 +0200)]
avformat/mpjpegdec: fix strict boundary search string

According to RFC1341, the multipart boundary indicated by the
Content-Type header must be prepended by CRLF + "--", and followed
by CRLF. In the case of strict MIME header boundary handling, the
"--" was forgotten to add.

Fixes trac #7921.

A side effect is that this coincidentally breaks enforcement of
strict MIME headers against servers running motion < 3.4.1, where
the boundary announcement in the HTTP headers incorrectly used the
prefix "--", which exactly matched this bug's behavior.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavformat/mpjpegdec: fix finding multipart boundary parameter
Moritz Barsnick [Sun, 6 Oct 2019 22:19:28 +0000 (00:19 +0200)]
avformat/mpjpegdec: fix finding multipart boundary parameter

The string matching function's return value was evaluated incorrectly.

Fixes trac #7920.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavutil/eval: add sgn()
Paul B Mahol [Fri, 11 Oct 2019 19:44:09 +0000 (21:44 +0200)]
avutil/eval: add sgn()

13 months agoavformat/dv: free all allocated structs on dv_read_header failure
James Almer [Fri, 11 Oct 2019 17:34:17 +0000 (14:34 -0300)]
avformat/dv: free all allocated structs on dv_read_header failure

Also propagate proper AVERROR codes while at it.

Fixes ticket #8230.

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
13 months agolibavcodec/amfenc_h264.c: Changed loop filter flag default value.
OvchinnikovDmitrii [Fri, 11 Oct 2019 15:37:13 +0000 (18:37 +0300)]
libavcodec/amfenc_h264.c: Changed loop filter flag default value.

The value has been changed to match the recommended(by AMF Encoder team)

13 months agoavfilter/vf_signalstats: fix stack buffer overflow
Paul B Mahol [Fri, 11 Oct 2019 11:32:24 +0000 (13:32 +0200)]
avfilter/vf_signalstats: fix stack buffer overflow

Fixes #8249

13 months agoavfilter/vf_w3fdif: deny processing small videos
Paul B Mahol [Fri, 11 Oct 2019 10:55:13 +0000 (12:55 +0200)]
avfilter/vf_w3fdif: deny processing small videos

Fixes #8243

13 months agoavfilter/vf_bitplanenoise: fix overreads
Paul B Mahol [Fri, 11 Oct 2019 10:42:13 +0000 (12:42 +0200)]
avfilter/vf_bitplanenoise: fix overreads

Fixes #8244

13 months agoavfilter/vf_deflicker: fix invalid access
Paul B Mahol [Fri, 11 Oct 2019 10:23:26 +0000 (12:23 +0200)]
avfilter/vf_deflicker: fix invalid access

Fixes #8253

13 months agoavfilter/vf_waveform: better guard against picking wrong pixel format
Paul B Mahol [Fri, 11 Oct 2019 10:07:10 +0000 (12:07 +0200)]
avfilter/vf_waveform: better guard against picking wrong pixel format

Fixes #8252

13 months agoavfilter/vf_neighbor: check if width is 1
Paul B Mahol [Fri, 11 Oct 2019 09:18:10 +0000 (11:18 +0200)]
avfilter/vf_neighbor: check if width is 1

Fixes #8242

13 months agoavfilter/vf_floodfill: finish early if source and destination fill matches
Paul B Mahol [Thu, 10 Oct 2019 19:50:03 +0000 (21:50 +0200)]
avfilter/vf_floodfill: finish early if source and destination fill matches

Fixes #8236

13 months agoavfilter/vf_random: fix crash
Paul B Mahol [Thu, 10 Oct 2019 19:04:56 +0000 (21:04 +0200)]
avfilter/vf_random: fix crash

Fixes #8235.

13 months agoavcodec/dstdec: Check for input exhaustion
Michael Niedermayer [Wed, 2 Oct 2019 18:48:40 +0000 (20:48 +0200)]
avcodec/dstdec: Check for input exhaustion

Fixes: Timeout (239sec -> 16sec)
Fixes: 17811/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5715508149616640

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>
13 months agoavcodec/wmaprodec: Fix cleanup on error
Michael Niedermayer [Wed, 9 Oct 2019 08:19:42 +0000 (10:19 +0200)]
avcodec/wmaprodec: Fix cleanup on error

Fixes: memleaks
Fixes: 18023/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA2_fuzzer-5642535011090432

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>
13 months agoavcodec/pcm: Check bits_per_coded_sample
Michael Niedermayer [Sat, 28 Sep 2019 23:22:37 +0000 (01:22 +0200)]
avcodec/pcm: Check bits_per_coded_sample

Fixes: shift exponent -2 is negative
Fixes: 17736/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PCM_F16LE_fuzzer-5742815929171968
Fixes: 17998/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PCM_F24LE_fuzzer-5716980383875072

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>
13 months agoavcodec/magicyuv: remove duplicate code
Limin Wang [Tue, 24 Sep 2019 01:13:52 +0000 (09:13 +0800)]
avcodec/magicyuv: remove duplicate code

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/scpr: Check minimum size of type 17
Michael Niedermayer [Thu, 26 Sep 2019 19:56:48 +0000 (21:56 +0200)]
avcodec/scpr: Check minimum size of type 17

Improves: Timeout (85sec -> 46sec)
Improves: 17644/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5715704283660288

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>
13 months agoavcodec/exr: Allow duplicate use of channel indexes
Michael Niedermayer [Thu, 26 Sep 2019 13:40:30 +0000 (15:40 +0200)]
avcodec/exr: Allow duplicate use of channel indexes

Fixes: Ticket #8203

Reported-by: durandal_1707
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/fitsdec: Fail on 0 naxisn
Michael Niedermayer [Mon, 30 Sep 2019 06:50:41 +0000 (08:50 +0200)]
avcodec/fitsdec: Fail on 0 naxisn

Fixes: Timeout (100+ sec -> 23ms)
Fixes: 17769/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5678314672357376

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>
13 months agoavfilter/vf_delogo: make the interp value compute method simple
Steven Liu [Tue, 8 Oct 2019 03:45:33 +0000 (11:45 +0800)]
avfilter/vf_delogo: make the interp value compute method simple

because the interp >= 0UL comparison of an unsigned value is always true
fix CID: 1454642

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavfilter/vf_delogo: add auto set the area inside of the frame
Steven Liu [Wed, 4 Sep 2019 15:53:05 +0000 (23:53 +0800)]
avfilter/vf_delogo: add auto set the area inside of the frame

when the area outside of the frame, then use expr should
give user warning message and auto set to the area inside of the frame.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavformat/iff: fix memleak when get st->codecpar->extradata failed in iff_read_header
Steven Liu [Wed, 9 Oct 2019 03:50:49 +0000 (11:50 +0800)]
avformat/iff: fix memleak when get st->codecpar->extradata failed in iff_read_header

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavformat/jvdec: fix memleak when read_header failed
Steven Liu [Wed, 9 Oct 2019 03:56:22 +0000 (11:56 +0800)]
avformat/jvdec: fix memleak when read_header failed

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agolavfi/hqdn3d: add slice thread optimization
Jun Zhao [Wed, 2 Oct 2019 02:31:13 +0000 (10:31 +0800)]
lavfi/hqdn3d: add slice thread optimization

Enabled one thread per plane, used the test command for 1080P video
(YUV420P format) as follow:

ffmpeg -i 1080p.mp4 -an -vf hqdn3d -f null /dev/nul

This optimization improved the performance about 30% in 1080P YUV420P
case (from 110fps to 143fps), also pass the framemd5 check and FATE.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
13 months agolavfi/v360: remove unnecessary cast for void *
Jun Zhao [Wed, 9 Oct 2019 14:14:49 +0000 (22:14 +0800)]
lavfi/v360: remove unnecessary cast for void *

Remove unnecessary cast for void * pointer.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
13 months agolavfi/remap: remove unnecessary cast for void *
Jun Zhao [Wed, 9 Oct 2019 14:14:00 +0000 (22:14 +0800)]
lavfi/remap: remove unnecessary cast for void *

Remove unnecessary cast for void * pointer.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
13 months agolavfi/lenscorrection: remove unnecessary cast for void *
Jun Zhao [Wed, 9 Oct 2019 11:24:33 +0000 (19:24 +0800)]
lavfi/lenscorrection: remove unnecessary cast for void *

Remove unnecessary cast for void * pointer.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
13 months agolavfi/colorspace: typedef ThreadData as all other filters
Jun Zhao [Wed, 9 Oct 2019 11:21:46 +0000 (19:21 +0800)]
lavfi/colorspace: typedef ThreadData as all other filters

typedef ThreadData as all other filters.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
13 months agodoc/filters: add more examples for afftfilt
Paul B Mahol [Wed, 9 Oct 2019 17:03:45 +0000 (19:03 +0200)]
doc/filters: add more examples for afftfilt

13 months agoavfilter/af_anlms: increase max limit for mu
Paul B Mahol [Wed, 9 Oct 2019 16:13:55 +0000 (18:13 +0200)]
avfilter/af_anlms: increase max limit for mu

13 months agoavfilter/af_adelay: fix buggy behaviour
Paul B Mahol [Wed, 9 Oct 2019 07:56:33 +0000 (09:56 +0200)]
avfilter/af_adelay: fix buggy behaviour

13 months agodoc/filters: document atempo command
Paul B Mahol [Wed, 9 Oct 2019 07:33:16 +0000 (09:33 +0200)]
doc/filters: document atempo command

13 months agodoc/filters: mention rubberband supported commands
Paul B Mahol [Wed, 9 Oct 2019 07:30:25 +0000 (09:30 +0200)]
doc/filters: mention rubberband supported commands

13 months agolavc/qsvdec: Add GPU-accelerated memory copy support
Linjie Fu [Tue, 8 Oct 2019 13:41:02 +0000 (21:41 +0800)]
lavc/qsvdec: Add GPU-accelerated memory copy support

GPU copy enables or disables GPU accelerated copying between video
and system memory. This may lead to a notable performance improvement.
Memory must be sequent and aligned with 128x64.

CMD:
ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -c:v h264_qsv
                    -gpu_copy on -i input.h264 -f null -
or:
ffmpeg -c:v h264_qsv -gpu_copy on -i input.h264 -f null -

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: ChaoX A Liu <chaox.a.liu@intel.com>
Signed-off-by: Zhong Li <zhong.li@intel.com>
13 months agolavc/qsv: remove vaapi device free function
Zhong Li [Tue, 8 Oct 2019 04:55:01 +0000 (12:55 +0800)]
lavc/qsv: remove vaapi device free function

It is not needed since av_buffer_unref() will call it internally

Signed-off-by: Zhong Li <zhong.li@intel.com>
13 months agoavformat/ivfdec: Change the length field to 32 bits
Raphaël Zumer [Tue, 1 Oct 2019 17:40:54 +0000 (13:40 -0400)]
avformat/ivfdec: Change the length field to 32 bits

Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
13 months agoavformat/ivfenc: Change the length fields to 32 bits
Raphaël Zumer [Wed, 2 Oct 2019 13:04:59 +0000 (09:04 -0400)]
avformat/ivfenc: Change the length fields to 32 bits

There is no change in the encoded bitstream, but this
ensures that the written field length is consistent
with the reference implementation.

Unused bytes are zeroed out for backwards compatibility.

Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
13 months agoavformat/ivfenc: Comment the length field encoding process
Raphaël Zumer [Tue, 1 Oct 2019 17:40:55 +0000 (13:40 -0400)]
avformat/ivfenc: Comment the length field encoding process

Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
13 months agoavfilter/formats: remove unnecessary unreference
Zhao Zhili [Mon, 30 Sep 2019 08:00:34 +0000 (16:00 +0800)]
avfilter/formats: remove unnecessary unreference

13 months agoavcodec/dxv: Subtract 12 earlier in dxv_decompress_cocg()
Michael Niedermayer [Tue, 24 Sep 2019 10:40:35 +0000 (12:40 +0200)]
avcodec/dxv: Subtract 12 earlier in dxv_decompress_cocg()

the data_start is after reading 12 bytes and if its subtracted
at the very end the intermediate might overflow

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agolibavcodec/dxv: Remove redundant seek
Michael Niedermayer [Tue, 24 Sep 2019 10:39:25 +0000 (12:39 +0200)]
libavcodec/dxv: Remove redundant seek

This seeks to the position the previous call to dxv_decompress_opcodes()
positioned us in case of success

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/ituh263dec: Check input for minimal frame size
Michael Niedermayer [Mon, 23 Sep 2019 22:42:04 +0000 (00:42 +0200)]
avcodec/ituh263dec: Check input for minimal frame size

Fixes: Timeout (28sec -> 3sec)
Fixes: 17559/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H263_fuzzer-5681050776240128

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/truemotion1: Check that the input has enough space for a minimal index_stream
Michael Niedermayer [Mon, 23 Sep 2019 23:43:35 +0000 (01:43 +0200)]
avcodec/truemotion1: Check that the input has enough space for a minimal index_stream

Fixes: Timeout (18sec -> 0.4sec)
Fixes: 17585/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION1_fuzzer-5117015135617024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavformat/mpsubdec: Clear queue on error
Michael Niedermayer [Sat, 21 Sep 2019 11:43:19 +0000 (13:43 +0200)]
avformat/mpsubdec: Clear queue on error

Fixes: Memleaks
Fixes: 17219/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5720539124989952

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/sunrast: Check that the input is large enough for the maximally compressed...
Michael Niedermayer [Sat, 21 Sep 2019 16:14:03 +0000 (18:14 +0200)]
avcodec/sunrast: Check that the input is large enough for the maximally compressed image

Fixes: Timeout (17sec -> 15ms)
Fixes: 17224/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SUNRAST_fuzzer-5663218491457536
Fixes: 17224/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SUNRAST_fuzzer-5735590015795200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/sunrast: Check for availability of maplength before allocating image
Michael Niedermayer [Sat, 21 Sep 2019 16:10:25 +0000 (18:10 +0200)]
avcodec/sunrast: Check for availability of maplength before allocating image

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/jpeglsdec: Apply transform only to initialized lines
Michael Niedermayer [Thu, 19 Sep 2019 16:52:50 +0000 (18:52 +0200)]
avcodec/jpeglsdec: Apply transform only to initialized lines

Fixes: Timeout (110sec -> 1sec)
Fixes: 17123/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AMV_fuzzer-5636452758585344

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/jpeglsdec: Return error codes from ls_decode_line()
Michael Niedermayer [Thu, 19 Sep 2019 16:51:29 +0000 (18:51 +0200)]
avcodec/jpeglsdec: Return error codes from ls_decode_line()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/flac_parser: Make expected_frame_num, expected_sample_num 64bit
Michael Niedermayer [Thu, 19 Sep 2019 14:28:57 +0000 (16:28 +0200)]
avcodec/flac_parser: Make expected_frame_num, expected_sample_num 64bit

Fixes: Integer overflow
Fixes: 17199/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-5696145187143680

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavfilter/af_anlms: add support for commands
Paul B Mahol [Tue, 8 Oct 2019 09:51:20 +0000 (11:51 +0200)]
avfilter/af_anlms: add support for commands

13 months agoavformat/mpeg: Remove set-but-unused variable
Andreas Rheinhardt [Tue, 8 Oct 2019 05:41:13 +0000 (07:41 +0200)]
avformat/mpeg: Remove set-but-unused variable

Forgotten in 7da57875.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
13 months agoavformat/hls: fix missing segment offset reset on last segment when http_multiple...
vectronic [Fri, 4 Oct 2019 22:04:12 +0000 (23:04 +0100)]
avformat/hls: fix missing segment offset reset on last segment when http_multiple is enabled.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: vectronic <hello.vectronic@gmail.com>
13 months agoavformat/hls: pass http offset options to http request
vectronic [Fri, 4 Oct 2019 21:56:02 +0000 (22:56 +0100)]
avformat/hls: pass http offset options to http request

made with persistent connections to prevent incorrect reset of
offset when demuxing HLS+FMP4

Signed-off-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: vectronic <hello.vectronic@gmail.com>
13 months agoavformat/http: add ff_http_do_new_request2 for options
vectronic [Fri, 4 Oct 2019 21:56:01 +0000 (22:56 +0100)]
avformat/http: add ff_http_do_new_request2 for options

add ff_http_do_new_request2() which supports options to be applied to
HTTPContext after initialisation with the new uri

Signed-off-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: vectronic <hello.vectronic@gmail.com>
13 months agoavformat/hlsenc: replace with av_freep for all av_free
Limin Wang [Tue, 24 Sep 2019 11:24:01 +0000 (19:24 +0800)]
avformat/hlsenc: replace with av_freep for all av_free

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
13 months agoavformat/hlsenc: replace with av_dirname to get the directory
Limin Wang [Tue, 24 Sep 2019 11:24:00 +0000 (19:24 +0800)]
avformat/hlsenc: replace with av_dirname to get the directory

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
13 months agoavformat/hlsenc: remove the unnecessary null pointer check
Limin Wang [Tue, 24 Sep 2019 11:23:59 +0000 (19:23 +0800)]
avformat/hlsenc: remove the unnecessary null pointer check

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
13 months agoavutil/avstring: support input path as a null pointer or empty string
Limin Wang [Tue, 24 Sep 2019 11:23:58 +0000 (19:23 +0800)]
avutil/avstring: support input path as a null pointer or empty string

Linux and OSX systems support basename and dirname via <libgen.h>, I plan to
make the wrapper interface conform to the standard interface first.
If it is feasible, I will continue to modify it to call the system interface
if there is already a system call interface.

You can get more description about the system interface by below command:
 "man 3 basename"

Reviewed-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
13 months agoavfilter/vf_pad: add logging context to log
Steven Liu [Mon, 30 Sep 2019 07:12:43 +0000 (15:12 +0800)]
avfilter/vf_pad: add logging context to log

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavfilter/boxblur: add logging context to log
Steven Liu [Mon, 30 Sep 2019 07:11:50 +0000 (15:11 +0800)]
avfilter/boxblur: add logging context to log

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavfilter/vf_scale_qsv: add logging context to log
Steven Liu [Mon, 30 Sep 2019 07:10:36 +0000 (15:10 +0800)]
avfilter/vf_scale_qsv: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavfilter/vf_crop: add logging context to log
Steven Liu [Mon, 30 Sep 2019 07:08:33 +0000 (15:08 +0800)]
avfilter/vf_crop: add logging context to log

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavcodec/pngdec: add logging context to log
Steven Liu [Mon, 30 Sep 2019 07:07:19 +0000 (15:07 +0800)]
avcodec/pngdec: add logging context to log

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavcodec/videotoolbox: add logging context to log
Steven Liu [Mon, 30 Sep 2019 07:04:41 +0000 (15:04 +0800)]
avcodec/videotoolbox: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavcodec/mpegvideo_enc: add logging context to log
Steven Liu [Mon, 30 Sep 2019 07:03:04 +0000 (15:03 +0800)]
avcodec/mpegvideo_enc: add logging context to log

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavformat/mms: add logging context to log
Steven Liu [Mon, 30 Sep 2019 06:50:28 +0000 (14:50 +0800)]
avformat/mms: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavformat/mmst: add logging context to log
Steven Liu [Mon, 30 Sep 2019 06:47:57 +0000 (14:47 +0800)]
avformat/mmst: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavformat/network: add logging context to log
Steven Liu [Mon, 30 Sep 2019 06:41:06 +0000 (14:41 +0800)]
avformat/network: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavformat/avidec: add logging context to log
Steven Liu [Wed, 2 Oct 2019 06:44:47 +0000 (14:44 +0800)]
avformat/avidec: add logging context to log

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavformat/rtmpptoto: add logging context to log
Steven Liu [Mon, 30 Sep 2019 06:36:52 +0000 (14:36 +0800)]
avformat/rtmpptoto: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavformat/udp: add logging context to log
Steven Liu [Mon, 30 Sep 2019 06:34:17 +0000 (14:34 +0800)]
avformat/udp: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavformat/hlsenc: add logging context to log
Steven Liu [Mon, 30 Sep 2019 06:31:36 +0000 (14:31 +0800)]
avformat/hlsenc: add logging context to log

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoChange libvpxenc default to crf=32.
elliottk [Tue, 24 Sep 2019 23:24:13 +0000 (16:24 -0700)]
Change libvpxenc default to crf=32.

Current default is 200kbps, which produces inconsistent
results (too high for low-res, too low for hi-res). Use
CRF instead, which will adapt. Affects VP9. Also have
VP8 use a default bitrate of 256kbps.

Signed-off-by: James Zern <jzern@google.com>
13 months agolavfi/normalize: remove the unused pointer
Zhong Li [Sun, 29 Sep 2019 08:05:51 +0000 (16:05 +0800)]
lavfi/normalize: remove the unused pointer

Signed-off-by: Zhong Li <zhong.li@intel.com>
13 months agolavc/qsv: fix a memory leak in ff_qsv_set_display_handle()
Zhong Li [Sun, 29 Sep 2019 08:01:06 +0000 (16:01 +0800)]
lavc/qsv: fix a memory leak in ff_qsv_set_display_handle()

Reported-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Zhong Li <zhong.li@intel.com>
13 months agoavcodec/flac_parser: Cosmetics
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:20 +0000 (07:01 +0200)]
avcodec/flac_parser: Cosmetics

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
13 months agoavcodec/flac_parser: Don't leave stale pointer in memory
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:19 +0000 (07:01 +0200)]
avcodec/flac_parser: Don't leave stale pointer in memory

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
13 months agoavcodec/flac_parser: Don't modify size of the input buffer
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:18 +0000 (07:01 +0200)]
avcodec/flac_parser: Don't modify size of the input buffer

When flushing, MAX_FRAME_HEADER_SIZE bytes (always zero) are supposed to
be written to the fifo buffer in order to be able to check the rest of
the buffer for frame headers. It was intended to write these by writing
a small buffer of size MAX_FRAME_HEADER_SIZE to the buffer. But the way
it was actually done ensured that this did not happen:

First, it would be checked whether the size of the input buffer was zero,
in which case it buf_size would be set to MAX_FRAME_HEADER_SIZE and
read_end would be set to indicate that MAX_FRAME_HEADER_SIZE bytes need
to be written. Then it would be made sure that there is enough space in
the fifo for the data to be written. Afterwards the data is written. The
check used here is for whether buf_size is zero or not. But if it was
zero initially, it is MAX_FRAME_HEADER_SIZE now, so that not the
designated buffer for writing MAX_FRAME_HEADER_SIZE is written; instead
the padded buffer (from the stack of av_parser_parse2()) is used. This
works because AV_INPUT_BUFFER_PADDING_SIZE >= MAX_FRAME_HEADER_SIZE.
Lateron, buf_size is set to zero again.

Given that since 7edbd536, the actual amount of data read is no longer
automatically equal to buf_size, it is completely unnecessary to modify
buf_size at all. Moreover, modifying it is dangerous: Some allocations
can fail and because buf_size is never reset to zero in this codepath,
the parser might return a value > 0 on flushing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
13 months agoavcodec/flac_parser: Remove superfluous checks
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:17 +0000 (07:01 +0200)]
avcodec/flac_parser: Remove superfluous checks

For a parser, the input buffer is always != NULL: In case of flushing,
the indicated size of the input buffer will be zero and the input buffer
will point to a zeroed buffer of size 0 + AV_INPUT_BUFFER_PADDING.
Therefore one does not need to check for whether said buffer is NULL or
not.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
13 months agoavcodec/flac_parser: Fix number of buffered headers
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:16 +0000 (07:01 +0200)]
avcodec/flac_parser: Fix number of buffered headers

Only decrement the number of buffered headers if a header has actually
been freed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
13 months agoavcodec/flac_parser: Fix off-by-one error
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:15 +0000 (07:01 +0200)]
avcodec/flac_parser: Fix off-by-one error

The flac parser uses a fifo to buffer its data. Consequently, when
searching for sync codes of flac packets, one needs to take care of
the possibility of wraparound. This is done by using an optimized start
code search that works on each of the continuous buffers separately and
by explicitly checking whether the last pre-wrap byte and the first
post-wrap byte constitute a valid sync code.

Moreover, the last MAX_FRAME_HEADER_SIZE - 1 bytes ought not to be searched
for (the start of) a sync code because a header that might be found in this
region might not be completely available. These bytes ought to be searched
lateron when more data is available or when flushing.

Unfortunately there was an off-by-one error in the calculation of the
length to search of the post-wrap buffer: It was too large, because the
calculation was based on the amount of bytes available in the fifo from
the last pre-wrap byte onwards. This meant that a header might be
parsed twice (once prematurely and once regularly when more data is
available); it could also mean that an invalid header will be treated as
valid (namely if the length of said invalid header is
MAX_FRAME_HEADER_SIZE and the invalid byte that will be treated as the
last byte of this potential header happens to be the right CRC-8).

Should a header be parsed twice, the second instance will be the best child
of the first instance; the first instance's score will be
FLAC_HEADER_BASE_SCORE - FLAC_HEADER_CHANGED_PENALTY ( = 3) higher than
the second instance's score. So the frame belonging to the first
instance will be output and it will be done as a zero length frame (the
difference of the header's offset and the child's offset). This has
serious consequences when flushing, as returning a zero length buffer
signals to the caller that no more data will be output; consequently the
last frames not yet output will be dropped.

Furthermore, a "sample/frame number mismatch in adjacent frames" warning
got output when returning the zero-length frame belonging to the first
header, because the child's sample/frame number of course didn't match
the expected sample frame/number given its parent.

filter/hdcd-mix.flac from the FATE-suite was affected by this (the last
frame was omitted) which is the reason why several FATE-tests needed to
be updated.

Fixes ticket #5937.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
13 months agoavcodec/flac_parser: Don't allocate array separately
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:14 +0000 (07:01 +0200)]
avcodec/flac_parser: Don't allocate array separately

The FLACHeaderMarker structure contained a pointer to an array of int;
said array was always allocated and freed at the same time as its
referencing FLACHeaderMarker; the pointer was never modified to point to
a different array and each FLACHeaderMarker had its own unique array.
Furthermore, all these arrays had a constant size. Therefore include
this array in the FLACHeaderMarker struct.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
13 months agoavcodec/flac_parser: Use native endianness when possible
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:13 +0000 (07:01 +0200)]
avcodec/flac_parser: Use native endianness when possible

FLAC sync codes contain a byte equal to 0xFF and so the function that
searches for sync codes first searched for this byte. It did this by
checking four bytes at once; these bytes have been read via AV_RB32, but
the test works just as well with native endianness.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
13 months agoavformat/flac_picture: Avoid allocation of AVIOContext
Andreas Rheinhardt [Sun, 6 Oct 2019 05:01:12 +0000 (07:01 +0200)]
avformat/flac_picture: Avoid allocation of AVIOContext

Put an AVIOContext whose lifetime doesn't extend beyond the function
where it is allocated on the stack instead of allocating and freeing it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
13 months agodoc/formats: Update documentation for chromaprint
Andriy Gelman [Sun, 6 Oct 2019 05:49:47 +0000 (01:49 -0400)]
doc/formats: Update documentation for chromaprint

Silence detection can only be set with algorithm version 3.

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
13 months agoavcodec/filter: Remove extra '; ' outside of functions
Andreas Rheinhardt [Mon, 7 Oct 2019 00:10:30 +0000 (02:10 +0200)]
avcodec/filter: Remove extra '; ' outside of functions

They are not allowed outside of functions. Fixes the warning
"ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]"
when compiling with GCC and -pedantic.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
13 months agoavfilter/af_adelay: add option which changes how unset channels are delayed
Paul B Mahol [Mon, 7 Oct 2019 16:02:50 +0000 (18:02 +0200)]
avfilter/af_adelay: add option which changes how unset channels are delayed

Fixes #8032.

13 months agoavfilter/formats: guard against double free
Paul B Mahol [Mon, 7 Oct 2019 15:26:59 +0000 (17:26 +0200)]
avfilter/formats: guard against double free

13 months agoavfilter/vf_normalize: typedef all structs
Paul B Mahol [Mon, 7 Oct 2019 10:17:14 +0000 (12:17 +0200)]
avfilter/vf_normalize: typedef all structs

13 months agoavfilter/vf_showpalette: remove timeline flag
Paul B Mahol [Mon, 7 Oct 2019 10:07:00 +0000 (12:07 +0200)]
avfilter/vf_showpalette: remove timeline flag

This filter changes output size and thus can not have support
for timeline.

13 months agoavfilter/af_afftfilt: fix possible invalid memory access
Paul B Mahol [Mon, 7 Oct 2019 09:37:05 +0000 (11:37 +0200)]
avfilter/af_afftfilt: fix possible invalid memory access

13 months agoavfilter/vf_nnedi: fix possible double free
Paul B Mahol [Mon, 7 Oct 2019 09:10:45 +0000 (11:10 +0200)]
avfilter/vf_nnedi: fix possible double free

13 months agodoc/filters: fix few more typos
Paul B Mahol [Sun, 6 Oct 2019 18:31:43 +0000 (20:31 +0200)]
doc/filters: fix few more typos

13 months agoavformat/subtitles: Check nb_subs in ff_subtitles_queue_finalize()
Michael Niedermayer [Fri, 4 Oct 2019 15:10:38 +0000 (17:10 +0200)]
avformat/subtitles: Check nb_subs in ff_subtitles_queue_finalize()

Fixes: null pointer dereference
Fixes: 17828/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5645915116797952
Fixes: Ticket8147

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>