FFmpeg git repo
Go to file
Hendrik Leppkes 31741aecbf avcodec: disallow hwaccel with frame threads
HWAccels with frame threads are fundamentally flawed in avcodecs current
design, and there are several known problems ranging from image corruption
to driver crashes.

These problems come down to two design problems in the interaction of
threads and HWAccel decoding:

(1)
While avcodec prevents parallel decoding and as such simultaneous access
to the hardware accelerator from the decoding threads, it cannot account
for the user code and its access to the hardware surfaces and the hardware
itself.

This can result in image corruption or even driver crashes if the
user code locks image surfaces while they are being used by the decoder
threads as reference frames.

The current HWAccel API does not offer any way to ensure exclusive access
to the hardware or the surfaces if frame threading is used.

(2)
Initialization of the HWAccel with frame threads is non-trivial, and many
decoders had and still have issues that cause excess calls to the
get_format callback.

This will potentially cause duplicate HWAccel initialization, which in
extreme cases can even lead to driver crashes if the HWAccel is
re-initialized while the user code is actively accessing the hardware
surfaces associated with it, or lead to image corruption due to lost
reference frames.

While both of these issues are solvable, fixing (1) would at least require
a huge API redesign which would move a lot of complexity into the user
code.

The only reason the combination of frame threads and HWAccel was
considered useful is to allow a seamless fallback to multi-threaded
software decoding if the HWAccel is not available, however the issues
outlined above far outweigh this.

The proper solution for a fallback is to re-open the AVCodecContext with
threading enabled if the HWAccel failed, which is a practice commonly used
by various user applications using avcodec today already.

Reviewed-by: Gwenole Beauchesne <gb.devel@gmail.com>
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 10:19:05 +01:00
compat compat/solaris/make_sunver.pl: Use /usr/bin/env perl instead of /usr/bin/perl 2015-10-20 02:21:34 +02:00
doc avfilter: add vibrato filter 2015-10-26 20:56:17 +01:00
libavcodec avcodec: disallow hwaccel with frame threads 2015-10-27 10:19:05 +01:00
libavdevice all: fix -Wextra-semi reported on clang 2015-10-24 17:58:17 -04:00
libavfilter drawutils: Reindent 2015-10-26 23:24:30 -07:00
libavformat srtenc: Reindent 2015-10-26 23:24:45 -07:00
libavresample avresample: Remove an unused variable 2015-09-29 14:33:01 +02:00
libavutil timecode: Support HFR values 2015-10-26 15:05:26 +01:00
libpostproc
libswresample all: add const-correctness to qsort comparators 2015-10-25 10:07:20 -04:00
libswscale swscale/swscale: add av_warn_unused_result to sws_init_context 2015-10-16 17:18:21 -04:00
presets
tests FATE: Increase FUZZ value on AAC LTP encoding test 2015-10-27 07:41:33 +00:00
tools
.gitattributes
.gitignore gitignore: ignore object file temporaries 2015-10-10 20:30:41 +02:00
.travis.yml
arch.mak
Changelog avfilter: add vibrato filter 2015-10-26 20:56:17 +01:00
cmdutils_common_opts.h
cmdutils_opencl.c all: add const-correctness to qsort comparators 2015-10-25 10:07:20 -04:00
cmdutils.c Merge commit '9ef748173a4e0e58d40afaf38397783cd2537eaa' 2015-10-16 22:57:21 +02:00
cmdutils.h
common.mak Merge commit 'c1aac39eaccd32dc3b74ccfcce701d3d888fbc6b' 2015-10-14 13:54:50 +02:00
configure Revert "configure: add -Wstrict-prototypes when available" 2015-10-23 09:10:45 -04:00
COPYING.GPLv2
COPYING.GPLv3
COPYING.LGPLv2.1
COPYING.LGPLv3
CREDITS
ffmpeg_dxva2.c
ffmpeg_filter.c Revert "Merge commit '8b830ee9a26d47b138f12a82085cdb372f407f1e'" (avconv: Do not try to configure filter outputs without streams) 2015-10-11 12:24:43 +02:00
ffmpeg_opt.c all: remove some casts of function pointer to void * 2015-10-24 15:14:59 -04:00
ffmpeg_qsv.c Merge commit 'fb472e1a11a4e0caed2c3c91da01ea8e35d9e3f8' 2015-10-22 16:18:02 +02:00
ffmpeg_vdpau.c
ffmpeg_videotoolbox.c ffmpeg/videotoolbox: protect UTGetOSTypeFromString on both VDA and VT 2015-10-15 10:22:31 +02:00
ffmpeg.c ffmpeg: add abort_on option to allow aborting on empty output 2015-10-22 19:03:01 +02:00
ffmpeg.h ffmpeg: add abort_on option to allow aborting on empty output 2015-10-22 19:03:01 +02:00
ffplay.c ffplay: use a separate struct for the rescaled YUVA AVSubtitle rectangles 2015-10-24 16:12:25 +02:00
ffprobe.c all: fix -Wextra-semi reported on clang 2015-10-24 17:58:17 -04:00
ffserver_config.c ffserver_config: check for INT_MIN before doing FFABS 2015-10-13 19:40:09 -04:00
ffserver_config.h
ffserver.c ffserver: avoid leaking pathname at exit 2015-10-04 22:31:22 -07:00
INSTALL.md
library.mak
LICENSE.md avfilter: add rubberband wrapper 2015-09-20 19:54:57 +02:00
MAINTAINERS MAINTAINERS: add key fingerprint 2015-10-25 19:15:04 -04:00
Makefile Merge commit 'fb472e1a11a4e0caed2c3c91da01ea8e35d9e3f8' 2015-10-22 16:18:02 +02:00
README.md README: replace http with https 2015-10-06 13:27:29 +02:00
RELEASE
version.sh version.sh: add note that ffversion.h is auto-generated 2015-10-25 10:14:44 -04:00

FFmpeg README

FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata.

Libraries

  • libavcodec provides implementation of a wider range of codecs.
  • libavformat implements streaming protocols, container formats and basic I/O access.
  • libavutil includes hashers, decompressors and miscellaneous utility functions.
  • libavfilter provides a mean to alter decoded Audio and Video through chain of filters.
  • libavdevice provides an abstraction to access capture and playback devices.
  • libswresample implements audio mixing and resampling routines.
  • libswscale implements color conversion and scaling routines.

Tools

  • ffmpeg is a command line toolbox to manipulate, convert and stream multimedia content.
  • ffplay is a minimalistic multimedia player.
  • ffprobe is a simple analysis tool to inspect multimedia content.
  • ffserver is a multimedia streaming server for live broadcasts.
  • Additional small tools such as aviocat, ismindex and qt-faststart.

Documentation

The offline documentation is available in the doc/ directory.

The online documentation is available in the main website and in the wiki.

Examples

Coding examples are available in the doc/examples directory.

License

FFmpeg codebase is mainly LGPL-licensed with optional components licensed under GPL. Please refer to the LICENSE file for detailed information.

Contributing

Patches should be submitted to the ffmpeg-devel mailing list using git format-patch or git send-email. Github pull requests should be avoided because they are not part of our review process. Few developers follow pull requests so they will likely be ignored.