[FFmpeg-devel] [PATCH 2/3] retry_transfer_wrapper: check url_interrupt_cb at the end.

Luca Barbato lu_zero
Fri Mar 4 23:43:03 CET 2011


From: Nicolas George <nicolas.george at normalesup.org>

Checking it too early causes ffmpeg to fail to write the trailer of its
output files if it was interrupted with the 'q' keystroke.

Note that when a protocol is interrupted by url_interrupt_cb, some data may
be silently discarded: the protocol context is not suitable for anything
anymore.

Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavformat/avio.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index cf07c6d..48f591b 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -230,6 +230,8 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
         if (ret)
            fast_retries = FFMAX(fast_retries, 2);
         len += ret;
+        if (url_interrupt_cb())
+            return AVERROR(EINTR);
     }
     return len;
 }
-- 
1.7.4.1




More information about the ffmpeg-devel mailing list