1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-12 19:18:44 +02:00
Commit Graph

94303 Commits

Author SHA1 Message Date
Steven Liu
ac22835db9 fate: add hls fmp4 segment type test case
Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-07-15 21:57:43 +08:00
Steven Liu
234a5e058d avformat/hlsenc: use old way for fragment mp4 in HLS PUT method
fix ticket: 8015

Reported-by: Jun Zhao
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-07-15 21:56:04 +08:00
Jun Zhao
af5f770113 doc/codecs: Add missing documentation for nointra
Add missing documentation for nointra.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-07-15 09:21:33 +08:00
Michael Niedermayer
39a6a79bcb avformat/xmv: Make bitrate 64bit
Fixes: signed integer overflow: 32 * 538976288 cannot be represented in type 'int'
Fixes: 15633/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5752273981931520

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-07-14 22:17:43 +02:00
Michael Niedermayer
62d10ec35c avformat/vividas: Fixes overflow in shift in recover_key()
Fixes: left shift of 133 by 24 places cannot be represented in type 'int'
Fixes: 15365/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5716153105645568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Suggested-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Reviewed-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-07-14 22:17:43 +02:00
Michael Niedermayer
84669b1872 avcodec/iff: Add "else" to make code look prettier
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-07-14 22:17:43 +02:00
Andreas Rheinhardt
3469cfab4a dump_extra: Don't add extradata if it already exists
The dump_extra bitstream filter currently simply adds the extradata to
the packets indicated by the user without checking whether said
extradata already exists in the packets. Besides wasting space
duplicated extradata in the same packet/access unit is also forbidden
for some codecs, e.g. MPEG-2.

This check has been added to be able to use the mpeg2_qsv encoder (which
only adds the sequence headers to the first packet) in broadcast
scenarios where repeating sequence headers are required.

The check used here is not perfect: E.g. dump_extra would add the
extradata to a H.264 access unit consisting of an access unit delimiter,
SPS, PPS and slices.

Fixes #8007.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-07-14 22:17:43 +02:00
Paul B Mahol
97698b15a2 avfilter/vf_hysteresis: use time_base from framesync
Fixes non-monotonous timestamps.
2019-07-14 19:14:10 +02:00
Paul B Mahol
166977a200 doc/filters: document new remap filter option 2019-07-14 18:29:23 +02:00
Paul B Mahol
54fc8d370e avfilter/vf_remap: add option to control output format 2019-07-14 18:20:18 +02:00
Paul B Mahol
be822eb6f8 avfilter/vf_remap: use time_base from framesync
Fixes non-monotonous timestamps.
2019-07-14 18:20:18 +02:00
Paul B Mahol
077bf9058f avfilter/vf_displace: use time_base from framesync
Fixes non-monotonous timestamps.
2019-07-14 18:20:18 +02:00
Steve Lhomme
8788dd67b8 avcodec/h264_slice: set the SEI parameters early on the AVCodecContext
It's better to do it before the buffers are actually created. At least in VLC
we currently don't support changing some parameters dynamically easily so we
don't use the information if it comes after the buffer are created.

Co-authored-by: James Almer <jamrial@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-07-14 13:04:46 -03:00
Steve Lhomme
f2ad6238e4 avcodec/hevcdec: set the SEI parameters early on the AVCodecContext
It's better to do it before the buffers are actually created. At least in VLC
we currently don't support changing some parameters dynamically easily so we
don't use the information if it comes after the buffer are created.

Co-authored-by: James Almer <jamrial@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-07-14 13:04:46 -03:00
Paul B Mahol
6882427841 avfilter/vf_midequalizer: always use framesync timestamps 2019-07-14 17:45:42 +02:00
Paul B Mahol
74236f675e avfilter/vf_maskedmerge: always use framesync timestamps 2019-07-14 17:38:26 +02:00
Paul B Mahol
3d78ad43f7 avfilter/vf_threshold: use time_base from framesync
Fixes non-monotonous timestamps.
2019-07-14 17:28:04 +02:00
Paul B Mahol
37e69b40df avfilter/vf_blend: add 9bit support 2019-07-14 17:00:58 +02:00
Jernej Fijacko
f86f213a6d avcodec/dvbsub: add support for Display Definition Segment to DVB Subtitle encoder
Current version of dvbsub encoder doesn't support HD DVB subtitles. The high
resolution bitmaps are muxed into the stream but without the DDS (display definition
segment) the players asume that the DVB subtitles are in SD (720x576) resolution
which causes them to either render the subtitles too large and misplaced or don't
render them at all. By including the DDS as defined in section 7.7.1 of ETSI EN 300
743 (V1.3.1) this problem is fixed.

7.2.1 Display definition segment The display definition for a subtitle service may
be defined by the display definition segment if present in the stream. Absence of a
DDS implies that the stream is coded in accordance with EN 300 743 (V1.2.1) [5] and
that a display width of 720 pixels and a display height of 576 lines may be assumed.

https://www.etsi.org/deliver/etsi_en/300700_300799/300743/01.03.01_60/en_300743v010301p.pdf

Signed-off-by: Jernej Fijacko <mikrohard@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-07-13 19:34:15 +02:00
Andreas Rheinhardt
a2572e3c67 avformat: Don't suggest deprecated function
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-07-13 14:07:59 -03:00
Paul B Mahol
80dacbedba avfilter/af_aiir: calculate group delay too 2019-07-13 15:45:06 +02:00
Michael Niedermayer
18c808ffbe avcodec/pngdec: Check that previous_picture has same w/h/format
Fixes: out of array access
Fixes: 15540/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-5684905029140480

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-07-13 14:42:57 +02:00
Michael Niedermayer
9ffa32b81b avcodec/huffyuvdec: Check vertical subsampling in hymt
Fixes: out of array access
Fixes: 15484/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5765377054736384
Fixes: 15559/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5710295743332352

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-07-13 14:42:57 +02:00
Michael Niedermayer
6aaa01afe4 avcodec/huffyuv: remove gray8a (the format is listed but not supported by the implementation)
Fixes: null pointer dereference
Fixes: 15464/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5681391150301184

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-07-13 14:42:57 +02:00
Michael Niedermayer
9b5249a441 tools/target_dec_fuzzer: Remove redundant av_free()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-07-13 14:42:57 +02:00
Michael Niedermayer
1dbb67d39b avcodec/mpc8: Fixes invalid shift in mpc8_decode_frame()
Fixes: left shift of negative value -456
Fixes: 15561/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPC8_fuzzer-5758130404720640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Suggested-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-07-13 14:42:57 +02:00
Paul B Mahol
60e6db2f5b avfilter/af_aiir: do not ignore k option for audio filtering
Previously it was used only for displaying frequency response.
2019-07-13 12:29:52 +02:00
Marton Balint
81d3d7dd44 avformat/mpegts: respect program number when merging streams
merge_pmt_versions was not usable if multiple programs were present because
when it was searching for candidate streams it did not make sure that the PMT was
of the same program. This caused the streams of all programs to get merged into
a single (garbled) program.

This patch makes sure that the program number (service ID) is also matching
with the old streams when parsing the PMT making the feature useful for multi
program streams.

This change might cause issues for single program streams if the program number
changes, but I think it is acceptable because the goal of the option is to make
the parsing resilient to PID changes, and that is still working as expected.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-07-12 20:32:22 +02:00
Marton Balint
397abca001 avformat/movenc: use unspecified language by default
English was used before.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-07-12 20:26:38 +02:00
Andreas Rheinhardt
24a64e0462 lavf/webm_chunk: Correct duration if start time > 0
Up until now, it was simply presumed that the first packet had a pts of
zero; otherwise the duration of the first chunk was wrong.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-07-12 14:59:58 +02:00
Andreas Rheinhardt
8c6ee7626b lavf/webm_chunk: Fix NULL dereference
The earlier version of the webm_chunk muxer had several bugs:

1. If the first packet of an audio stream didn't have a PTS of zero,
then no chunk will be started before a packet is delivered to the
underlying Matroska/WebM muxer, i.e. the AVFormatContext used to write
these packets had a NULL as AVIOContext for output. This is behind the
crash in ticket #5752.

2. If an error happens during writing a packet, the underlyimg
Matroska/WebM muxer context is freed. This leads to a use-after-free
coupled with a double-free in webm_chunk_write_trailer (which supposes
that the underlying AVFormatContext is still valid).

3. Even when no error occurs at all, webm_chunk_write_trailer is still
buggy: After the underlying Matroska/WebM muxer has written its trailer,
ending the chunk implicitly flushes it again which is illegal at this
point.

These bugs have been fixed.

Fixes #5752.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-07-12 14:56:27 +02:00
Paul B Mahol
2601eef850 avcodec/magicyuv: add support for recently added YUV444P10 2019-07-11 16:53:09 +02:00
Steven Liu
af9dc02e6b fate: add hls_list_size fate test case
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-07-11 09:39:44 +08:00
Steven Liu
33a8cd5925 avformat/hlsenc: use one handler for m3u8 and segments
Use one handler for m3u8 and segments.
Use two handler in byterange mode.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-07-11 09:38:39 +08:00
Steven Liu
89ea0c9bfd fate: add hls_init_time option fate
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-07-11 09:37:29 +08:00
Steven Liu
1b1b974aac avformat/http: change error message from numeric code to string
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-07-11 09:35:31 +08:00
Steven Liu
1498e39439 avutil/hwcontext_vaapi: move kernel_driver into CONFIG_LIBDRM
Reviewed-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Steven Liu <lq@onvideo.cn>
2019-07-11 09:34:57 +08:00
Steven Liu
092bd1e54f avcodec/videotoolboxenc: remove unused variable
Signed-off-by: Steven Liu <lq@onvideo.cn>
2019-07-11 09:34:34 +08:00
Paul B Mahol
74d4fd0822 avfilter/avf_showfreqs: make selecting window size simpler
The previous solution was very bad.
2019-07-10 16:03:34 +02:00
Paul B Mahol
57a2688fe3 avfilter/af_afftfilt: make selecting window size simpler
Next step after this one will be adding support for more window sizes.
2019-07-10 15:57:38 +02:00
James Zern
b1febda061 avcodec/utils, avcodec_open2: close codec on failure
after a successful init if the function fails for another reason close
the codec without requiring FF_CODEC_CAP_INIT_CLEANUP which is meant to
cover init failures themselves. fixes a memory leak in those cases.

BUG=oss-fuzz:15529

Signed-off-by: James Zern <jzern@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-07-10 12:54:57 +02:00
Cameron Cawley
94d45a13c7 avformat/rpl: Replace strcpy with av_strlcpy
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-07-10 12:54:57 +02:00
YunQiang Su
925e33b253 avcodec/mips/cabac: replace addi with addiu
addi/daddi are deprecated by MIPS for years, and MIPS r6 remove
them.

They should be replace with addiu:
   ADDIU performs the same arithmetic operation but
   does not trap on overflow.

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-07-10 12:54:57 +02:00
Shiyou Yin
a45e8ade2d avutil/mips: optimize UNPCK&SAD macros with MSA2.0 instruction.
Loongson 3A4000 and 2k1000 has supported MSA2.0.
This patch optimized SAD_UB2_UH,UNPCK_R_SH_SW,UNPCK_SB_SH and UNPCK_SH_SW with MSA2.0 instruction.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-07-10 12:54:57 +02:00
Steven Liu
24f7a8a168 avformat/dashdec: fix code style and remove some empty line 2019-07-10 17:26:33 +08:00
Andreas Rheinhardt
5a481b15bd truehd_core: Switch to in-place modifications
The truehd_core bitstream filter decreases the sizes of the
major_sync_info structure (if present), of the
substream_directory and of the substreams themselves. As a consequence,
there is enough space available in front of the actual substream data
for the new header, so that one only needs to modify the header in front
of the actual data (which apart from shrinking is left untouched) and
the packet's size and buffer pointer (after having made sure that the
packet is writable).

This and switching to bsf_get_packet_ref also removed the need for
having separate packets for in- and output.

Even if the input is not writable, there are noticable performance
improvements: The average of 10 iterations of processing a file with 262144
runs each (inlcuding about 20 skips per iteration) went down from 5669
to 4362 decicycles. If the input is writable, it goes down to 1363
decicycles.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-07-09 13:23:47 +02:00
Andreas Rheinhardt
836065b27a truehd_core: Use byte offsets instead of bit offsets
Words of 16 bit are the unit for TrueHD's size and offset fields;
in particular the sizes of the high-level structures of TrueHD are
always a multiple of a byte; yet truehd_core unnecessarily used
bit offsets at several places. This has been changed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-07-09 13:23:42 +02:00
Andreas Rheinhardt
2275e70569 truehd_core: Miscellaneous improvements
1. The loop counter of the substream_directory loop is always less than
the number of substreams, yet within the loop it is checked whether it
is less than FFMIN(3, s->hdr.num_substreams), although the check for < 3
would suffice.
2. In case the packet is a major sync packet, the last two bytes of the
major sync structure were initialized to 0xff and then immediately
overwritten afterwards without ever making use of the values just set.
3. When updating the parity_nibble during writing the new
substream_directory, the parity_nibble is updated one byte at a time
with bytes that might be read from the output packet's data. But one can
do both bytes at the same time without resorting to the data just
written by XOR'ing with the variable that contains the value that has
just been written as a big endian number. This changes the intermediate
value of parity_nibble, but in the end it just amounts to a reordering
of the sum modulo two that will eventually be written as parity_nibble.
Due to associativity and commutativity, this value is unchanged.
4. init_get_bits8 already checks that no overflow happens during the
conversion of its argument from bytes to bits. ff_mlp_read_major_sync
makes sure not to overread (the maximum size of a major_sync_info is 60
bytes anyway) and last_offset is < 2^13, so that no overflow in the
calculation of size can happen, i.e. the check for whether size is >= 0
is unnecessary. But then size is completely unnecessary and can be
removed.
5. In case the packet is just passed through, it is unnecessary to read
the packet's dts. This is therefore postponed to when we know that the
packet is not passed through.
6. Given that it seems overkill to use a bitreader just for one
variable, the size of the input access unit is now read directly.
7. A substream's offset (of the end of the substream) is now stored as is
(i.e. in units of words).

These changes amount to a slight performance improvement: It improved
from 5897 decicycles of ten runs with about 262144 runs each (including
an insignificant amount -- about 20-25 usually of skips) to 5747
decicycles under the same conditions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-07-09 13:23:15 +02:00
Andreas Rheinhardt
610460a397 truehd_core: Return error in case of error
Several checks (e.g. when the size of the input packet is too small)
simply used "goto fail", but didn't set the return value appropriately
for an error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-07-09 13:23:10 +02:00
Andreas Rheinhardt
cbe23e40ae truehd_core: Correct output size
If truehd_core strips Atmos data away, three parts of the output differ
in size compared to the input access unit: a) The major_sync_info block
if the extra_channel_meaning_data is present, as the newly written
output never contains said block; b) the substream_directory (because
entries relating to discarded substreams are discarded, too); and c)
the actual substream data. b) and c) have already been taken into account
when choosing the size of the output packet, but a) has been forgotten.

This is also the reason behind the end of the output buffer having been
uninitialized until 801d78f0. The workaround added in said commit has
been removed, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-07-09 13:23:06 +02:00