diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-02-07 13:36:52 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-02-16 22:11:53 +0100 |
commit | fbf242a51d4005a11d1a52dc5d2bff939311c24d (patch) | |
tree | 70408ab3fb396a9df3a81e8863dcb58078951525 /libavcodec/dvdata.c | |
parent | 2ccbc40eefd22a6aac1e543ea849951e159f4d8a (diff) | |
download | ffmpeg-fbf242a51d4005a11d1a52dc5d2bff939311c24d.tar.gz |
avcodec/frame_thread_encoder: Avoid allocations of AVPackets, fix deadlock
Up until now, when doing frame thread encoding, each worker thread
tried to allocate an AVPacket for every AVFrame to be encoded; said
packets would then be handed back to the main thread, where the content
of said packet is copied into the packet actually destined for output;
the temporary AVPacket is then freed.
Besides being wasteful this also has another problem: There is a risk of
deadlock, namely if no AVPacket can be allocated at all. The user
doesn't get an error at all in this case and the worker threads will
simply try to allocate a packet again and again. If the user has
supplied enough frames, the user's thread will block until a task has
been completed, which just doesn't happen if no packet can ever be
allocated.
This patch instead modifies the code to allocate the packets during
init; they are then reused again and again.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/dvdata.c')
0 files changed, 0 insertions, 0 deletions