summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-04-13 16:06:11 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-04-13 18:04:25 +0200
commitfa3f9f2f6acc48fe6ac6af1ea723066d6851743c (patch)
tree339abf7fa061d6c697c3ec3c76a84b0d2efcd8b9 /libavcodec
parentf6e167998f258dd69cd5e66e8bea52590bdec75a (diff)
avcodec/avcodec: Don't reset decoder-fields for encoders when flushing
Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avcodec.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index a07e3ef4d6..d11f035481 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -422,6 +422,17 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
}
if (avci->in_frame)
av_frame_unref(avci->in_frame);
+ } else {
+ av_packet_unref(avci->last_pkt_props);
+ while (av_fifo_read(avci->pkt_props, avci->last_pkt_props, 1) >= 0)
+ av_packet_unref(avci->last_pkt_props);
+
+ av_packet_unref(avci->in_pkt);
+
+ avctx->pts_correction_last_pts =
+ avctx->pts_correction_last_dts = INT64_MIN;
+
+ av_bsf_flush(avci->bsf);
}
avci->draining = 0;
@@ -430,22 +441,10 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
av_frame_unref(avci->buffer_frame);
av_packet_unref(avci->buffer_pkt);
- av_packet_unref(avci->last_pkt_props);
- while (av_fifo_read(avci->pkt_props, avci->last_pkt_props, 1) >= 0)
- av_packet_unref(avci->last_pkt_props);
-
- av_packet_unref(avci->in_pkt);
-
if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
ff_thread_flush(avctx);
else if (ffcodec(avctx->codec)->flush)
ffcodec(avctx->codec)->flush(avctx);
-
- avctx->pts_correction_last_pts =
- avctx->pts_correction_last_dts = INT64_MIN;
-
- if (avci->bsf)
- av_bsf_flush(avci->bsf);
}
void avsubtitle_free(AVSubtitle *sub)