[FFmpeg-devel] libavformat/avio: fix retry_transfer_wrapper return value on error

Submitted by Daniel Kucera on June 9, 2017, 1:51 p.m.

Details

Message ID 20170609135130.18470-1-daniel.kucera@gmail.com
State New
Headers show

Commit Message

Daniel Kucera June 9, 2017, 1:51 p.m.
Signed-off-by: Daniel Kucera <daniel.kucera@gmail.com>
---
 libavformat/avio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer June 12, 2017, 10:31 a.m.
On Fri, Jun 09, 2017 at 03:51:30PM +0200, Daniel Kucera wrote:
> Signed-off-by: Daniel Kucera <daniel.kucera@gmail.com>
> ---
>  libavformat/avio.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

causes fate to infinte loop
for example fate-filter-volume

[...]
Daniel Kucera June 18, 2017, 6:50 p.m.
2017-06-12 12:31 GMT+02:00 Michael Niedermayer <michael@niedermayer.cc>:
> On Fri, Jun 09, 2017 at 03:51:30PM +0200, Daniel Kucera wrote:
>> Signed-off-by: Daniel Kucera <daniel.kucera@gmail.com>
>> ---
>>  libavformat/avio.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> causes fate to infinte loop
> for example fate-filter-volume
>

Please test on latest master. For me it passed.

S pozdravom / Best regards
Daniel Kucera.
Michael Niedermayer June 18, 2017, 10:18 p.m.
On Fri, Jun 09, 2017 at 03:51:30PM +0200, Daniel Kucera wrote:
> Signed-off-by: Daniel Kucera <daniel.kucera@gmail.com>
> ---
>  libavformat/avio.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

the commit mesage is too terse, it does not explain what
this change does.

Also breaks: (infinite loop)
./ffmpeg -i cache:matrixbench_mpeg2.mpg test.avi

if theres a dependancy on another patch, it should be mentioned in the
patch

Does this patch requires changes in protocols ?
If so did you (or someone else) review all protocols to identify which
need to be updated ?

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/avio.c b/libavformat/avio.c
index 1e79c9dd5c..d0cee42c39 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -393,8 +393,10 @@  static inline int retry_transfer_wrapper(URLContext *h, uint8_t *buf,
                 }
                 av_usleep(1000);
             }
-        } else if (ret < 1)
-            return (ret < 0 && ret != AVERROR_EOF) ? ret : len;
+        } else if (ret == AVERROR_EOF)
+            return len;
+        else if (ret < 0)
+            return ret;
         if (ret) {
             fast_retries = FFMAX(fast_retries, 2);
             wait_since = 0;