From patchwork Sat Nov 4 07:56:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 44521 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3aa6:b0:181:818d:5e7f with SMTP id d38csp336903pzh; Sat, 4 Nov 2023 02:24:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGyq9RG/JlyZIlFi8fcfn5BAmelzdJwTaCPMfOJxplx8mfA67yCg7E3ZQjh/tbleaDzCCsq X-Received: by 2002:a17:907:a0c9:b0:9be:2be:e6f5 with SMTP id hw9-20020a170907a0c900b009be02bee6f5mr8624852ejc.76.1699089897018; Sat, 04 Nov 2023 02:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699089897; cv=none; d=google.com; s=arc-20160816; b=qAqUmJg3CUQcAREKPn28UKYOgGXQM0YHqCjqHLyrvm8GKTfazA0ljzzCUQqbFkhGa+ Fxq4nQ9nEcLB9MLK6d8FuUovUlvlWNAHYm0PD9VBDMbLDjv1QwZdLRKsGn1jOD9+VBqn 4fs07VeW3XqIVK46cmALC4JFjVpx+KXdsUB8oQle+O8KQ7NyHgP8Jy8HRck3dwEu9EFh tipqL3ZU6GHq2bxKDmaf+LV2kzB+b1wfPRq3eP94ULGvApSJQ7U8pqRoZG6FYZS+pfKe z01/Ua2c78I4mO45H72rCWiAqvYOGgt5Il53nmhm9krxiy+3gAoczrRClRgtOtGGiy09 6+1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=NkcoY2iia9gqstTHCMVx8CBg+ieSoickgdSTwPJJZrE=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=D9ZGR1oJ2vo3obUXf17UyAy3MqMRzjr90VTe77+8XOODoXjXQeJ6QFPNJM28xnusmC DIrzEC6aAHGR9fJvu6MUt43aei0vvHQc9EaOlWJz5GMhg9gdAaLcMEc0k7XazwI6JUyT RG4Y6aEPPcUrNO572XMTl83yj9/s2CkUu3p0qcyfrxCjG2741d6u5fQPE6wMj5pwhgi0 JHjlu11OyWWMXp1DanqKRZSXkty4L684SaVzgEAD12TwFggAPHXo0DN42+cDHFCwVm9l F6WrX/DIkpGAcOjU9QmrjSuk8PjCPY6zZyMAoETysxyy10+erionItfH6ZU5blq79uL1 39VQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id wg8-20020a17090705c800b009c755eaa7c6si1989579ejb.538.2023.11.04.02.24.56; Sat, 04 Nov 2023 02:24:57 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 465CF68CEBC; Sat, 4 Nov 2023 11:22:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6F1AB68CE5A for ; Sat, 4 Nov 2023 11:21:55 +0200 (EET) Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id E8EBD1344 for ; Sat, 4 Nov 2023 10:21:52 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id iArkbLtQXASw for ; Sat, 4 Nov 2023 10:21:52 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id DF34013D4 for ; Sat, 4 Nov 2023 10:21:47 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 52DAC3A0E9B for ; Sat, 4 Nov 2023 10:21:40 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 4 Nov 2023 08:56:15 +0100 Message-ID: <20231104092125.10213-7-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231104092125.10213-1-anton@khirnov.net> References: <20231104092125.10213-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 06/24] fftools/thread_queue: count receive-finished streams as finished 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: y+ounoYtC0ZL This ensures that tq_receive() will always return EOF after all streams were receive-finished, even though the sending side might not have closed them yet. This may allow the receiver to avoid manually tracking which streams it has already closed. --- fftools/thread_queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/thread_queue.c b/fftools/thread_queue.c index feac6a7748..fd73cc0a9b 100644 --- a/fftools/thread_queue.c +++ b/fftools/thread_queue.c @@ -177,7 +177,7 @@ static int receive_locked(ThreadQueue *tq, int *stream_idx, } for (unsigned int i = 0; i < tq->nb_streams; i++) { - if (!(tq->finished[i] & FINISHED_SEND)) + if (!tq->finished[i]) continue; /* return EOF to the consumer at most once for each stream */