diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-12-10 08:59:09 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-05-05 17:52:41 +0200 |
commit | b05631f7b959fd9ec266a4315db60cc77b655cd9 (patch) | |
tree | dd765678602300420aa7820f0ffc978ad83977b9 /libavcodec/speedhqenc.c | |
parent | 8ab2bb81b2318c8baff61fa534400b5e5244c387 (diff) |
avcodec/speedhq, speedhqenc: Make codecs init-threadsafe
The SpeedHQ decoder uses and initializes a RLTable's VLC, yet it also
initializes other parts of the RLTable that it does not use. This has
downsides besides being wasteful: Because the SpeedHQ encoder also
initializes these additional fields, there is a potential for data races
(and therefore undefined behaviour). In fact, removing the superfluous
initializations from the decoder automatically makes both the decoder
and the encoder init-threadsafe. This commit does so.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/speedhqenc.c')
-rw-r--r-- | libavcodec/speedhqenc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/speedhqenc.c b/libavcodec/speedhqenc.c index 6ff7b447a0..529df4f5b6 100644 --- a/libavcodec/speedhqenc.c +++ b/libavcodec/speedhqenc.c @@ -298,7 +298,7 @@ const AVCodec ff_speedhq_encoder = { .init = ff_mpv_encode_init, .encode2 = ff_mpv_encode_picture, .close = ff_mpv_encode_end, - .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE |