[FFmpeg-cvslog] ff_network_wait_fd_timeout(): check for interrupt before operation

Andrey Utkin git at videolan.org
Fri Jul 12 21:28:48 CEST 2013


ffmpeg | branch: master | Andrey Utkin <andrey.krieger.utkin at gmail.com> | Fri Jul 12 10:35:51 2013 +0300| [1e85b5e077e7e6fb9901bfd1a7a4f2594ba5a9a5] | committer: Michael Niedermayer

ff_network_wait_fd_timeout(): check for interrupt before operation

Reviewed-by: Lukasz M <lukasz.m.luki at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1e85b5e077e7e6fb9901bfd1a7a4f2594ba5a9a5
---

 libavformat/network.c |    4 ++--
 libavformat/network.h |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/network.c b/libavformat/network.c
index 55392af..1cd83b8 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -157,11 +157,11 @@ int ff_network_wait_fd_timeout(int fd, int write, int64_t timeout, AVIOInterrupt
     int64_t wait_start = 0;
 
     while (1) {
+        if (ff_check_interrupt(int_cb))
+            return AVERROR_EXIT;
         ret = ff_network_wait_fd(fd, write);
         if (ret != AVERROR(EAGAIN))
             return ret;
-        if (ff_check_interrupt(int_cb))
-            return AVERROR_EXIT;
         if (timeout > 0) {
             if (!wait_start)
                 wait_start = av_gettime();
diff --git a/libavformat/network.h b/libavformat/network.h
index d0a1e31..9cfad11 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -90,7 +90,7 @@ int ff_network_wait_fd(int fd, int write);
  * @fd Socket descriptor
  * @write Set 1 to wait for socket able to be read, 0 to be written
  * @timeout Timeout interval, in microseconds. Actual precision is 100000 mcs, due to ff_network_wait_fd usage
- * @param int_cb Interrupt callback, is checked after each ff_network_wait_fd call
+ * @param int_cb Interrupt callback, is checked before each ff_network_wait_fd call
  * @return 0 if data can be read/written, AVERROR(ETIMEDOUT) if timeout expired, or negative error code
  */
 int ff_network_wait_fd_timeout(int fd, int write, int64_t timeout, AVIOInterruptCB *int_cb);



More information about the ffmpeg-cvslog mailing list