]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/concat.c
Merge commit '5352802da81f2083e65d466612e639a4e6e5530e'
[ffmpeg] / libavformat / concat.c
index 46b520fe8044364d770b34561eac3f66dc29c78c..19c83c309acff167459902552e842da2707b4a10 100644 (file)
@@ -135,19 +135,20 @@ static int concat_read(URLContext *h, unsigned char *buf, int size)
 
     while (size > 0) {
         result = ffurl_read(nodes[i].uc, buf, size);
-        if (result < 0)
-            return total ? total : result;
-        if (!result) {
+        if (result == AVERROR_EOF) {
             if (i + 1 == data->length ||
                 ffurl_seek(nodes[++i].uc, 0, SEEK_SET) < 0)
                 break;
+            result = 0;
         }
+        if (result < 0)
+            return total ? total : result;
         total += result;
         buf   += result;
         size  -= result;
     }
     data->current = i;
-    return total;
+    return total ? total : result;
 }
 
 static int64_t concat_seek(URLContext *h, int64_t pos, int whence)