1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-08-03 01:39:58 +02:00
Commit Graph

44286 Commits

Author SHA1 Message Date
Steve Lhomme
ef9a711be7 configure: put d3d11 check in alphabetical order 2016-12-16 10:03:20 +01:00
Michael Niedermayer
a4fec9a7ea rtmppkt: Check for packet size mismatches
When receiving fragmented packets, the first packet declares the size,
and the later ones normally are small follow-on packets that don't repeat
the size and the other header fields. But technically, the later fragments
also can have a full header, declaring a different size than the previous
packet.

If the follow-on packet declares a larger size than the initial one, we
could end up writing outside of the allocation.

This fixes out of bounds writes.

Found-by: Paul Cher <paulcher@icloud.com>
Reviewed-by: Paul Cher <paulcher@icloud.com>

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2016-12-15 15:45:59 +02:00
Martin Storsjö
cdcfa97dc4 libavformat: Fix a faulty api deprecation guard in prepare_input_packet
This seems to have been added by mistake in 11de006b, by not
noticing the negation for the existing condition. This block does
not contain any code that accesses the codec field in AVStream.

This function is meant to serve as a complement to compute_pkt_fields2,
which is guarded by FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-12-15 12:01:48 +02:00
Janne Grunau
2425d7329f arm64: replace 'bic' with immediate with 'and' with inverted immediate
The former is not an official pseudo instruction although gas and llvm's
internal assembler support it. Fixes a build error with xcode 6.2
reported by Memphiz on github.
2016-12-14 21:53:05 +01:00
Diego Biurrun
05a603a94e ppc: Merge types_altivec.h into util_altivec.h
There is no point in keeping the two separate.
2016-12-14 14:08:43 +01:00
Diego Biurrun
ea7ee4b4e3 ppc: Centralize compiler-specific altivec.h #include handling in one place
Also move #includes into canonical order where appropriate.
2016-12-14 14:08:43 +01:00
Diego Biurrun
39929e55eb ppc: hevcdsp: Use shorthands for vector types
This is more consistent and fixes compilation with clang.
2016-12-14 14:08:43 +01:00
Diego Biurrun
554e55bbf0 decode.h: Add missing headers to fix standalone compilation 2016-12-14 14:08:43 +01:00
Wan-Teh Chang
343e283399 pthread_frame: use better memory orders for frame progress
This improves commit 59c7022740.

In ff_thread_report_progress(), the fast code path can load
progress[field] with the relaxed memory order, and the slow code path
can store progress[field] with the release memory order. These changes
are mainly intended to avoid confusion when one inspects the source code.
They are unlikely to have measurable performance improvement.

ff_thread_report_progress() and ff_thread_await_progress() form a pair.
ff_thread_await_progress() reads progress[field] with the acquire memory
order (in the fast code path). Therefore, one expects to see
ff_thread_report_progress() write progress[field] with the matching
release memory order.

In the fast code path in ff_thread_report_progress(), the atomic load of
progress[field] doesn't need the acquire memory order because the
calling thread is trying to make the data it just decoded visible to the
other threads, rather than trying to read the data decoded by other
threads.

In ff_thread_get_buffer(), initialize progress[0] and progress[1] using
atomic_init().

Signed-off-by: Wan-Teh Chang <wtc@google.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-12-14 11:16:51 +01:00
Derek Buitenhuis
e94b9313b2 fate: Add h264 test for frame num gaps
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-12-14 11:01:50 +01:00
Derek Buitenhuis
5c7f2cf81d h264_slice: Wait for refs to be available before we use them in error concealment
This could happen when there was a frame number gap and frame threading was used.

Debugging-by: Ronald S. Bultje <rsbultje@gmail.com>
Debugging-by: Justin Ruggles <justin.ruggles@gmail.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>

CC:libav-stable@libav.org
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-12-14 10:38:15 +01:00
Anton Khirnov
86157e6db2 hevc: decouple calling get_format() from exporting the SPS parameters
This makes sure ff_get_format() does not get called unnecessarily from
update_thread_context().
2016-12-14 09:06:45 +01:00
Anton Khirnov
730c023260 binkaudio: switch to the new send/receive API
It is more natural for this codec and allows to avoid awkward constructs
like "consuming 0 bytes from input". Also, keep a reference to the input
packet to avoid unnecessary copying.
2016-12-14 09:06:45 +01:00
Anton Khirnov
fa1749dd34 vp9: split superframes in the filtering stage before actual decoding
Significantly increases the efficiency of frame threading, since
individual frames in a superframe can now be decoded in parallel.
2016-12-14 09:06:45 +01:00
Anton Khirnov
03a80925ef lavc: add a bitstream filter for splitting VP9 superframes
Partially based on code by Ronald S. Bultje <rsbultje@gmail.com>.
2016-12-14 09:06:45 +01:00
Anton Khirnov
8fb4210ad8 qsvdec_h2645: switch to the new generic filtering mechanism
Drop the internal manual conversion from the MP4 format to Annex B.
2016-12-14 09:06:45 +01:00
Anton Khirnov
972c71e9cb lavc: add support for filtering packets before decoding 2016-12-14 09:06:45 +01:00
Anton Khirnov
061a0c14bb decode: restructure the core decoding code
Currently, the new decoding API is pretty much just a wrapper around the
old deprecated one. This is problematic, since it interferes with making
full use of the flexibility added by the new API. The old API should
also be removed at some future point.

Reorganize the code so that the new send_packet/receive_frame functions
call the actual decoding directly and change the old deprecated
avcodec_decode_* functions into wrappers around the new API.

The new internal API for decoders is now changing as well. Before this
commit, it mirrors the public API, so the decoders need to implement
send_packet() and receive_frame() callbacks. This turns out to require
awkward constructs in both the decoders and the generic code. After this
commit, the decoders only implement the receive_frame() callback and
call a new internal function, ff_decode_get_packet() to obtain input
data, in the same manner to how the bitstream filters now work.

avcodec will now always make a reference to the input packet, which means
that non-refcounted input packets will be copied. Keeping the previous
behaviour, where this copy could sometimes be avoided, would make the
code significantly more complex and fragile for only dubious gains,
since packets are typically small and everyone who cares about
performance should use refcounted packets anyway.
2016-12-14 09:06:44 +01:00
Anton Khirnov
549d0bdca5 decode: be more explicit about storing the last packet properties
The current code stores a pointer to the packet passed to the decoder,
which is then used during get_buffer() for timestamps and side data
passthrough. However, since this is a pointer to user data which we do
not own, storing it is potentially dangerous. It is also ill defined for
the new decoding API with split input/output.

Fix this problem by making an explicit internally owned copy of the
packet properties.
2016-12-14 09:06:44 +01:00
Anton Khirnov
47e547b321 lavc: add a null bitstream filter
It is useful for testing/debugging and will also be used as the default
filter in the following commit adding pre-decode filtering to avoid
having a separate non-filtered codepath.
2016-12-14 09:06:44 +01:00
Anton Khirnov
0309ddcfb2 lavc: handle MP3 in get_audio_frame_duration() 2016-12-14 09:06:44 +01:00
Diego Biurrun
6aa4ba7131 dxva2: Keep code shared between dxva2 and d3d11va under the correct #if
This partially reverts commit ac648bb835.
2016-12-12 13:44:25 +01:00
Alexandra Hajkova
b0e6b3f477 hevc: ppc: Add HEVC 4x4 IDCT for PowerPC
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-12-12 09:25:16 +01:00
Diego Biurrun
fc368497f2 configure: Add missing dxva2 dependency for dxva2_lib 2016-12-12 00:15:38 +01:00
Diego Biurrun
f1248fae90 configure: Handle dxva2 optional components in the standard way 2016-12-11 09:27:40 +01:00
Diego Biurrun
a6901b9c6b Drop libxvid rate control support for mpegvideo encoding
The feature has outlived is usefulness and complicates the code.
2016-12-11 09:27:40 +01:00
Diego Biurrun
ac648bb835 dxva2: Simplify some ifdefs 2016-12-11 09:27:40 +01:00
Mark Thompson
7d81698b89 vaapi_h265: Fix CFR mode with framerate set in AVCodecContext
Same issue as 17a0f9481c.
2016-12-10 16:55:44 +00:00
Mark Thompson
ade370a4d7 lavfi: Add VAAPI deinterlacer 2016-12-10 16:55:44 +00:00
Diego Biurrun
f8a1ead0ae build: Add -D_XOPEN_SOURCE=600 to CPPFLAGS on Cygwin
This is required to make certain math defines visible on modern Cygwin.
2016-12-10 16:14:25 +01:00
Diego Biurrun
39fbcf8f76 configure: Fix _libs vs. _extralibs oversight 2016-12-10 15:06:34 +01:00
Diego Biurrun
be2d555c98 build: Use _extralibs variable names instead of _libs everywhere
This makes naming more consistent and simplifies extralibs-related changes.
2016-12-09 18:57:03 +01:00
Diego Biurrun
0507cd5b9f build: Rename host_libs/HOSTLIBS variables to host_extralibs/HOSTEXTRALIBS
This is more in line with the other related variable names.
2016-12-09 18:51:23 +01:00
Diego Biurrun
a7101eb40e configure: Simplify some library checks via check_lib() 2016-12-09 18:40:47 +01:00
Diego Biurrun
1818a640cf build: Fix dependencies for alsa/jack/sndio support
These components should depend on the availability of the respective
libraries, not just on the availability of the respective headers.
2016-12-09 08:42:34 +01:00
Diego Biurrun
af451ac0de configure: Drop redundant and partly bogus vaapi/vdpau header checks
These are taken care of more correctly by the library checks.
2016-12-09 08:42:08 +01:00
Diego Biurrun
932cc6496e vdpau: Do not #include vdpau_x11.h from the main vdpau header
That header should only be included in the special bits that use X11 code.
2016-12-09 08:41:53 +01:00
Diego Biurrun
92e6b31c3b dxva2: Adjust multiple inclusion guard names to follow convention 2016-12-09 08:41:52 +01:00
Ruta Gadkari
dbfe60caca vf_hwupload_cuda: Add min/max limits for device option 2016-12-08 15:58:31 -05:00
Vittorio Giovara
4efea4ce75 APIChanges: Mention where release 12 was cut
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-12-08 15:58:30 -05:00
Luca Barbato
3f75e5116b avio: Keep track of the amount of data written
Make avio_size() work with any write AVIOContext.
2016-12-08 15:58:28 -05:00
Andreas Cadhalpun
fc85646ad4 libopusdec: fix out-of-bounds read
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-12-08 15:53:58 -05:00
Andreas Cadhalpun
dc2ad09493 libschroedingerdec: fix leaking of framewithpts
Also preserve the return value from ff_get_buffer().

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-12-08 15:53:58 -05:00
Andreas Cadhalpun
8c3a643808 libschroedingerdec: don't produce empty frames
They are not valid and can cause problems/crashes for API users.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-12-08 15:53:58 -05:00
Timothy Gu
d3da8a0035 omx: Fix allocation check
Also use av_mallocz_array().

Bug-Id: CID 1396839
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-12-08 15:53:58 -05:00
Timothy Gu
d32bdadda8 qsvdec: Fix memory leak on error
Bug-Id: CID 1396851
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-12-08 15:53:58 -05:00
Wan-Teh Chang
6a93b596c5 compat/atomics: add typecasts in atomic_compare_exchange_strong()
The Solaris and Windows emulations of atomic_compare_exchange_strong()
need typecasts to avoid compiler warnings, because the functions they
call expect a void* pointer but an intptr_t integer is passed.

Note that the emulations of atomic_compare_exchange_strong() (except
the gcc version) only work for atomic_intptr_t because of the type of
the second argument (|expected|). See
http://en.cppreference.com/w/c/atomic:

_Bool atomic_compare_exchange_strong( volatile A* obj,
                                      C* expected, C desired );

The types of the first argument and second argument are different
(|A| and |C|, respectively). |C| is the non-atomic type corresponding
to |A|. In the emulations of atomic_compare_exchange_strong(), |C| is
intptr_t. This implies |A| can only be sig_intptr_t.

Signed-off-by: Wan-Teh Chang <wtc@google.com>
2016-12-08 15:53:58 -05:00
Wan-Teh Chang
2170017a1c avutil: fix data race in av_get_cpu_flags()
Make the one-time initialization in av_get_cpu_flags() thread-safe. The
static variables |flags|, |cpuflags_mask|, and |checked| in
libavutil/cpu.c are read and written using normal load and store
operations. These are considered as data races. The fix is to use atomic
load and store operations.

Remove the |checked| variable because the invalid value of -1 for
|flags| can be used to indicate the same condition. Rename |flags| to
|cpu_flags| and move it to file scope.

The fix can be verified by running the libavutil/tests/cpu_init.c test
program under ThreadSanitizer:
    ./configure --toolchain=clang-tsan
    make libavutil/tests/cpu_init
    libavutil/tests/cpu_init

There should be no warnings from ThreadSanitizer.

Co-author: Dmitry Vyukov of Google, who suggested the data race fix.

Signed-off-by: Wan-Teh Chang <wtc@google.com>
2016-12-08 15:53:58 -05:00
Diego Biurrun
d5759701a8 libkvazaar: Add missing header #includes
This fixes compilation after the next version bump.
2016-12-08 21:34:30 +01:00
Diego Biurrun
892acc7010 configure: Fail if cuda was enabled and is not available
This is the standard behavior for external libraries.
2016-12-08 20:12:24 +01:00