[FFmpeg-devel] [PATCH]lavf/amr: Return AVERROR_EOF on EOF

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Mar 31 07:56:10 EEST 2017


Hi!

Attached patch fixes ticket #6280 for me.

Please comment, Carl Eugen
-------------- next part --------------
From 50c4b3fd0a04f92b54b945fe1a3c453c499d4a73 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos at ag.or.at>
Date: Fri, 31 Mar 2017 06:54:01 +0200
Subject: [PATCH] lavf/amr: Return AVERROR_EOF on EOF.

Fixes ticket #6280.
---
 libavformat/amr.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/amr.c b/libavformat/amr.c
index 59963e1..b5194a2 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -118,7 +118,7 @@ static int amr_read_packet(AVFormatContext *s, AVPacket *pkt)
     AMRContext *amr = s->priv_data;
 
     if (avio_feof(s->pb)) {
-        return AVERROR(EIO);
+        return AVERROR_EOF;
     }
 
     // FIXME this is wrong, this should rather be in an AVParser
@@ -156,6 +156,8 @@ static int amr_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     if (read != size - 1) {
         av_packet_unref(pkt);
+        if (read < 0)
+            return read;
         return AVERROR(EIO);
     }
 
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list