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
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
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
presets
tests FATE: Increase FUZZ value on AAC LTP encoding test 2015-10-27 07:41:33 +00:00
tools
.gitattributes
.gitignore
.travis.yml
COPYING.GPLv2
COPYING.GPLv3
COPYING.LGPLv2.1
COPYING.LGPLv3
CREDITS
Changelog avfilter: add vibrato filter 2015-10-26 20:56:17 +01:00
INSTALL.md
LICENSE.md
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
RELEASE
arch.mak
cmdutils.c
cmdutils.h
cmdutils_common_opts.h
cmdutils_opencl.c all: add const-correctness to qsort comparators 2015-10-25 10:07:20 -04:00
common.mak
configure Revert "configure: add -Wstrict-prototypes when available" 2015-10-23 09:10:45 -04: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
ffmpeg_dxva2.c
ffmpeg_filter.c
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
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.c
ffserver_config.c
ffserver_config.h
library.mak
version.sh version.sh: add note that ffversion.h is auto-generated 2015-10-25 10:14:44 -04:00

README.md

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.