This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit bf1722a9c6a6fcfeb7c35a47a3a1f4530402dcba
Author:     Niklas Haas <[email protected]>
AuthorDate: Fri Jan 23 10:43:24 2026 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Sat Feb 7 10:02:36 2026 +0000

    avformat/http: request more data after partial response
    
    If the Content-Range indicates a smaller range than what we expected,
    we should send a new request for the remainder before attempting to read
    more.
    
    Again, this commit is theoretically non-functional on its own, since any
    conforming HTTP server should give us the entire range we asked for in the
    first place, but it is semantically independent from and prepares us for the
    following changes.
---
 libavformat/http.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index 16da46a0e1..c78f33681e 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1711,6 +1711,8 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int 
size)
         uint64_t target_end = s->range_end ? s->range_end : file_end;
         if ((!s->willclose || s->chunksize == UINT64_MAX) && s->off >= 
file_end)
             return AVERROR_EOF;
+        if (s->off == target_end && target_end < file_end)
+            return AVERROR(EAGAIN); /* reached end of content range */
         len = ffurl_read(s->hd, buf, size);
         if ((!len || len == AVERROR_EOF) &&
             (!s->willclose || s->chunksize == UINT64_MAX) && s->off < 
target_end) {
@@ -1795,6 +1797,16 @@ static int http_read_stream(URLContext *h, uint8_t *buf, 
int size)
 
         if (read_ret == AVERROR_EXIT)
             break;
+        else if (read_ret == AVERROR(EAGAIN)) {
+            /* send new request for more data on existing connection */
+            AVDictionary *options = NULL;
+            if (s->willclose)
+                ffurl_closep(&s->hd);
+            read_ret = http_open_cnx(h, &options);
+            av_dict_free(&options);
+            if (read_ret == 0)
+                goto retry;
+        }
 
         if (h->is_streamed && !s->reconnect_streamed)
             break;
@@ -1824,6 +1836,7 @@ static int http_read_stream(URLContext *h, uint8_t *buf, 
int size)
             return read_ret;
         }
 
+retry:
         read_ret = http_buf_read(h, buf, size);
     }
 

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to