diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-08-15 17:07:08 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-06-12 10:49:03 +0200 |
commit | a30c95ed8a51532d7360d0505a53ec62e8e7392c (patch) | |
tree | 048b5355122c3d034294c16f3128de2d684ab852 /libavcodec/x86/fdct.h | |
parent | d4b63885a6011ff13a3a80c616a905f526a113c0 (diff) | |
download | ffmpeg-a30c95ed8a51532d7360d0505a53ec62e8e7392c.tar.gz |
avcodec/mpegvideo_dec: Sync linesize and uvlinesize between threads
linesize and uvlinesize are supposed to be the common linesize of all
the Y/UV-planes of all the currently cached pictures.
ff_mpeg_update_thread_context() syncs the pictures, yet it did not sync
linesize and uvlinesize. This mostly works, because ff_alloc_picture()
only accepts new pictures if they coincide with the linesize of the
already provided pictures (if any). Yet there is a catch: Linesize
changes are accepted when the dimensions change (in which case the
cached frames are discarded).
So imagine a scenario where all frame threads use the same dimension A
until a frame with a different dimension B is encountered in the
bitstream, only to be instantly reverted to A in the next picture. If
the user changes the linesize of the frames upon the change to dimension
B and keeps the linesize thereafter (possible if B > A),
ff_alloc_picture() will report an error when frame-threading is in use:
The thread decoding B will perform a frame size change and so will the
next thread in ff_mpeg_update_thread_context() as well as when decoding
its picture. But the next thread will (presuming it is not the same
thread that decoded B, i.e. presuming >= 3 threads) not perform a frame
size change, because the new frame size coincides with its old frame
size, yet the linesize it expects from ff_alloc_picture() is outdated,
so that it errors out.
It is also possible for the user to use the original linesizes for
the frame after the frame that reverted back to A; this will be
accepted, yet the assumption that of all pictures are the same
will be broken, leading to segfaults.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/x86/fdct.h')
0 files changed, 0 insertions, 0 deletions