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

Git pushed a commit to branch master
in repository ffmpeg.

commit 1aa1ed142c246510abbb1f83c211a73dc1cd73f6
Author:     Romain Beauxis <[email protected]>
AuthorDate: Tue Aug 18 16:58:33 2026 -0500
Commit:     Romain Beauxis <[email protected]>
CommitDate: Fri Sep 25 16:04:08 2026 +0000

    avformat/libcurl: unpause the transfer on every read exit path
    
    Evaluating the unpause condition only on the data path leaves a paused
    transfer stalled whenever a read frees FIFO space without returning data.
    No such read exists yet; this prepares the path for ICY de-interleaving,
    which consumes framing bytes that are never handed to the caller.
---
 libavformat/libcurl.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/libavformat/libcurl.c b/libavformat/libcurl.c
index 2196e7913f..c4be36ff76 100644
--- a/libavformat/libcurl.c
+++ b/libavformat/libcurl.c
@@ -1098,23 +1098,17 @@ static int libcurl_read(URLContext *h, unsigned char 
*buf, int size)
 {
     CurlContext *c = h->priv_data;
     int nonblock = h->flags & AVIO_FLAG_NONBLOCK;
-    int ret;
+    int unpause, ret;
 
     pthread_mutex_lock(&c->mutex);
     while (1) {
         size_t avail = av_fifo_can_read(c->fifo);
 
         if (avail) {
-            int n = FFMIN(avail, (size_t)size);
-            int unpause;
-            av_fifo_read(c->fifo, buf, n);
-            /* Resume a paused transfer once the FIFO is at least half empty. 
*/
-            unpause = c->paused && av_fifo_can_write(c->fifo) * 2 >= 
c->buffer_size;
-            c->logical_pos += n;
-            pthread_mutex_unlock(&c->mutex);
-            if (unpause)
-                curl_dispatch(c->loop, CMD_UNPAUSE, c, 0, 0);
-            return n;
+            ret = FFMIN(avail, (size_t)size);
+            av_fifo_read(c->fifo, buf, ret);
+            c->logical_pos += ret;
+            break;
         }
         if (c->status) {
             ret = c->status;
@@ -1128,8 +1122,14 @@ static int libcurl_read(URLContext *h, unsigned char 
*buf, int size)
         /* Return to the avio layer so it can poll the interrupt callback. */
         nonblock = 1;
     }
+    /* Resume a paused transfer once the FIFO is at least half empty, on every
+     * exit path since a read is not guaranteed to drain anything. */
+    unpause = c->paused && av_fifo_can_write(c->fifo) * 2 >= c->buffer_size;
     pthread_mutex_unlock(&c->mutex);
 
+    if (unpause)
+        curl_dispatch(c->loop, CMD_UNPAUSE, c, 0, 0);
+
     return ret;
 }
 

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to