diff options
author | Anton Khirnov <anton@khirnov.net> | 2022-09-19 15:50:30 +0300 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2022-09-23 17:17:52 +0300 |
commit | 96c78e50a66a3b443eb2f237e2554ab84b8a12ce (patch) | |
tree | 2eb579a167ab35285a96c948325c17bcc24770e2 | |
parent | 2d04a18264e6e9b7f548954c5d1c51c3ab01b038 (diff) |
lavc/pthread_frame: always transfer stashed hwaccel state
Fixes assertion failures after avcodec_flush_buffers(), where
stashed hwaccel state is present, but prev_thread is NULL.
Found-by: Wang Bin <wbsecg1@gmail.com>
(cherry picked from commit c504fb869264fbd8fba6e81c186b2f2848b62e26)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r-- | libavcodec/pthread_frame.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index 80c15b35be..43d6cc8ff4 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -458,14 +458,14 @@ static int submit_packet(PerThreadContext *p, AVCodecContext *user_avctx, pthread_mutex_unlock(&p->mutex); return err; } - - /* transfer hwaccel state stashed from previous thread, if any */ - av_assert0(!p->avctx->hwaccel); - FFSWAP(const AVHWAccel*, p->avctx->hwaccel, fctx->stash_hwaccel); - FFSWAP(void*, p->avctx->hwaccel_context, fctx->stash_hwaccel_context); - FFSWAP(void*, p->avctx->internal->hwaccel_priv_data, fctx->stash_hwaccel_priv); } + /* transfer the stashed hwaccel state, if any */ + av_assert0(!p->avctx->hwaccel); + FFSWAP(const AVHWAccel*, p->avctx->hwaccel, fctx->stash_hwaccel); + FFSWAP(void*, p->avctx->hwaccel_context, fctx->stash_hwaccel_context); + FFSWAP(void*, p->avctx->internal->hwaccel_priv_data, fctx->stash_hwaccel_priv); + av_packet_unref(p->avpkt); ret = av_packet_ref(p->avpkt, avpkt); if (ret < 0) { |