[FFmpeg-devel] [PATCH] libavcodec/bsf: do not ignore last packet after eof
Niko Kurvinen
niko.kurvinen at iki.fi
Sat Nov 6 03:51:18 EET 2021
After empty packet is sent and eof is set, remaining packet, if any, was not delivered by ff_bsf_get_packet*.
Signed-off-by: Niko Kurvinen <niko.kurvinen at iki.fi>
---
libavcodec/bsf.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index 8ba021cb47..f9e6bbf499 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -233,11 +233,11 @@ int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt)
FFBSFContext *const bsfi = ffbsfcontext(ctx);
AVPacket *tmp_pkt;
- if (bsfi->eof)
- return AVERROR_EOF;
-
- if (IS_EMPTY(bsfi->buffer_pkt))
+ if (IS_EMPTY(bsfi->buffer_pkt)) {
+ if (bsfi->eof)
+ return AVERROR_EOF;
return AVERROR(EAGAIN);
+ }
tmp_pkt = av_packet_alloc();
if (!tmp_pkt)
@@ -253,11 +253,11 @@ int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
{
FFBSFContext *const bsfi = ffbsfcontext(ctx);
- if (bsfi->eof)
- return AVERROR_EOF;
-
- if (IS_EMPTY(bsfi->buffer_pkt))
+ if (IS_EMPTY(bsfi->buffer_pkt)) {
+ if (bsfi->eof)
+ return AVERROR_EOF;
return AVERROR(EAGAIN);
+ }
av_packet_move_ref(pkt, bsfi->buffer_pkt);
--
2.30.2
More information about the ffmpeg-devel
mailing list