From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 26A8D44A01 for ; Thu, 29 Sep 2022 18:12:10 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1827068BA85; Thu, 29 Sep 2022 21:12:08 +0300 (EEST) Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ED65B68B1B3 for ; Thu, 29 Sep 2022 21:12:01 +0300 (EEST) Received: by mail-pg1-f179.google.com with SMTP id u69so2147873pgd.2 for ; Thu, 29 Sep 2022 11:12:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=/xjRMyNMPm2JNenzIi9iza/5NyJevSejmYvC5Ii/iYA=; b=QqXuvZn/W7MrH0b+RM80ZBR2WukAU5OQWmQ+XFHFYNYTxFOveWEsTw6b1xd9oQai2h McK3owIq81lltCfAIl+pwURX+rP4qW19VQcNcWCabpeB8Xf9BZhQI1FBK+0kfr94xFFY +H+Oq+KdDBMZmuOqW9sSERNqk/q6kLxtEaL/Kt4ISLqzuCO4CiL1AUJgmhWAWWRl7390 dAjkA7L/T1nnG+Y4OfsmYmhomqr6fow83Bkp5UpY5TmrtXNIhf/Z59UsX2SVAdQrKRdT LJC40XiZfyiAi8Ou0PZHef63mN6Iqh1vZGZ1Lp1IMQFVqH4CuvtgUxMEENwjKEGc2/E4 zxxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=/xjRMyNMPm2JNenzIi9iza/5NyJevSejmYvC5Ii/iYA=; b=3lCs9SncP66rj0u9vsWPU8xwWfh0AuBvqkAx0//OlxxageVVNwxXEVzQGV+H+R4MJg Gm7xRIspLXW6tDeN6awnMxeV+2YlzX1yJ1XfXVqwBpQvitgn3z7cAkqTGKCitKxOjzr9 pTjU2Kjiyggoek6POJ0NfzLkymAQhBRloKpJ+H4xuxE5GsD8BjuLW0JHJfoG4h8klusw 254/t8wlCHWm0/FALMeyReGgFi0UjTOanb3PvHuM6W7B3mUeoWlKFoLO9lSb6wp1mQo+ K1ioJXhhEsHtQAZfHysHT2aBEGZLiIpMR6lpoRkVc+2VbGt4bWMU08uLBQ3iLs2poj14 9QaA== X-Gm-Message-State: ACrzQf3CfH4+Nm1vipc8pQ+zQy9bQRUwgb7YoGsbhQeGvHC4/hZVtHLP p1Al0+APPH08LoET8pi3vb6f0WEzLx8= X-Google-Smtp-Source: AMsMyM4UBXto24BULoDbJsqw6P34NvEs+JTVEB+5ZTiiANofPx/IYbwKaVXZD51KUTR4ELlfHiwTfg== X-Received: by 2002:a05:6a00:9a9:b0:541:787f:f2c with SMTP id u41-20020a056a0009a900b00541787f0f2cmr4827112pfg.12.1664475120048; Thu, 29 Sep 2022 11:12:00 -0700 (PDT) Received: from localhost.localdomain ([50.232.73.154]) by smtp.gmail.com with ESMTPSA id ik21-20020a170902ab1500b00176be23bbb3sm177000plb.172.2022.09.29.11.11.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 11:11:59 -0700 (PDT) From: Guangyu Sun X-Google-Original-From: Guangyu Sun To: ffmpeg-devel@ffmpeg.org Date: Thu, 29 Sep 2022 11:11:34 -0700 Message-Id: <20220929181134.93922-1-gsun@roblox.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <166437412231.22057.248171982435729520@lain.khirnov.net> References: <166437412231.22057.248171982435729520@lain.khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] lavf/async: Fix ring_write return value X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Guangyu Sun Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: his fixes a regression from commit 36117968ad. wrapped_url_read() used to be able to return positive number from ffurl_read(). It relies on the result to check if EOF is reached in async_buffer_task(). But FIFO callbacks must return 0 on success. This should be handled in ring_write() instead. Test case: ffmpeg -f lavfi -i testsrc -t 1 test.mp4 ffmpeg -i async:test.mp4 Signed-off-by: Guangyu Sun --- libavformat/async.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/async.c b/libavformat/async.c index 547417aa1e..3c6f89cab9 100644 --- a/libavformat/async.c +++ b/libavformat/async.c @@ -144,8 +144,14 @@ static int wrapped_url_read(void *src, void *dst, size_t *size) static int ring_write(RingBuffer *ring, URLContext *h, size_t size) { + int ret; + av_assert2(size <= ring_space(ring)); - return av_fifo_write_from_cb(ring->fifo, wrapped_url_read, h, &size); + ret = av_fifo_write_from_cb(ring->fifo, wrapped_url_read, h, &size); + if (ret < 0) + return ret; + + return size; } static int ring_size_of_read_back(RingBuffer *ring) -- 2.37.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".