Skip to content

Commit

Permalink
In retry_transfer_wrapper, do not check url_interrupt_cb, causes prob…
Browse files Browse the repository at this point in the history
…lems

when writing and pressing q during encoding. Instead, check url_interrupt_cb
at the end.

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 <[email protected]>
Signed-off-by: Ronald S. Bultje <[email protected]>
  • Loading branch information
bcoudurier authored and rbultje committed Mar 7, 2011
1 parent 789936d commit 688c22e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libavformat/avio.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int

len = 0;
while (len < size_min) {
if (url_interrupt_cb())
return AVERROR(EINTR);
ret = transfer_func(h, buf+len, size-len);
if (ret == AVERROR(EINTR))
continue;
Expand All @@ -239,6 +237,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;
}
Expand Down

0 comments on commit 688c22e

Please sign in to comment.