From patchwork Thu Jan 5 16:58:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 39880 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp226679pzb; Thu, 5 Jan 2023 00:59:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXt+2ZTTDE9HOJfo7SqNFgqv7URYOvIMpIb3KwmAnxmYtI9btJwtTKw6wDZH/5JR4EUCol4+ X-Received: by 2002:a17:906:3707:b0:828:76a3:e6bf with SMTP id d7-20020a170906370700b0082876a3e6bfmr54359056ejc.50.1672909155615; Thu, 05 Jan 2023 00:59:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672909155; cv=none; d=google.com; s=arc-20160816; b=U8fHK79uwcjmahCMddASw/FnItYkogee1EgY43e5cznruMrjXiyHeWncRWnBmCWeie K5yO2e8zV1aNp96KN+NP2nBM2BiSsLTn8uDry2ILu8qZBXBPmoEr8foy01mXWYFiGDkF x+gxUmFfiVxGriRcksTOEfSGOe7csQ4E4l/j0hxQ0yndZ0XVicNfZdP+0Lrgub5jmoJH Tar/sdRTlcDqs/9nVgT2xvKE4Tqy+mjwuo64Cls5EGhspnsAOzjMt5J120qXv9wRhOsr 2hOerY/9rmmxHT7Zob/+R2tEyeE3fRBVT1zFPIE5dQ7Hyadu97Ws2uKvMhO11wb8UOmH 3GDA== 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:mime-version:date:to:from:message-id :dkim-signature:delivered-to; bh=1X9DSgo8Kl44qt3sqXDKhn8L+zSN4/hd430HA0SL37Y=; b=tTrdqejsD5qBc1iPnU7kUmmticqrlXErChQB4apLb/UgAavWcgMWyi2n7IftZnvWsD ttlYozH3XKz0Y6a8xuqQFlEU2/HyPvFZRwgUszPojI4FfW3mJkhxbTHsiSPV8P+3B9js 3TH7SJqTY1Tu3xHsHs3B8BFQsCSqBMEAv2vno1ZW5ow1BFvmvPSEJmaABvDT2QALr/dx IFI2PNcxGJvwktsmNjTJxj6LtwSZ8BzFVz2tRNXbKSP/TojrwVFzw441OGZENDMODunM CjMeeF2VKbM6nKHEwVCIYIHQyY9qFIrk28PxkkNKVdrgfn9h4vShWNzpXe3oyciqqhSW r93g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=X3XHnP8q; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id xa4-20020a170906fd8400b0080b2de32a19si1858138ejb.457.2023.01.05.00.59.15; Thu, 05 Jan 2023 00:59:15 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=X3XHnP8q; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D0DA568BCC0; Thu, 5 Jan 2023 10:59:11 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out162-62-57-49.mail.qq.com (out162-62-57-49.mail.qq.com [162.62.57.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E7E0B68BBA3 for ; Thu, 5 Jan 2023 10:59:04 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1672909141; bh=mtjkNH4INKTHFOLuPl909wco+tBUrx29YeUXIAhnHD4=; h=From:To:Cc:Subject:Date; b=X3XHnP8qo+UeWZU2kd7qa9O9vuDpNWOwzG4oS4Alv/fNkMhD2zInkBzvaibrBTr7j C7Joc5a9JMVQlJGD7WvAddBvjAe10yhadofdXYTewm9QQXtuQrcyhVdcojH1vW94IZ ShlwuHe8Q23If5aDscvypLr85OTqjmgP4fGw9z5s= Received: from localhost.localdomain ([59.37.125.102]) by newxmesmtplogicsvrszc2-0.qq.com (NewEsmtp) with SMTP id EBBAEEF7; Thu, 05 Jan 2023 16:58:59 +0800 X-QQ-mid: xmsmtpt1672909139te8ck34x2 Message-ID: X-QQ-XMAILINFO: MW5hkHoBpWXyPmgmdpKVCrJ36ssNUaQEiIcx2X44K9VGy290ITg+ZI14unioBv QMCO+o42exx8cbYWH0R+TQFkSbYseka0t1Cegx1Sx5akDrjWacLQ5WjL/184msREiWoqt2bVi1af 5pBXS/+LkWnWn4NARx3SK3T+jLP8/j/RE75CPSyLww1ac3atNEczup2cT92gFkoHOnFGS9NSn7L1 eCrFKNvQ7YnqFLN089upB5WUoEqpJJgqGCd+latVo+O78RyXb4OfO5BoMsT4BMkYtmyicqlC5kYK 9LvuSObmSvXeTiMl6T9BYGrmSPLvJ95/ubg0/ZjQyJCioIZx/ixXsqkesSchE59n4JFEkl9KhpHb LpjFGZHOuCZ/LDTclKX1Yb2aga2sumnfVu7NrELVaPZXN7zLGCUqmc0L45LO+BMbB4zMCQ0TXu1v 3IQZYoOc+jYO1IGeZ6lWs97GwYz7rTHVYvnFYgndtv0eLSGefMWxd/Yg+22QNeIzeLY++IA60t4l xdYxNXM70HHtbTJhc2egkaUG30N1ZNuQKU4d4FKnNboqnCw8+GIV2gZlYd6mRojqaZ/yKqCriQ9W jo9Ag1lJ3AUeFupxAKxAZNl4MC4Apo0uz/rXxUCzXTSKzcHlvV0AClJcK3M3zNbz/U8/1trO2oeE I/axk5ONAHlpI9zZpUOR4ts7/g6EPkbE2HDY1XmyXP08Nws4QLsb59VpujeY1G585OQFE4F3I48C 3ONVk2lah+eYc9dIVozVUDB7yr3o3fRn/CbBpVGo3afmOzkj/AEnESgbmbRmcbfzFu9NH/zzITMR cfn4tpgNSCNGsSJvgKvNyb4cKGQzpV3DMDJmrCmg4TXeA1xLvqtyNSu4aNmQgFJdlDDbQna3+NIO hB+r6WD/osj79nhhehknv+zlJf7DsPYYezYtSnPsYwIOCelxSckRsNDeZVqhyMtS3vn9kZdlVtpo pKP4Q3QdjtDIhhVBmy6CMkS9rP/mJgXCM8wpkdG6w= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Fri, 6 Jan 2023 00:58:59 +0800 X-OQ-MSGID: <20230105165859.197343-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/mediacodecenc: enable B frames only with -strict experimental 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: fK6ZxgvPEemO From: Zhao Zhili Signed-off-by: Zhao Zhili --- libavcodec/mediacodecenc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index 4c1809093c..7a498f039e 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -276,8 +276,16 @@ static av_cold int mediacodec_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_DEBUG, "set level to 0x%x\n", s->level); ff_AMediaFormat_setInt32(format, "level", s->level); } - if (avctx->max_b_frames > 0) + if (avctx->max_b_frames > 0) { + if (avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { + av_log(avctx, AV_LOG_ERROR, + "Enable B frames will produce packets with no DTS. " + "Use -strict experimental to use it anyway.\n"); + ret = AVERROR(EINVAL); + goto bailout; + } ff_AMediaFormat_setInt32(format, "max-bframes", avctx->max_b_frames); + } if (s->pts_as_dts == -1) s->pts_as_dts = avctx->max_b_frames <= 0;