Commit Graph

90255 Commits

Author SHA1 Message Date
Mark Thompson ce5870a3a8 cbs: Refcount all the things!
This makes it easier for users of the CBS API to get alloc/free right -
all subelements use the buffer API so that it's clear how to free them.
It also allows eliding some redundant copies: the packet -> fragment copy
disappears after this change if the input packet is refcounted, and more
codec-specific cases are now possible (but not included in this patch).
2018-02-20 22:04:12 +00:00
Mark Thompson 13ca5d34ba cbs_h264: Add hack for pic_timing with no active SPS
If there is exactly one possible SPS but it is not yet active then just
assume that it should be the active one.
2018-02-20 22:04:12 +00:00
Mark Thompson 0e4c166cdd cbs_h2645: Remove active ps references when it is replaced 2018-02-20 22:04:12 +00:00
Mark Thompson a3daecd637 cbs: Demote the "decomposition unimplemented" warning
This is harmless and should not be a warning - unknown units are passed
through to the write functions unchanged, and no other code will interact
with them.
2018-02-20 22:04:12 +00:00
Mark Thompson 67eb2b16da vaapi_h265: Mark unused entries in RefPicList[01] as explicitly invalid
The iHD driver looks at entries beyond num_ref_idx_l[01]_active_minus1
for unknown reasons.
2018-02-20 22:04:12 +00:00
Mark Thompson 216c44dfc1 vaapi_encode: Destroy output buffer pool before VA context
The buffers are created associated with the context, so they should be
destroyed before the context is.  This is enforced by the iHD driver.
2018-02-20 22:04:12 +00:00
Jun Zhao c8e135ea92 vaapi_encode: Allocate slice structures and parameter buffers dynamically
This removes the arbitrary limit on the allowed number of slices and
parameter buffers.

From ffmpeg commit e4a6eb70f4.

Signed-off-by: Mark Thompson <sw@jkqxz.net>
2018-02-20 22:04:12 +00:00
Mark Thompson 254e728d20 cbs: Minor comment fixes / cosmetics 2018-02-20 22:04:12 +00:00
Mark Thompson 1d12a545ce cbs: Add an explicit type for coded bitstream unit types
Also fix conversion specifiers used for the unit type.
2018-02-20 22:04:12 +00:00
Mark Thompson 2651352988 cbs: Allocate the context inside the init function
... instead of making callers allocate it themselves.  This is more
consistent with other APIs in libav.
2018-02-20 22:04:12 +00:00
Vishwanath Dixit a877d22d9a avformat/movenc: addition of flag to fragment at every frame
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-20 15:27:51 +01:00
Michael Niedermayer 47e65ad63b avcodec/diracdec: Fix integer overflow in mv computation
Fixes: signed integer overflow: -2072 + -2147483646 cannot be represented in type 'int'
Fixes: 6097/clusterfuzz-testcase-minimized-5034145253163008

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-20 15:27:51 +01:00
Michael Niedermayer 85c85fffff avcodec/h264_parse: Clear invalid chroma weights in ff_h264_pred_weight_table()
Fixes: 6037/clusterfuzz-testcase-minimized-5030249784934400
Fixes: signed integer overflow: 256 * 16992036 cannot be represented in type 'int'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-20 15:27:51 +01:00
Michael Niedermayer 33fe17bdc8 avcodec/aacdec_templat: Fix integer overflow in apply_ltp()
Fixes: signed integer overflow: -1625276744 + -1041893960 cannot be represented in type 'int'
Fixes: 5948/clusterfuzz-testcase-minimized-5791479856365568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-20 15:27:51 +01:00
Michael Niedermayer 793347a545 avcodec/jpeg2000dwt: Fix integer overflows in sr_1d53()
Fixes: 5918/clusterfuzz-testcase-minimized-5120505435652096

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-20 15:27:51 +01:00
Michael Niedermayer cbcbefdc3b avcodec/diracdec: Use int64 in global mv to prevent overflow
Fixes: runtime error: signed integer overflow: 361 * -6295541 cannot be represented in type 'int'
Fixes: 5911/clusterfuzz-testcase-minimized-6450382197751808

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-20 15:27:51 +01:00
Michael Niedermayer 3748746a4d avcodec/dxtory: Remove code that corrupts dimensions
Fixes: Timeout
Fixes: 5796/clusterfuzz-testcase-minimized-5206729085157376

Does someone have a valid sample that triggers this path ?

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-20 15:27:51 +01:00
James Almer f4f39582e7 avformat/matroskadec: fix return value
err is already an AVERROR.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-20 10:26:21 -03:00
James Almer 88eb368f42 avformat/matroskadec: free the packet on webvtt side data allocation failure
Fixes potential memory leaks

Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-20 10:25:54 -03:00
James Almer acdea9e7c5 avformat/matroskadec: ignore CodecPrivate if the stream is VP9
Defined in a recent revision of https://www.webmproject.org/docs/container/

This prevents storing the contents of CodecPrivate into extradata for
a codec that doesn't need nor expect any. It will among other things
prevent matroska specific binary data from being dumped onto other
formats during remuxing.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-19 22:13:13 -03:00
Gyan Doshi b50f68bb1e docs/codecs: remove dead codec debug options
FF_API_DEBUG_MV has been disabled. Related options removed from docs.

Mention of non-existent debug option value 'pts' also removed.
2018-02-19 14:49:58 -09:00
James Almer 04a8d5c2d7 Merge commit 'cc1c94dacd0642ac1a6cad45deb65071f127d91a'
* commit 'cc1c94dacd0642ac1a6cad45deb65071f127d91a':
  configure: Pass the right machine types to dlltool for arm and arm64 mingw

Merged-by: James Almer <jamrial@gmail.com>
2018-02-19 18:35:32 -03:00
James Almer 6dea6c4b97 Merge commit '97eee953e639bd4d17a9f9398293775277d00505'
* commit '97eee953e639bd4d17a9f9398293775277d00505':
  Revert "configure: Stop using dlltool to create an import library"

This commit is a noop, see 6d8bef8c05

Merged-by: James Almer <jamrial@gmail.com>
2018-02-19 18:34:36 -03:00
Hendrik Leppkes 6d8bef8c05 build: restore using dlltool/lib.exe for creating Win32 .lib files
The GCC generated import libraries don't work properly when being imported
by MSVC, resulting in missing symbols at runtime.

This reverts 5b5365fe9 and partially reverts changes from 98a9b1f0d
2018-02-19 22:26:34 +01:00
Aman Gupta f611fef37c avcodec/mediacodecdec: refactor to take advantage of new decoding api
This refactor splits up the main mediacodec decode loop into two
send/receive helpers, which are then used to rewrite the receive_frame
callback and take full advantage of the new decoding api. Since we
can now request packets on demand with ff_decode_get_packet(), the
fifo buffer is no longer necessary and has been removed.

This change was motivated by behavior observed on certain Android TV
devices, featuring hardware mpeg2/h264 decoders which also deinterlace
content (to produce multiple frames per field). Previously, this code
caused buffering issues because queueInputBuffer() was always invoked
before each dequeueOutputBuffer(), even though twice as many output
buffers were being generated.

With this patch, the decoder will always attempt to drain new frames
first before sending more data into the underlying codec.

Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2018-02-19 15:27:34 +01:00
Martin Storsjö cc1c94dacd configure: Pass the right machine types to dlltool for arm and arm64 mingw
These are supported by llvm-dlltool.

Signed-off-by: Martin Storsjö <martin@martin.st>
2018-02-19 12:36:41 +02:00
Martin Storsjö 97eee953e6 Revert "configure: Stop using dlltool to create an import library"
This reverts commit 67c72f08a4.

While the linker produced import libraries might work with MSVC in
simple test cases, they don't if e.g. linking to multiple GNU ld
produced import libraries at the same time. (They end up importing
functions from the wrong libraries.) The ones produced by dlltool
work fine though.

This issue was pointed out by Hendrik Leppkes.

Signed-off-by: Martin Storsjö <martin@martin.st>
2018-02-19 12:36:09 +02:00
Tobias Rapp 56f77b0f67 fate: add tests for pan audio filter
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2018-02-19 08:32:44 +01:00
Tobias Rapp 6325bd3717 swresample/rematrix: fix update of channel matrix if input or output layout is undefined
Prefer direct in/out channel count values over channel layout, when
available. Fixes a pan filter bug (ticket #6790).

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2018-02-19 08:32:25 +01:00
Michael Niedermayer 647fa49495 avcodec/dirac_dwt_template: Fix Integer overflow in horizontal_compose_dd137i()
Fixes: 5894/clusterfuzz-testcase-minimized-5315325420634112
Fixes: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-18 23:27:03 +01:00
Michael Niedermayer f82dd4c09b avcodec/hevcdec: Check luma/chroma_log2_weight_denom
Fixes: signed integer overflow: 3 + 2147483647 cannot be represented in type 'int'
Fixes: 5888/clusterfuzz-testcase-minimized-5634701067812864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-18 23:27:02 +01:00
Calvin Walton d2fc244293 libavfilter/vf_fps: Add more fate tests
These tests cover specific rounding behaviour, to ensure that I don't
introduce any regressions with the rewritten "activate" callback based
fps filter.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-17 20:31:39 +01:00
Michael Niedermayer 1be49cee34 avcodec/h264: Increase field_poc to 64bit in ff_h264_init_poc() to detect overflows
Fixes: Integer overflow
Fixes: 5746/clusterfuzz-testcase-minimized-6270097623613440

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-17 20:31:39 +01:00
Michael Niedermayer 01370b31ac avcodec/jpeg2000dec: Use av_image_check_size2()
Fixes: OOM
Fixes: 5733/clusterfuzz-testcase-minimized-4906757966004224

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-17 20:31:39 +01:00
Michael Niedermayer de675648ce avcodec/vp8: Check for bitstream end before vp7_fade_frame()
Fixes: Timeout
Fixes: 5653/clusterfuzz-testcase-5497680018014208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-17 20:31:39 +01:00
Michael Niedermayer dd8351b118 avcodec/exr: Check remaining bits in last get code loop
Fixes: runtime error: shift exponent -7 is negative
Fixes: 3902/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6081926122176512

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-17 15:56:59 +01:00
Michael Niedermayer ab6f571ef7 avutil/common: Fix integer overflow in av_clip_uint8_c() and av_clip_uint16_c()
Fixes: 5567/clusterfuzz-testcase-minimized-5769966247739392
Fixes: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-17 15:56:55 +01:00
Gyan Doshi 310d56e86f fate/mpegps: add tests for PCM_DVD stream remux
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-16 21:53:22 +01:00
Gyan Doshi f0809bc0fa avformat/mpegenc - accept PCM_DVD streams
PCM_S16BE stream packets in MPEG-PS have a 3-byte header and
are recognized as PCM_DVD by the demuxer which prevents their
correct remuxing in MPEG-1/2 PS.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-16 21:53:22 +01:00
James Almer 8a8d0b319a avutil/crypto: change length parameter to size_t on the remaining modules
See 651ee93461
fcc4ed1efa

Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-15 11:21:28 -03:00
Michael Niedermayer 75027066d8 avdevice/decklink_dec: Fix ;;
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-15 13:48:52 +01:00
Michael Niedermayer 173939259a avfilter/avf_avectorscope: Fix ;;
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-15 13:48:25 +01:00
Michael Niedermayer f26a63c4ee avcodec/h264_cabac: Tighten allowed coeff_abs range
Fixes: integer overflows
Reported-by: "Xiaohan Wang (王消寒)" <xhwang@chromium.org>

Based on limits in "8.5 Transform coefficient decoding process and picture
construction process prior to deblocking  filter process"

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-15 04:36:00 +01:00
Jérôme Martinez fb580731c1 avcodec/ffv1: Support for GBRAP10 and GBRAP12
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-15 04:35:23 +01:00
James Almer aa6280805e avformat/aviobuf: zero initialize the AVIOContext in ffio_init_context()
This makes sure no field is ever used uninitialized.

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-14 20:56:51 -03:00
James Almer 23e1bf6e51 avcodec: remove unnecessary calls to ff_init_buffer_info()
And remove the function altogether while at it. It's a duplicate of
another.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-14 20:54:20 -03:00
Yusuke Nakamura 3b4026e151 avpacket: reset dst side_data fields in av_packet_copy_props
This effectively copies the side data elements from src instead of
potentially merging them with those already existing in dst.
This by extension also removes the only dependency on existing values
in the dst packet.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-14 20:36:29 -03:00
Niklas Haas 7c82e0f61e avfilter/af_loudnorm: correctly initialize PTS
Right now, the PTS always starts out as 0, which causes problems on a
seek or when inserting this filter mid-stream.

Initialize it instead to AV_NOPTS_VALUE and copy the PTS from the first
frame instead if this is the case.
2018-02-14 18:10:53 +01:00
Carl Eugen Hoyos dc77e64f2d lavf/rtpdec*: Constify all RTPDynamicProtocolHandler.
Reviewed-by: Muhammad Faiz
2018-02-14 01:14:35 +01:00
Xiaohan Wang 71f39de2a5 avcodec/h264_cavlc: Set valid qscale value in ff_h264_decode_mb_cavlc()
When ff_h264_decode_mb_cavlc() failed due to wrong sl->qscale values,
e.g. dquant out of range, set the qscale to be a valid value before
returning -1 and exiting the function. The qscale value can be used
later e.g. in loop filter.

BUG=806122

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-14 01:06:37 +01:00