From patchwork Sat Sep 18 01:51:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 30324 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp2733219iov; Fri, 17 Sep 2021 18:52:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCWIhxdmVPQwhkSvLO61SMk5lfLapGGDNStc65xVTQLMBg36FbuWRTwBzoAYUfCttbRkMH X-Received: by 2002:a05:6402:358a:: with SMTP id y10mr15751295edc.238.1631929921145; Fri, 17 Sep 2021 18:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631929921; cv=none; d=google.com; s=arc-20160816; b=ZpUD2mGNscUY5sHuUuglaBqn+JiZ1O72Ce/Yi7TmRM0Yz2R6nOhYrhdUAOb1/Vx4QV Rjx9X25DR/VmPfbh6gVtXP9ujD954TxKghSzrrahFKrEfmrXVjKBWHNnabAL8DqVc6wt Fm7mV1RwCJZkb/UXATwCOWpvKGhQ2MccNQsRkRQZmsV11H7yt19/vu8w3eaU5lgJIQpx W1w9homPdY47/Xb+HmpEY7parIA2ItzuD8kf9ZJTjdupGE3HhkevMc6bLmpjHIQT6IaX 1fzCNgpsgUeTujJi2YhOKOSGTERMkMSBnC640F6iDMQ54IWAJrC5EHksGwhqterdh4Fd ilLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:mime-version:references :in-reply-to:message-id:date:to:from:delivered-to; bh=tDOH7axNHyw+50mJV9oIlyUI5GtM800b3J6eh3qSETk=; b=uFrGL8T6QMAsn5repavbVeu9gsHwg6o5rad3xl0oisB1bRuMpq9nBj31xTAHNf4zhi io7379/7qml8Z4UbyNYaG6hfm1GmRDuL3Mi5KNox2I4QhZTpHdSjjTFLw0JUB9bXYo+4 rT3HLig5tyhdcRjMcwVNCI+HAfHe7Oo4ATIWRTiahxesOLoFne0kFYfMp5djF3ivaB8B JrfmYidAxFqhvVquhObuuXyJi/SA/Urf982TvJelGXTWXJ6V0ALVHmfx851MdPgDcilW yHZFduHxkgoHqkpLvSqJsbnMbe0PgEqkmhwB1ZaPBAOuaj+WmFYX+LzVPI4yLrbHexFr JCvw== 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 l4si12175782edj.282.2021.09.17.18.51.58; Fri, 17 Sep 2021 18:52:01 -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 CE22B68A9AD; Sat, 18 Sep 2021 04:51:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbg587.qq.com (smtpbg128.qq.com [106.55.201.39]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B457B68AA54 for ; Sat, 18 Sep 2021 04:51:47 +0300 (EEST) X-QQ-mid: bizesmtp32t1631929900teod12xq Received: from localhost (unknown [103.107.216.230]) by esmtp6.qq.com (ESMTP) with id ; Sat, 18 Sep 2021 09:51:39 +0800 (CST) X-QQ-SSF: 01100000002000Z0Z000B00A0000000 X-QQ-FEAT: nx2cVdQuNQ3ty7DLI01i48k+GLUcAauTj0rViEu/5eVfFpy88A5i2gysMrJq0 rWBaTN78tc/VG8eebpqn/6zrG7aj05HryWTTP+CyDcBIVm8iYFh0iEirx2DYRqNx8sLFt0O pP+JO9T8QUUBUJDU5bPrfROvX8GlhCd6tUepw3BTyZNDuggVa7Jczj3JrDkRVPO0ln3UT7x miEtlmVh38ss1N3TQERwbnz/ZK2PaODVTUMPsqP0ZxlA192HAcKlxj58VX9Yg5mes+S7zfx M5kCeIXycTBvOQvqgXxqMLhqfse8ZIx75nLJjgkYAq9bkssaPqUbd0Owc= X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Sat, 18 Sep 2021 09:51:37 +0800 Message-Id: <20210918015137.18968-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgspam:qybgspam5 Subject: [FFmpeg-devel] [PATCH v2] avdevice/avfoundation: continue to try get packet if not in observed_quit mode 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: Steven Liu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 1G2uggIDoa5g Test environment: Darwin liuqi05.local 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64 Big Sur 11.4 (20F71) before patch: ./ffmpeg -f avfoundation -i ":0" -y out.wav say something to microphone ffplay out.wav will get noise. look the into the code, it will return EAGAIN when transport control observation is not ctx->observed_quit. after patch: ./ffmpeg -f avfoundation -i ":0" -y out.wav say something to microphone ffplay out.wav will ok. Signed-off-by: Steven Liu --- libavdevice/avfoundation.m | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index 0cd6e646d5..cd30f48cfe 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -1186,8 +1186,6 @@ static int avf_read_packet(AVFormatContext *s, AVPacket *pkt) unlock_frames(ctx); if (ctx->observed_quit) { return AVERROR_EOF; - } else { - return AVERROR(EAGAIN); } }