diff mbox series

[FFmpeg-devel,3/9] avformat/evcdec: flush the bsf on EOF

Message ID 20230620144042.9629-3-jamrial@gmail.com
State Accepted
Commit a6a5e5359573aab7a0dd19045ceafe5149dffd87
Headers show
Series [FFmpeg-devel,1/9] avformat/evcdec: ensure there are enough bytes to seekback | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 fail Make fate failed
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed

Commit Message

James Almer June 20, 2023, 2:40 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/evcdec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/evcdec.c b/libavformat/evcdec.c
index 68f3a91e53..842258d229 100644
--- a/libavformat/evcdec.c
+++ b/libavformat/evcdec.c
@@ -183,15 +183,14 @@  static int evc_read_packet(AVFormatContext *s, AVPacket *pkt)
     int ret;
     int32_t nalu_size;
     int au_end_found = 0;
-
     EVCDemuxContext *const c = s->priv_data;
 
-    if (avio_feof(s->pb))
-        return AVERROR_EOF;
-
     while(!au_end_found) {
         uint8_t buf[EVC_NALU_LENGTH_PREFIX_SIZE];
 
+        if (avio_feof(s->pb))
+            goto end;
+
         ret = ffio_ensure_seekback(s->pb, EVC_NALU_LENGTH_PREFIX_SIZE);
         if (ret < 0)
             return ret;
@@ -212,6 +211,7 @@  static int evc_read_packet(AVFormatContext *s, AVPacket *pkt)
         if (ret != (nalu_size + EVC_NALU_LENGTH_PREFIX_SIZE))
             return AVERROR_INVALIDDATA;
 
+end:
         ret = av_bsf_send_packet(c->bsf, pkt);
         if (ret < 0) {
             av_log(s, AV_LOG_ERROR, "Failed to send packet to "