Commit Graph

89150 Commits

Author SHA1 Message Date
Aman Gupta 91a565e20f avformat/http: fix chunked response w/ multiple_requests=1
Currently if you use the multiple_requests=1 option and try to
receive a chunked-encoded response, http_buf_read() will hang forever.

After this patch, EOF is emulated once a 0-byte final chunk is
received by setting a new flag. This flag is reset in ff_http_do_new_request(),
which is used to make additional requests on the open socket.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-14 07:36:51 -08:00
James Almer 5c2a01f064 Makefile: fix distclean target
It must imply clean. Regression since 7ebe7e8e7a.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-14 10:09:40 -03:00
Michael Niedermayer 58cf31cee7 avcodec/x86/mpegvideodsp: Fix signedness bug in need_emu
Fixes: out of array read
Fixes: 3516/attachment-311488.dat

Found-by: Insu Yun, Georgia Tech.
Tested-by: wuninsu@gmail.com
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-14 04:54:31 +01:00
Steven Liu 880b299381 avformat/hlsenc: write fmp4 init header after first AV frame
fix ticket id: 6825

Signed-off-by: Steven Liu <lq@onvideo.cn>
Tested-by: Aman Gupta <aman@tmm1.net>
2017-11-14 10:31:26 +08:00
Muhammad Faiz 8329ae781a avutil/crc: use ff_thread_once at av_crc_get_table
Fix tsan warnings.

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-11-14 06:25:05 +07:00
wm4 9283a4f19b avcodec/videotoolbox: fix opaque_ref handling
This is a partial fix - to fix videotoolbox fully (with multithreaded
hwaccel decoding), much more work would be required.

Before this change, an assertion failure would trigger:

  $ ffmpeg -hwaccel videotoolbox -hwaccel_output_format videotoolbox_vld -i h264.ts -f null -y /dev/null
  Assertion (frame->private_ref && frame->private_ref->size == sizeof(FrameDecodeData)) || !(avctx->codec->capabilities & (1 << 1)) failed at libavcodec/decode.c:620

Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 15:10:07 -08:00
Aman Gupta b7f963c444 avcodec/videotoolbox: reorder functions to avoid forward declarations
Cosmetic change only.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 15:06:50 -08:00
Aman Gupta 5e577c586b avcodec/videotoolbox: fix whitespace
Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 14:32:48 -08:00
Aman Gupta c8b1a151ce avcodec/videotoolboxenc: remove spurious warning
Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 14:32:48 -08:00
Aman Gupta 68ef503bb5 avcodec/videotoolbox: pass through hevc param changes to the decoder
This includes the SEI_PREFIX/SEI_SUFFIX NALUs, which can contain
updates like HEVC_SEI_TYPE_ACTIVE_PARAMETER_SETS. Previously, hevc
samples with this SEI present would not playback correctly.

See for example https://github.com/lhc70000/iina/issues/1123

Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 14:32:48 -08:00
Aman Gupta 3a91b3ae74 avcodec/hevc: implement new decode_params callback for VideoToolbox
Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 14:32:48 -08:00
Aman Gupta bd2d70c0b8 avcodec/videotoolbox: remove unnecessary if statement
Cosmetic change only.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 14:32:48 -08:00
Aman Gupta 403d10a8b3 avcodec/videotoolbox: create avcC even when h264 extradata is missing
Removes the avctx->extradata_size requirement when creating avcC/hvcC, since
avctx->extradata is only used in the esds code path.

This fixes an issue where the VideoToolbox decoder would not work unless
avformat_find_stream_info() was called.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 14:32:48 -08:00
Aman Gupta 9519983c0f avcodec/videotoolbox: use decode_params to propagate H264 PPS changes and restart on SPS changes
This fixes decoding of H264 video samples with SPS and PPS changes.

See for example https://s3.amazonaws.com/tmm1/videotoolbox/spschange.ts,
which previously stalled the decoder and failed to produce any new frames
after the SPS change.

Also see https://s3.amazonaws.com/tmm1/videotoolbox/ppschange.ts, which
uses multiple PPS and would previously cause VT decode failures.

If the VideoToolbox session needs to be restarted, and
videotoolbox_start() fails for some reason (for instance, if the video
is interlaced and the decoder is running on iOS), avcodec will return
AVERROR_EXTERNAL. This can be used by the API user to switch to another
decoder.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 14:32:48 -08:00
Aman Gupta 872add0854 avcodec/h264: implement new decode_params callback for PPS/SPS
This callback will be used by the VideoToolbox H264 hwaccel so that it
can receive SPS and PPS NALUs. VideoToolbox requires PPS changes to be
fed into the decoder session, and for the session to be recreated when
the SPS changes.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 14:32:48 -08:00
Aman Gupta 76f169368d avcodec: add decode_params callback to AVHWAccel struct
Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 14:32:48 -08:00
Aman Gupta dad42bc5a1 avcodec/h264, videotoolbox: return AVERROR_INVALIDDATA when no frames are produced
The only reason videotoolbox wouldn't produce frames is if the data fed
to it was invalid, so returning AVERROR_INVALIDDATA makes sense here.

Further, it means AVERROR_EXTERNAL can be used in further commits to signal
fatal VideoToolbox errors, letting the user know that they need to fallback to
another decoder.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-13 14:32:27 -08:00
Aman Gupta 6515e2834a avcodec/videotoolbox: print descriptive errors on decode failures
Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 14:31:45 -08:00
Aman Gupta d869928ca6 avcodec/videotoolbox: reset bitstream_size in end_frame
This allows decode_slice to be invoked multiple times before end_frame,
causing slices to accumulate before being fed into the VT decoder.

An upcoming commit will re-use decode_slice for parameter NALUs, so
they can be propagated into the VT decoder session along with slice
data.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 14:31:45 -08:00
Aman Gupta b4b177049a avcodec/videotoolbox: extract videotoolbox_{start,stop} helpers
These helpers will be used in later commits to automatically restart
the decoder session when SPS changes are encountered.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 14:31:44 -08:00
Aman Gupta 631296ff99 avcodec/videotoolbox: use early return in videotoolbox_default_free
Cosmetic change only.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 14:31:44 -08:00
Aman Gupta 230b91cdfd avcodec/videotoolboxenc: re-indent code
Cosmetic change only.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 14:28:36 -08:00
Aman Gupta e7a5249ab1 avcodec/videotoolboxenc: add hevc_videotoolbox encoder
Signed-off-by: Aman Gupta <aman@tmm1.net>
Reviewed-by: Rodger Combs <rodger.combs@gmail.com>
2017-11-13 14:28:14 -08:00
Timo Rothenpieler 578addcff6 configure: factorize nvdec dependencies 2017-11-13 22:10:37 +01:00
Timo Rothenpieler 681c638fab configure: fix cuda dependency on nvdec 2017-11-13 22:10:37 +01:00
Aman Gupta 9c8922acad This fixes a deadlock while reading a chunked https response, if
multiple_requests=1 is also set. Without an EOF to signal the end of
the last chunk, tls_read gets stuck forever trying to read more data
than is available. This occurs with the http protocol reproducibly,
because http.c always reads 4kb at a time, and the last chunk of an
http response is often much smaller.

After this commit, tls_read always returns any buffered plaintext
first before attempting to read more encrypted data off the
underlying tcp socket.

Signed-off-by: Rodger Combs <rodger.combs@gmail.com>
2017-11-13 15:04:55 -06:00
Rodger Combs a36a3d7fec lavf/tls_securetransport: handle incomplete reads gracefully
Signed-off-by: Aman Gupta <aman at tmm1.net>
2017-11-13 15:03:34 -06:00
James Almer e7e7d56a85 Makefile: fix distclean target
It must imply clean. Regression since e0087a5624.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-13 17:37:56 -03:00
Timo Rothenpieler de6a1e32fd movenc-test: fix potential uninitialized read
Fixes CID #1413023
2017-11-13 20:33:10 +01:00
Timo Rothenpieler c7ded42d5d avfilter/vf_premultiply: fix memory-leak on failure
Fixes CID #1416352
2017-11-13 20:33:10 +01:00
Timo Rothenpieler 284b432662 avformat/fitsenc: validate input pixel format
Fixes CID #1416961 and #1416962
2017-11-13 20:33:10 +01:00
Timo Rothenpieler 237ccd8a16 lavfi/paletteuse: check get_color return value
Fixes CID #1420396
2017-11-13 20:33:10 +01:00
Timo Rothenpieler 8bcf5840ea avcodec/nvdec: fix return value on error 2017-11-13 20:33:10 +01:00
Timo Rothenpieler 538de4354d avcodec/nvdec: warn about thread count if applicable 2017-11-13 20:33:10 +01:00
Timo Rothenpieler f3f73f0893 avcodec: implement vp9 nvdec hwaccel 2017-11-13 20:33:10 +01:00
Aman Gupta 52bf0febb3 avformat/http: fix stray quote in trace logging
Signed-off-by: Aman Gupta <aman@tmm1.net>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-13 11:19:25 -08:00
Aman Gupta 480d33dfdc MAINTAINERS: add myself as videotoolbox* maintainer
Reviewed-by: Rick Kern <kernrj@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-13 19:54:20 +01:00
Michael Niedermayer 2afe05402f avcodec/aacpsdsp_template: Fix integer overflows in ps_decorrelate_c()
Fixes: runtime error: signed integer overflow: 1939661764 - -454942263 cannot be represented in type 'int'
Fixes: 3191/clusterfuzz-testcase-minimized-5688798451073024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-13 19:54:20 +01:00
Michael Niedermayer fca198fb5b avcodec/aacdec_fixed: Fix undefined shift
Fixes: runtime error: left shift of negative value -801112064
Fixes: 3492/clusterfuzz-testcase-minimized-5784775283441664

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-13 19:54:20 +01:00
Michael Niedermayer 770c934fa1 avcodec/mdct_*: Fix integer overflow in addition in RESCALE()
Fixes: runtime error: signed integer overflow: 1219998458 - -1469874012 cannot be represented in type 'int'
Fixes: 3443/clusterfuzz-testcase-minimized-5369987105554432

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-13 19:54:20 +01:00
Michael Niedermayer c897a92858 avcodec/snowdec: Fix integer overflow in header parsing
Fixes: 3984/clusterfuzz-testcase-minimized-5265759929368576
Fixes: runtime error: signed integer overflow: -1085585801 + -1094995529 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>
2017-11-13 19:54:20 +01:00
Thomas Köppe 43171a2a73 Fix missing used attribute for inline assembly variables
Variables used in inline assembly need to be marked with attribute((used)).
Static constants already were, via the define of DECLARE_ASM_CONST.
But DECLARE_ALIGNED does not add this attribute, and some of the variables
defined with it are const only used in inline assembly, and therefore
appeared dead. This change adds a macro DECLARE_ASM_ALIGNED that marks
variables as used.

This change makes FFMPEG work with Clang's ThinLTO.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-13 03:58:34 +01:00
Michael Niedermayer 1828c549c3 avfilter/vf_*_qsv: Fix flags
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-13 03:58:34 +01:00
Steven Liu f3e34072aa avformat/img2enc: add frame_pts option for make output filename
fix ticket id: #1452
when use frame_pts option, the output image name can be set with PTS
of current frame.

Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-11-13 10:52:01 +08:00
Timo Rothenpieler 3ee63f3fb7 avformat/hlsenc: allocate space for terminating null
Fixes CID #1420394
2017-11-13 10:44:16 +08:00
James Almer d9ff1e4c8b configure: fix writing library dependencies to config.sh
Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-12 23:04:17 -03:00
James Almer b72ac6dbb8 configure: fix writing library dependencies to config.sh
Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-12 23:02:31 -03:00
Aman Gupta fd18d310ec lavf/tls_securetransport: build on iOS
This works as expected on iOS, except for the ca_file feature which
is disabled because SecItemImport is not available.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-12 14:37:12 -08:00
Paul B Mahol f38d0d0c22 avformat/ty: check cur_chunk_pos before using it
Fixes #6831.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-11-12 22:58:15 +01:00
Paul B Mahol a38b14a432 avformat/ty: fix memory leaks
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-11-12 20:38:30 +01:00