]> git.sesse.net Git - ffmpeg/commit
lavc: do not implicitly share the frame pool between threads
authorAnton Khirnov <anton@khirnov.net>
Tue, 17 Jan 2017 15:28:30 +0000 (16:28 +0100)
committerAnton Khirnov <anton@khirnov.net>
Fri, 10 Apr 2020 13:47:30 +0000 (15:47 +0200)
commit9d6785d426be1ac045c0b6a13b7447459389c40b
tree34d9c009685787bab847808826e49c766fa632cd
parent29445374305fcc422fb2abe55bb5a877b95c0ef2
lavc: do not implicitly share the frame pool between threads

Currently the frame pool used by the default get_buffer2()
implementation is a single struct, allocated when opening the decoder.
A pointer to it is simply copied to each frame thread and we assume that
no thread attempts to modify it at an unexpected time. This is rather
fragile and potentially dangerous.

With this commit, the frame pool is made refcounted, with the reference
being propagated across threads along with other context variables. The
frame pool is now also immutable - when the stream parameters change we
drop the old reference and create a new one.
libavcodec/decode.c
libavcodec/internal.h
libavcodec/pthread_frame.c
libavcodec/utils.c