[FFmpeg-devel] [PATCH] avformat/mov: Properly forward error codes from av_seek

Derek Buitenhuis derek.buitenhuis at gmail.com
Thu Mar 25 18:32:40 EET 2021


This is important, for example, for connection timed out events,
when used ovr a network, returning AVERROR(ETIMEDOUT).

Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
---
 libavformat/mov.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index aef5517c2c..bd78e68c16 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -7947,8 +7947,10 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
                    sc->ffindex, sample->pos);
             if (should_retry(sc->pb, ret64)) {
                 mov_current_sample_dec(sc);
-            }
-            return AVERROR_INVALIDDATA;
+            } else if (ret64 < 0)
+                return (int)ret64;
+            else
+                return AVERROR_INVALIDDATA;
         }
 
         if (st->discard == AVDISCARD_NONKEY && !(sample->flags & AVINDEX_KEYFRAME)) {
-- 
2.31.0



More information about the ffmpeg-devel mailing list