ffmpeg.git
15 months agocbs_h264: Fix overflow in shifts
Mark Thompson [Sun, 11 Mar 2018 14:40:23 +0000 (14:40 +0000)]
cbs_h264: Fix overflow in shifts

The type of the result of a shift operation is unaffected by the type of
the right operand, so some existing code overflows with undefined behaviour
when the element length is 32.  Add a helper macro to calculate the maximum
value correctly and then use it everywhere this pattern appears.

Found-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
15 months agolavd: fix iterating of input and output devices
Felix Matouschek [Wed, 14 Mar 2018 12:14:07 +0000 (13:14 +0100)]
lavd: fix iterating of input and output devices

In the previous implementation the first input or output device
was skipped when device_next was called with prev = NULL

Signed-off-by: Felix Matouschek <felix@matouschek.org>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
15 months agoavfilter/vf_premultiply : fix unpremultiply_offset for rgb input
Martin Vignali [Sat, 17 Mar 2018 21:20:34 +0000 (22:20 +0100)]
avfilter/vf_premultiply : fix unpremultiply_offset for rgb input

15 months agofate/hapqa_extract : add test for hapqa_extract bsf
Martin Vignali [Sat, 17 Mar 2018 20:07:17 +0000 (21:07 +0100)]
fate/hapqa_extract : add test for hapqa_extract bsf

test extract color and alpha
with the three main kind of hap frame :
- no snappy compression
- snappy compression and one chunk
- snappy compression and several chunks (16 here)

like the bsf filter need to be used with vtag and encoder edition
also test the information of the target mov for color and alpha

15 months agohttp: fix potentially dangerous whitespace skipping code
wm4 [Thu, 8 Mar 2018 03:52:36 +0000 (04:52 +0100)]
http: fix potentially dangerous whitespace skipping code

If the string consists entirely of whitespace, this could in theory
continue to write '\0' before the start of the memory allocation. In
practice, it didn't really happen: the generic HTTP header parsing code
already skips leading whitespaces, so the string is either empty, or
consists a non-whitespace. (The generic code and the cookie code
actually have different ideas about what bytes are whitespace: the
former uses av_isspace(), the latter uses WHITESPACES. Fortunately,
av_isspace() is a super set of the http.c specific WHITESPACES, so
there's probably no case where the above assumption could have been
broken.)

15 months agohttp: avoid out of bound accesses on broken Set-Cookie headers
wm4 [Thu, 8 Mar 2018 03:47:40 +0000 (04:47 +0100)]
http: avoid out of bound accesses on broken Set-Cookie headers

It's trivial to craft a HTTP response that will make the code for
skipping trailing whitespace access and possibly overwrite bytes outside
of the memory allocation. Why this can happen is blindingly obvious: it
accesses cstr[strlen(cstr)-1] without checking whether the string is
empty.

15 months agohttp: do not print a warning message for expired cookies
wm4 [Thu, 8 Mar 2018 03:30:35 +0000 (04:30 +0100)]
http: do not print a warning message for expired cookies

libavformat prints a warning that the cookie couldn't be parsed (see
callers of parse_cookie()). This is obviously not true - it could be
parsed, but was simply ignored. Don't return an error to avoid the
warning.

15 months agolavu/frame: add QP side data
wm4 [Thu, 1 Mar 2018 14:57:01 +0000 (15:57 +0100)]
lavu/frame: add QP side data

This adds a way for an API user to transfer QP data and metadata without
having to keep the reference to AVFrame, and without having to
explicitly care about QP APIs. It might also provide a way to finally
remove the deprecated QP related fields. In the end, the QP table should
be handled in a very similar way to e.g. AV_FRAME_DATA_MOTION_VECTORS.

There are two side data types, because I didn't care about having to
repack the QP data so the table and the metadata are in a single
AVBufferRef. Otherwise it would have either required a copy on decoding
(extra slowdown for something as obscure as the QP data), or would have
required making intrusive changes to the codecs which support export of
this data.

The new side data types are added under deprecation guards, because I
don't intend to change the status of the QP export as being deprecated
(as it was before this patch too).

15 months agolavu/frame: fix inconsistent qp_table_buf deprecation
wm4 [Thu, 1 Mar 2018 14:50:56 +0000 (15:50 +0100)]
lavu/frame: fix inconsistent qp_table_buf deprecation

Everything related to the QP data is deprecated, with qp_table_buf being
an inconsistent exception. Some parts were under the deprecation guards,
some not. It probably didn't even compile.

15 months agoavformat/hlsenc: reindent after previous commits
Steven Liu [Sun, 18 Mar 2018 06:09:44 +0000 (14:09 +0800)]
avformat/hlsenc: reindent after previous commits

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
15 months agoavformat/hlsenc: fix fmp4 single init file problem
Steven Liu [Sun, 18 Mar 2018 06:08:57 +0000 (14:08 +0800)]
avformat/hlsenc: fix fmp4 single init file problem

fix ticket: #7021

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
15 months agoavformat/hlsenc: fix memleak problem about fmp4_init_filename
Steven Liu [Sun, 18 Mar 2018 06:08:14 +0000 (14:08 +0800)]
avformat/hlsenc: fix memleak problem about fmp4_init_filename

move fmp4_init_filename init in if else for first fmp4_init_filename set
value operation.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
15 months agoavformat/hlsenc: reindent after previous commits
Steven Liu [Sun, 18 Mar 2018 06:07:40 +0000 (14:07 +0800)]
avformat/hlsenc: reindent after previous commits

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
15 months agoavformat/hlsenc: fix write wrong init file URI string problem
Steven Liu [Sun, 18 Mar 2018 06:07:00 +0000 (14:07 +0800)]
avformat/hlsenc: fix write wrong init file URI string problem

fmp4_init_filename should append after base_output_dirname

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
15 months agolavf/dashenc: remove unneeded call to dash_free
Rodger Combs [Wed, 14 Mar 2018 06:24:39 +0000 (01:24 -0500)]
lavf/dashenc: remove unneeded call to dash_free

15 months agolibavformat/dashenc: Option to set timeout for socket I/O operation
Ravindra [Mon, 5 Mar 2018 09:37:26 +0000 (15:07 +0530)]
libavformat/dashenc: Option to set timeout for socket I/O operation

15 months agoavformat/codec2: don't include avcodec objects
James Almer [Sat, 17 Mar 2018 20:17:25 +0000 (17:17 -0300)]
avformat/codec2: don't include avcodec objects

They belong in avcodec.

Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoconfigure: revert changes to the schannel check
James Almer [Sat, 17 Mar 2018 19:49:15 +0000 (16:49 -0300)]
configure: revert changes to the schannel check

check_cpp_condition was not being called on some targets, which made schannel
remain enabled even when it was not available

Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoMerge commit '83fef16b6a8dbbcbd80d159ba3ebe818dbbb2776'
James Almer [Sat, 17 Mar 2018 18:01:29 +0000 (15:01 -0300)]
Merge commit '83fef16b6a8dbbcbd80d159ba3ebe818dbbb2776'

* commit '83fef16b6a8dbbcbd80d159ba3ebe818dbbb2776':
  configure: Add check_cpp_condition() helper function to simplify some expressions

Merged-by: James Almer <jamrial@gmail.com>
15 months agoMerge commit 'a5e011c8dcbf6968cc60f883d33382ba46147e90'
James Almer [Sat, 17 Mar 2018 18:00:40 +0000 (15:00 -0300)]
Merge commit 'a5e011c8dcbf6968cc60f883d33382ba46147e90'

* commit 'a5e011c8dcbf6968cc60f883d33382ba46147e90':
  configure: Add check_cmd() helper function to simplify some expressions

Merged-by: James Almer <jamrial@gmail.com>
15 months agofate/hapenc : remove test which use libsnappy
Martin Vignali [Wed, 14 Mar 2018 06:26:43 +0000 (07:26 +0100)]
fate/hapenc : remove test which use libsnappy

the test in none mode can be let (they don't use libsnappy)

15 months agofate: add a dca_core bitstream filter test
James Almer [Sat, 17 Mar 2018 05:08:37 +0000 (02:08 -0300)]
fate: add a dca_core bitstream filter test

Reviwed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoPartially revert "avcodec/hapqa_extract: remove the AVOption flags
James Almer [Sat, 17 Mar 2018 15:03:32 +0000 (12:03 -0300)]
Partially revert "avcodec/hapqa_extract: remove the AVOption flags

Re add AVOptions flags, using the new one meant for bsfs.
This partially reverts commit f706cdda56.

Signed-off-by: James Almer <jamrial@gmail.com>
15 months agolavc/extract_extradata_bsf: support dump options.
Jun Zhao [Thu, 8 Mar 2018 06:05:53 +0000 (14:05 +0800)]
lavc/extract_extradata_bsf: support dump options.

support dump bit stream filter options

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
15 months agocmdutils: remove a superfluous line break
James Almer [Sat, 17 Mar 2018 14:53:56 +0000 (11:53 -0300)]
cmdutils: remove a superfluous line break

Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoavcodec/null_bsf: move the reference in the bsf internal buffer
James Almer [Fri, 16 Mar 2018 22:51:08 +0000 (19:51 -0300)]
avcodec/null_bsf: move the reference in the bsf internal buffer

There's no need to allocate a new packet for it.

Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoavfilter/af_surround: drain input at EOF
Paul B Mahol [Fri, 16 Mar 2018 11:30:17 +0000 (12:30 +0100)]
avfilter/af_surround: drain input at EOF

Signed-off-by: Paul B Mahol <onemda@gmail.com>
15 months agoavutil/log: print level prefix also when no AVClass context is available
Tobias Rapp [Wed, 14 Mar 2018 08:34:32 +0000 (09:34 +0100)]
avutil/log: print level prefix also when no AVClass context is available

Adds the level prefix to all log messages, except those with level <=
AV_LOG_QUIET as they seem to be used for flushing the log buffer.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
15 months agoavutil: bump version after the latest AVOption flag addition
James Almer [Fri, 16 Mar 2018 03:19:45 +0000 (00:19 -0300)]
avutil: bump version after the latest AVOption flag addition

Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoffmpeg: support dump bit stream filter options.
Jun Zhao [Thu, 8 Mar 2018 05:50:31 +0000 (13:50 +0800)]
ffmpeg: support dump bit stream filter options.

Support dump bit stream filter option in ffmpeg -h full and
ffmpeg -h bsf=FooBar.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agolavu/opt: add bit stream filter option dump support.
Jun Zhao [Wed, 14 Mar 2018 02:05:05 +0000 (10:05 +0800)]
lavu/opt: add bit stream filter option dump support.

enable dump bit stream filter and update opt fate test ref.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agolavu/opt: add AV_OPT_FLAG_BSF_PARAM
Jun Zhao [Thu, 8 Mar 2018 05:47:23 +0000 (13:47 +0800)]
lavu/opt: add AV_OPT_FLAG_BSF_PARAM

add AV_OPT_FLAG_BSF_PARAM for bit stream filter options.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agoavformat/movenc: move the concatenated eac3 packet reference
James Almer [Wed, 14 Mar 2018 02:35:12 +0000 (23:35 -0300)]
avformat/movenc: move the concatenated eac3 packet reference

Simplifies code.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoconfigure: add missing adts_header to aac_fixed decoder
James Almer [Thu, 15 Mar 2018 23:33:20 +0000 (20:33 -0300)]
configure: add missing adts_header to aac_fixed decoder

Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoMerge commit '49804dc2baec009577e6b4ee827ae562188fbc2f'
James Almer [Thu, 15 Mar 2018 21:22:51 +0000 (18:22 -0300)]
Merge commit '49804dc2baec009577e6b4ee827ae562188fbc2f'

* commit '49804dc2baec009577e6b4ee827ae562188fbc2f':
  configure: Use test_ prefix for helper functions that do not set variables

Merged-by: James Almer <jamrial@gmail.com>
15 months agoMerge commit '8c893aa3cd5f2d73896c72af330dcbfe299fbc5a'
James Almer [Thu, 15 Mar 2018 21:09:58 +0000 (18:09 -0300)]
Merge commit '8c893aa3cd5f2d73896c72af330dcbfe299fbc5a'

* commit '8c893aa3cd5f2d73896c72af330dcbfe299fbc5a':
  configure: Drop unnecessary variables, shifts, and quotes in helper functions

Merged-by: James Almer <jamrial@gmail.com>
15 months agoMerge commit '121314895f6360852b2807d5dfafea576b2e6fed'
James Almer [Thu, 15 Mar 2018 21:01:11 +0000 (18:01 -0300)]
Merge commit '121314895f6360852b2807d5dfafea576b2e6fed'

* commit '121314895f6360852b2807d5dfafea576b2e6fed':
  configure: Fix logic of AMF external library check

This commit is a noop. AMF is meant to be autodetected.

Merged-by: James Almer <jamrial@gmail.com>
15 months agoMerge commit '0711d142997b2662ba9198e607015b06c6eed0d8'
James Almer [Thu, 15 Mar 2018 20:57:18 +0000 (17:57 -0300)]
Merge commit '0711d142997b2662ba9198e607015b06c6eed0d8'

* commit '0711d142997b2662ba9198e607015b06c6eed0d8':
  examples: Use new API for transcoding example

Merged-by: James Almer <jamrial@gmail.com>
15 months agoMerge commit 'aeaa108bafa11db290f1ada0e22dbfbd655cf2ba'
James Almer [Thu, 15 Mar 2018 20:55:36 +0000 (17:55 -0300)]
Merge commit 'aeaa108bafa11db290f1ada0e22dbfbd655cf2ba'

* commit 'aeaa108bafa11db290f1ada0e22dbfbd655cf2ba':
  hls: Add a discontinuity marker on recover

This commit is a noop, see
572a8292cbded93c64110b872d2a8abadc92b741
6b95da9af91cd912561aa25593d6a41caa071963

Merged-by: James Almer <jamrial@gmail.com>
15 months agoavformat/dashdec: Correct spelling mistakes
sanilraut [Thu, 15 Mar 2018 11:00:04 +0000 (04:00 -0700)]
avformat/dashdec: Correct spelling mistakes

Signed-off-by: Steven Liu <lingjiujianke@gmail.com>
15 months agoavcodec/hapqa_extract: remove the AVOption flags
James Almer [Wed, 14 Mar 2018 01:08:29 +0000 (22:08 -0300)]
avcodec/hapqa_extract: remove the AVOption flags

These two are not used for bitstream filters.

Reviewed-by: Martin Vignali <martin.vignali@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoavformat/hlsenc: Option to set timeout for socket I/O operation
Ravindra [Wed, 14 Mar 2018 11:59:34 +0000 (19:59 +0800)]
avformat/hlsenc: Option to set timeout for socket I/O operation

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
15 months agoavcodec/hapqa_extract: fix two error return values
James Almer [Tue, 13 Mar 2018 22:06:45 +0000 (19:06 -0300)]
avcodec/hapqa_extract: fix two error return values

ret is 0 by default.

Reviewed-by: Martin Vignali <martin.vignali@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoavcodec/hapqa_extract: move the reference in the bsf internal buffer
James Almer [Tue, 13 Mar 2018 21:55:49 +0000 (18:55 -0300)]
avcodec/hapqa_extract: move the reference in the bsf internal buffer

There's no need to allocate a new packet for it.

Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoavcodec/mediacodecdec: fix immediate EAGAIN with buffered packet
Aman Gupta [Tue, 13 Mar 2018 09:40:09 +0000 (02:40 -0700)]
avcodec/mediacodecdec: fix immediate EAGAIN with buffered packet

In cases where the mediacodec decoder consumed a partial packet,
receive_frame() would start returning EAGAIN if the rest of the
packet couldn't be flushed and no frames were immediately available.

This fixes receive_frame() to perform its normal blocking wait for
new frames before returning EAGAIN. Fixes an issue I could reproduce
fairly often on a FireOS 6 device, and reported to be happening
intermittently by two mpv users.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
15 months agofate/hap : add test for hap encoding
Martin Vignali [Sun, 11 Mar 2018 18:34:54 +0000 (19:34 +0100)]
fate/hap : add test for hap encoding

with and without snappy compression
with chunk 1 or chunk 16
for hap, hapa, and hapq

15 months agofate/hap : move decoding test to a separate file
Martin Vignali [Sun, 11 Mar 2018 18:22:54 +0000 (19:22 +0100)]
fate/hap : move decoding test to a separate file

15 months agoavcodec/hapqa_extract_bsf : add new bsf filter
Martin Vignali [Sun, 11 Mar 2018 18:16:09 +0000 (19:16 +0100)]
avcodec/hapqa_extract_bsf : add new bsf filter

convert HapQA data to HAPQ or HAPAlphaOnly
by copying the corresponding texture

15 months agoavcodec/hap : move parse_section_header to hap.c in order to be use by new bsf filter
Martin Vignali [Sun, 11 Mar 2018 18:15:56 +0000 (19:15 +0100)]
avcodec/hap : move parse_section_header to hap.c in order to be use by new bsf filter

15 months agovc2enc: properly promote operations to 64 bits
Rostislav Pehlivanov [Mon, 12 Mar 2018 23:31:22 +0000 (23:31 +0000)]
vc2enc: properly promote operations to 64 bits

On Windows machines, the UL suffix still means 32 bits.
The only parts that need 64 bits are (1ULL << (m + 32)) and
(t*qf + qf). Hence, use the proper ULL suffix for the former
and just increase the type of the qf constant for the latter.
No overflows can happen as long as these are done in 64 bits and
the quantization table doesn't change.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
15 months agoavformat/pcm: decrease delay when reading PCM streams.
Philipp M. Scholl [Sat, 10 Mar 2018 14:50:06 +0000 (15:50 +0100)]
avformat/pcm: decrease delay when reading PCM streams.

  Thanks for the discussion. Here's the next version, now with /25 and removed
ff_log2().

  The blocksize of the PCM decoder is hard-coded. This creates
unnecessary delay when reading low-rate (<100Hz) streams. This creates
issues when multiplexing multiple streams, since other inputs are only
opened/read after a low-rate input block was completely read.

 This patch decreases the blocksize for low-rate inputs, so
approximately a block is read every 40ms. This decreases the startup
delay when multiplexing inputs with different rates.

Signed-off-by: Philipp M. Scholl <pscholl@bawue.de>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agoh264_mp4toannexb_bsf: Fix start code size of parameter sets.
Yusuke Nakamura [Mon, 12 Feb 2018 16:45:05 +0000 (01:45 +0900)]
h264_mp4toannexb_bsf: Fix start code size of parameter sets.

Any parameter set shall have start code of at least 4 byte size.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agoffprobe: fix infinite loop in subtitle decoding
Marton Balint [Sun, 11 Mar 2018 17:02:12 +0000 (18:02 +0100)]
ffprobe: fix infinite loop in subtitle decoding

Fixes a regression since 2a88ebd096f3c748a2d99ed1b60b22879b3c567c which caused
an infinite loop in the subtitle decoding.

Fixes ticket #6796.

Signed-off-by: Marton Balint <cus@passwd.hu>
15 months agoavformat/hlsenc: fix for zero EXTINF tag duration
Vishwanath Dixit [Mon, 12 Mar 2018 15:17:58 +0000 (23:17 +0800)]
avformat/hlsenc: fix for zero EXTINF tag duration

This is the fix for bug https://trac.ffmpeg.org/ticket/7073

Tested-by: Brainiarc7
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
15 months agoavcodec/mediacodecdec_common: make INFO_TRY_AGAIN trace messages more consistent
Matthieu Bouron [Mon, 12 Mar 2018 08:10:57 +0000 (09:10 +0100)]
avcodec/mediacodecdec_common: make INFO_TRY_AGAIN trace messages more consistent

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
15 months agoavcodec/mediacodecdec: add debug logging around hw buffer lifecycle
Aman Gupta [Sun, 11 Mar 2018 07:43:42 +0000 (23:43 -0800)]
avcodec/mediacodecdec: add debug logging around hw buffer lifecycle

Some Android devices are very finicky about how quicky output buffers
are returned back to the decoder, especially when they are associated
with a Surface.

This commit adds a new counter that keeps track of exactly how many hw
output buffers are being retained by the user, along with DEBUG level
logging that makes it easy to track the lifecycle of these buffers.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
15 months agoavcodec/nuv: rtjpeg with dimensions less than 16 would result in no decoded pixels...
Michael Niedermayer [Tue, 27 Feb 2018 14:17:12 +0000 (15:17 +0100)]
avcodec/nuv: rtjpeg with dimensions less than 16 would result in no decoded pixels thus reject it

Fixes: Timeout
Fixes: 6297/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-4882404863901696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agoavcodec/nuv: Check for minimum input size for uncomprssed and rtjpeg
Michael Niedermayer [Tue, 27 Feb 2018 14:17:12 +0000 (15:17 +0100)]
avcodec/nuv: Check for minimum input size for uncomprssed and rtjpeg

Fixes: Timeout
Fixes: 6297/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-4882404863901696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agoavcodec/wmalosslessdec: Reset num_saved_bits on error path
Michael Niedermayer [Sat, 10 Mar 2018 23:13:57 +0000 (00:13 +0100)]
avcodec/wmalosslessdec: Reset num_saved_bits on error path

Fixes: NULL pointer dereference
Fixes: poc-201803.wav
Found-by: GwanYeong Kim <gy741.kim@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agoavformat/mov: Fix integer overflows related to sample_duration
Michael Niedermayer [Fri, 9 Mar 2018 15:43:29 +0000 (16:43 +0100)]
avformat/mov: Fix integer overflows related to sample_duration

Fixes: runtime error: signed integer overflow: -9166684017437101870 + -2495066639299164439 cannot be represented in type

Fixes: Chromium bug 791349

Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agoavcodec/trace_headers: move the reference in the bsf internal buffer
James Almer [Sun, 11 Mar 2018 16:50:28 +0000 (13:50 -0300)]
avcodec/trace_headers: move the reference in the bsf internal buffer

There's no need to allocate a new packet for it.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoavcodec/remove_extradata: move the reference in the bsf internal buffer
James Almer [Sun, 11 Mar 2018 16:45:19 +0000 (13:45 -0300)]
avcodec/remove_extradata: move the reference in the bsf internal buffer

There's no need to allocate a new packet for it.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoavcodec/mov2textsub: move the reference in the bsf internal buffer
James Almer [Sun, 11 Mar 2018 17:02:10 +0000 (14:02 -0300)]
avcodec/mov2textsub: move the reference in the bsf internal buffer

There's no need to allocate a new packet for it.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoavcodec/extract_extradata: move the reference in the bsf internal buffer
James Almer [Sun, 11 Mar 2018 16:45:05 +0000 (13:45 -0300)]
avcodec/extract_extradata: move the reference in the bsf internal buffer

There's no need to allocate a new packet for it.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoavcodec/dca_core: move the reference in the bsf internal buffer
James Almer [Sun, 11 Mar 2018 16:29:19 +0000 (13:29 -0300)]
avcodec/dca_core: move the reference in the bsf internal buffer

There's no need to allocate a new packet for it.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoavcodec/chomp: move the reference in the bsf internal buffer
James Almer [Sun, 11 Mar 2018 16:53:04 +0000 (13:53 -0300)]
avcodec/chomp: move the reference in the bsf internal buffer

There's no need to allocate a new packet for it.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoavfilter: add drmeter audio filter
Paul B Mahol [Tue, 6 Mar 2018 18:47:29 +0000 (19:47 +0100)]
avfilter: add drmeter audio filter

Signed-off-by: Paul B Mahol <onemda@gmail.com>
15 months agoavcodec/extract_extradata: don't allocate more space than needed when removing NALUs...
James Almer [Fri, 9 Mar 2018 17:31:30 +0000 (14:31 -0300)]
avcodec/extract_extradata: don't allocate more space than needed when removing NALUs in h264/hevc

Signed-off-by: James Almer <jamrial@gmail.com>
15 months agolavf/mov.c: Use the correct offset to shift timestamp when seeking.
Sasi Inguva [Fri, 9 Mar 2018 21:30:21 +0000 (13:30 -0800)]
lavf/mov.c: Use the correct offset to shift timestamp when seeking.

Fixes seek for files with empty edits and files with negative ctts
(dts_shift > 0). Added fate samples and tests.

Signed-off-by: Sasi Inguva <isasi@isasi.mtv.corp.google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agoavcodec/ffv1: support of more pix_fmt
Jérôme Martinez [Wed, 7 Mar 2018 10:19:03 +0000 (11:19 +0100)]
avcodec/ffv1: support of more pix_fmt

Without direct support of such pix_fmt, content is padded to 16-bit
and it is not possible to know that the source file was with a smaller bit depth
so framemd5 is different

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agovc2enc: replace quantization LUT with a smaller division LUT
Rostislav Pehlivanov [Tue, 27 Feb 2018 23:12:33 +0000 (23:12 +0000)]
vc2enc: replace quantization LUT with a smaller division LUT

This commit replaces the huge and impractical LUT which converted coeffs
and a quantizer to bits to encode and instead uses a standard multiplication
and a shift to replace the division and then codes the values using the
regular golomb coding functions.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
15 months agoavutil: add missing version bump for AV_CRC_8_EBU
James Almer [Sat, 10 Mar 2018 04:15:05 +0000 (01:15 -0300)]
avutil: add missing version bump for AV_CRC_8_EBU

Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoavformat/img2dec: fix infinite loop
Michael Niedermayer [Sat, 10 Mar 2018 00:40:36 +0000 (01:40 +0100)]
avformat/img2dec: fix infinite loop

Fixes: kira-poc

Found-by: Kira <kira_cxy@foxmail.com>
Change suggested by Kira
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agoavformat/oggparsedaala: Do not adjust AV_NOPTS_VALUE
Michael Niedermayer [Thu, 8 Mar 2018 16:28:36 +0000 (17:28 +0100)]
avformat/oggparsedaala: Do not adjust AV_NOPTS_VALUE

Fixes: potential signed integer overflow

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agoavformat/oggparseogm: Check lb against psize
Michael Niedermayer [Fri, 9 Mar 2018 00:05:20 +0000 (01:05 +0100)]
avformat/oggparseogm: Check lb against psize

No testcase, this was found during code review

Found-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agoavformat/oggparseogm: Fix undefined shift in ogm_packet()
Michael Niedermayer [Thu, 8 Mar 2018 22:14:04 +0000 (23:14 +0100)]
avformat/oggparseogm: Fix undefined shift in ogm_packet()

Fixes: shift exponent 48 is too large for 32-bit type 'int'
Fixes: Chromium bug 786793
Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agoavformat/avidec: Fix integer overflow in cum_len check
Michael Niedermayer [Thu, 8 Mar 2018 21:40:50 +0000 (22:40 +0100)]
avformat/avidec: Fix integer overflow in cum_len check

Fixes: signed integer overflow: 3775922176 * 4278190080 cannot be represented in type 'long'
Fixes: Chromium bug 791237

Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agoavformat/oggparsetheora: Do not adjust AV_NOPTS_VALUE
Michael Niedermayer [Thu, 8 Mar 2018 16:28:36 +0000 (17:28 +0100)]
avformat/oggparsetheora: Do not adjust AV_NOPTS_VALUE

Fixes: Chromium bug 795653
Fixes: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long'
Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agoavutil/parseutils: only accept full us duration, do not accept mss duration
Marton Balint [Mon, 5 Mar 2018 23:45:09 +0000 (00:45 +0100)]
avutil/parseutils: only accept full us duration, do not accept mss duration

Accepting 'u' suffix for a time specification is neither intuitive nor
consistent (now that we don't accept m). Also there was a bug in the code
accepting an extra 's' even after 'ms'.

Signed-off-by: Marton Balint <cus@passwd.hu>
15 months agoavformat/mxfdec: do not allow more partitions than INT_MAX/2
Marton Balint [Thu, 8 Mar 2018 23:46:06 +0000 (00:46 +0100)]
avformat/mxfdec: do not allow more partitions than INT_MAX/2

Some math (e.g: partition binary search) overflows if we have that many
parititions.

Signed-off-by: Marton Balint <cus@passwd.hu>
15 months agoavformat/mxfdec: use binary search in mxf_absolute_bodysid_offset
Marton Balint [Sun, 18 Feb 2018 23:43:05 +0000 (00:43 +0100)]
avformat/mxfdec: use binary search in mxf_absolute_bodysid_offset

Signed-off-by: Marton Balint <cus@passwd.hu>
15 months agoavformat/mxfdec: fix opAtom audio demuxing
Marton Balint [Sun, 18 Feb 2018 00:12:01 +0000 (01:12 +0100)]
avformat/mxfdec: fix opAtom audio demuxing

Consider edit rate when determining edit_units_per_packet and also make sure
that checks are done in edit rate time base and not in stream time base.

Fixes some errors reported with the sample in ticket #5863.

Signed-off-by: Marton Balint <cus@passwd.hu>
15 months agoavcodec/extract_extradata: zero initalize the padding bytes in all allocated buffers
James Almer [Fri, 9 Mar 2018 16:00:55 +0000 (13:00 -0300)]
avcodec/extract_extradata: zero initalize the padding bytes in all allocated buffers

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoavformat/mov: print the projection type when reporting it as unsupported
James Almer [Fri, 9 Mar 2018 14:23:23 +0000 (11:23 -0300)]
avformat/mov: print the projection type when reporting it as unsupported

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
15 months agoffmpeg: Fix stts_data memory allocation
Xiaohan Wang [Tue, 13 Feb 2018 22:45:14 +0000 (14:45 -0800)]
ffmpeg: Fix stts_data memory allocation

In this loop, |i| is the "index". And the memory allocated should be at
least the current "count", which is |i + 1|.

BUG=801821

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agoavcodec/ffv1enc: remove warning about transparency
Jérôme Martinez [Wed, 7 Mar 2018 12:26:36 +0000 (13:26 +0100)]
avcodec/ffv1enc: remove warning about transparency

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15 months agolavc/videotoolbox: fix threaded decoding
Rodger Combs [Sat, 3 Feb 2018 02:50:13 +0000 (20:50 -0600)]
lavc/videotoolbox: fix threaded decoding

AVHWAccel.end_frame can run on a worker thread. The assumption of the
frame threading code is that the worker thread will change the AVFrame
image data, not the AVFrame fields. So the AVFrame fields are not synced
back to the main thread. But this breaks videotoolbox due to its special
requirements (everything else is fine). It actually wants to update
AVFrame fields.

The actual videotoolbox frame is now stored in the dummy AVBufferRef, so
it mimics what happens in non-videotoolbox cases. (Changing the
AVBufferRef contents is a bit like changing the image data.) The
post_process callback copies that reference to the proper AVFrame field.

Based on a patch by wm4.

Signed-off-by: Aman Gupta <aman@tmm1.net>
15 months agolavfi/drawutils: Do not claim to support P016.
Carl Eugen Hoyos [Tue, 6 Mar 2018 23:36:21 +0000 (00:36 +0100)]
lavfi/drawutils: Do not claim to support P016.

Fixes fate on big-endian.

15 months agolibavfilter/vf_fps: Minor cleanups
Calvin Walton [Thu, 22 Feb 2018 19:10:04 +0000 (14:10 -0500)]
libavfilter/vf_fps: Minor cleanups

Since the config_props function now references both the input and output
links, rename the 'link' variable to 'outlink'.

Fix up some mismatching indentation.

Don't bother setting the width and height on the outlink; the filter
framework does that for us.

15 months agolibavfilter/vf_fps: Rewrite using activate callback
Calvin Walton [Thu, 22 Feb 2018 19:10:03 +0000 (14:10 -0500)]
libavfilter/vf_fps: Rewrite using activate callback

The old version of the filter had a problem where it would queue up
all of the duplicate frames required to fill a timestamp gap in a
single call to filter_frame. In problematic files - I've hit this in
webcam streams with large gaps due to network issues - this will queue
up a potentially huge number of frames. (I've seen it trigger the Linux
OOM-killer on particularly large pts gaps.)

This revised version of the filter using the activate callback will
generate at most 1 frame each time it is called.

15 months agoavfilter/vf_vaguedenoiser: fix plane copy for >8 bit depth formats
Paul B Mahol [Thu, 8 Mar 2018 10:04:12 +0000 (11:04 +0100)]
avfilter/vf_vaguedenoiser: fix plane copy for >8 bit depth formats

Fixes #7072.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
15 months agocheckasm/hevc_sao : add hevc_sao for checkasm
Yingming Fan [Wed, 7 Mar 2018 04:42:30 +0000 (12:42 +0800)]
checkasm/hevc_sao : add hevc_sao for checkasm

Signed-off-by: James Almer <jamrial@gmail.com>
15 months agolavc/vaapi_encode: Don't return error if the underlying driver doesn't support B...
Haihao Xiang [Tue, 6 Feb 2018 08:17:17 +0000 (16:17 +0800)]
lavc/vaapi_encode: Don't return error if the underlying driver doesn't support B frames

The underlying driver need not support B frames - since they are enabled
by default for some codecs, it is better to disable them rather than
returning an error in this case.  This makes the default settings usable
for low-power encoding on Intel platforms.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
15 months agoavcodec/mediacodecdec: add more trace logging of input/output buffers
Aman Gupta [Tue, 6 Mar 2018 21:14:51 +0000 (13:14 -0800)]
avcodec/mediacodecdec: add more trace logging of input/output buffers

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
15 months agoavcodec/mediacodecdec: add delay_flush option
Aman Gupta [Tue, 6 Mar 2018 21:07:32 +0000 (13:07 -0800)]
avcodec/mediacodecdec: add delay_flush option

The default behavior of the mediacodec decoder before this commit
was to delay flushes until all pending hardware frames were
returned to the decoder. This was useful for certain types of
applications, but was unexpected behavior for others.

The new default behavior with this commit is now to execute
flushes immediately to invalidate all pending frames. The old
behavior can be enabled by setting delay_flush=1.

With the new behavior, video players implementing seek can simply
call flush on the decoder without having to worry about whether
they have one or more mediacodec frames still buffered in their
rendering pipeline. Previously, all these frames had to be
explictly freed (or rendered) before the seek/flush would execute.

The new behavior matches the behavior of all other lavc decoders,
reducing the amount of special casing required when using the
mediacodec decoder.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
15 months agoChangelog: list the new SBC codec
Aurelien Jacobs [Sun, 17 Dec 2017 19:27:04 +0000 (20:27 +0100)]
Changelog: list the new SBC codec

15 months agosbcenc: add armv6 and neon asm optimizations
Aurelien Jacobs [Sun, 17 Dec 2017 19:10:32 +0000 (20:10 +0100)]
sbcenc: add armv6 and neon asm optimizations

This was originally based on libsbc, and was fully integrated into ffmpeg.

15 months agosbcenc: add MMX optimizations
Aurelien Jacobs [Sun, 17 Dec 2017 19:07:33 +0000 (20:07 +0100)]
sbcenc: add MMX optimizations

This was originally based on libsbc, and was fully integrated into ffmpeg.

Rough speed test:
C version:    speed= 592x
MMX version:  speed= 785x

15 months agosbc: add raw muxer for SBC
Aurelien Jacobs [Sun, 17 Dec 2017 19:24:21 +0000 (20:24 +0100)]
sbc: add raw muxer for SBC

15 months agosbc: implement SBC encoder (low-complexity subband codec)
Aurelien Jacobs [Sun, 17 Dec 2017 18:59:30 +0000 (19:59 +0100)]
sbc: implement SBC encoder (low-complexity subband codec)

This was originally based on libsbc, and was fully integrated into ffmpeg.