1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00
Go to file
Andreas Rheinhardt fa77cb258b avcodec/h264dec: Fix data race when updating decode_error_flags
When using multi-threaded decoding, every decoding thread
has its own DBP consisting of H264Pictures and each of these
points to its own AVFrames. They are synced during
update_thread_context via av_frame_ref() and therefore
the threads actually decoding (as well as all the others)
must not modify any field that is copied by av_frame_ref()
after ff_thread_finish_setup().

Yet this is exactly what happens when an error occurs
during decoding and the AVFrame's decode_error_flags are updated.
Given that these errors only become apparent during decoding,
this can't be set before ff_thread_finish_setup() without
defeating the point of frame-threading; in practice,
this meant that the decoder did not set these flags correctly
in case frame-threading was in use. (This means that e.g.
the ffmpeg cli tool fails to output its "corrupt decoded frame"
message in a nondeterministic fashion.)

This commit fixes this by adding a new H264Picture field
that is actually propagated across threads; the field
is an AVBufferRef* whose data is an atomic_int; it is
atomic in order to allow multiple threads to update it
concurrently and not to provide synchronization
between the threads setting the field and the thread
ultimately returning the AVFrame.

This unfortunately has the overhead of one allocation
per H264Picture (both the original one as well as
creating a reference to an existing one), even in case
of no errors. In order to mitigate this, an AVBufferPool
has been used and only if frame-threading is actually
in use. This expense will be removed as soon as
a proper API for refcounted objects (not based upon
AVBuffer) is in place.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-15 13:08:37 +02:00
compat configure: Set WIN32_LEAN_AND_MEAN at configure time 2023-08-14 22:57:28 +03:00
doc avformat/mov: add interleaved_read option 2023-09-14 18:49:51 +08:00
ffbuild
fftools fftools/ffmpeg: do not fail on AVERROR(EAGAIN) from choose_output() 2023-09-14 10:44:05 +02:00
libavcodec avcodec/h264dec: Fix data race when updating decode_error_flags 2023-09-15 13:08:37 +02:00
libavdevice avutil/imgutils: Add wrapper for av_image_copy() to avoid casts 2023-09-12 09:42:27 +02:00
libavfilter avfilter/dnn_backend_openvino: fix wild pointer on error path 2023-09-15 13:02:15 +08:00
libavformat avformat/jpegxl_anim_dec: Check that size fits within argument 2023-09-14 22:00:17 +02:00
libavutil avutil/hwcontext_vulkan: Cosmetics 2023-09-15 02:38:14 +02:00
libpostproc
libswresample libswresample: Prevent out of bounds. 2023-08-02 17:31:13 +02:00
libswscale avutil/internal: Don't auto-include emms.h 2023-09-04 11:04:45 +02:00
presets
tests avcodec/idctdsp: Avoid inclusion of avcodec.h 2023-09-11 00:26:34 +02:00
tools tools/patcheck: Remove test for ancient INIT_VLC_USE_STATIC 2023-09-11 00:26:34 +02:00
.gitattributes
.gitignore
.mailmap
.travis.yml
Changelog Changelog: Add Support hevc,vp9,av1 codec fourcclist in enhanced rtmp protocol 2023-09-05 15:04:38 +08:00
configure vulkan: enable VK_KHR_cooperative_matrix 2023-08-26 23:14:53 +02:00
CONTRIBUTING.md
COPYING.GPLv2
COPYING.GPLv3
COPYING.LGPLv2.1
COPYING.LGPLv3
CREDITS
INSTALL.md
LICENSE.md
MAINTAINERS MAINTAINERS: change Leo Izen IRC nickname 2023-06-20 12:46:47 -04:00
Makefile
README.md
RELEASE

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 means to alter decoded audio and video through a directed graph of connected 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.
  • 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 and will be ignored.