From patchwork Mon Sep 16 03:56:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wang X-Patchwork-Id: 51611 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:9fc3:0:b0:48e:c0f8:d0de with SMTP id k3csp1042785vqy; Sun, 15 Sep 2024 20:57:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXPLtO310OGzlD9Sp2KYf4F9u36cK10sVoKrf02vHGqn/jlUbFwxl1jxpC3Aoo35IVyuQUI3aBmqZ96e91tMw+G@gmail.com X-Google-Smtp-Source: AGHT+IENgJ2mcq5vMOcN0m92SFu6iBRx0Tu/u9gSZTrONvk71SckO8wEf9jt9kiyiOlPDFoAepPA X-Received: by 2002:a05:6402:3590:b0:5c4:2b0f:fef7 with SMTP id 4fb4d7f45d1cf-5c42b1001eemr6673967a12.4.1726459022882; Sun, 15 Sep 2024 20:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726459022; cv=none; d=google.com; s=arc-20240605; b=HFtTFfP27buesRsaBtKqJlAi+NsYKpTrcJyJm/1FVBYhPW8KKKsHASs+h85juIlQ9V Pwr6xCVrtbfmQ36AaeagFXOR5RF7YEYI+UdxZKAJ9ie1IN0V9i7r5JGzg53vofDVx3RP leDT2efdyJgop7hoxDWfb0XkqDCyGMAo7Fv5v6S2G3oadA7FOosRoLWmYfKSxjIU5H89 oAJcljrREu18D7UcPXgp43kcPax/n8maKxS0xQKes2LIvtfUNYu0oobU8X0YC01ZcH7w Mi/1S52DPiWqiETPssHiFgvgJlOXdRTi/VgfluVX8bokOl7cklfM7S+E3Hhaf7Fq/MYH Q31A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:to:message-id:date:mime-version:from :dkim-signature:delivered-to; bh=BSSWCbZ/Ef+y0xaxex9QhM7WcT7eokAVX9Gype4RifM=; fh=4yZsIQoPJJREUPwTmtp9+mZwIGSD2GAqdTM0lnjqQjI=; b=UAStGfbQCbK7sVQZx0iOvojJRS9TO5InH83BUrQ8qibH+s+BOJvFFfuK9M3bWN/y7c 1pxIVsAiim72mTEjaalkP4rb9mgcYP+C0gjXwaFvusL0g/stqI95VVFgYO99DvfPSc8H AQhkosYOwVryTnA+5sf8wgWyVFVv9ThNQrSR2y8q6ozy9TJpNq1kf5MJpnXB4/b45asL gimI1I1wlD74reej0P4UaOTjiC0ByztaatS7l2vnIbSx5zR4WOoUSDWY6dnAYR9emHZl lNhpQerjO/09Tz1hYrbBIhNlzQW04s5uD671v9gu3ErAWAzbQgEtdMBo4xbVyHm5vs8v jbiA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=EN9S6SY3; 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=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5c42bc903c0si2935029a12.383.2024.09.15.20.57.02; Sun, 15 Sep 2024 20:57:02 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=EN9S6SY3; 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=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7155868DC5C; Mon, 16 Sep 2024 06:56:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0DFD968D849 for ; Mon, 16 Sep 2024 06:56:52 +0300 (EEST) Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-7a9ac0092d9so111040485a.1 for ; Sun, 15 Sep 2024 20:56:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726459010; x=1727063810; darn=ffmpeg.org; h=cc:to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=DBT+dYmR/oUjL/zPYVOv3R2VNe0v3cSs++4O3Gj49uU=; b=EN9S6SY3fOczWGFOWwCvC4tUicJOoTD6NkuDcy9zbodOP06QBZ4gBwoAOnttr/UVFK Ftlo/nf8UFNy0ybIQ4Tp764dZO1qklui2mWJBwJzCPur1twLrFocNNOp21CFdcpK4tuZ clIJ3TztOWRuocVGumGpF5uPRk0M8BIDBnvb4tK7mmMG/nASlwizFHcfTb765j2D3Lex d4r8C3faoxEW8Z9EH66+x4D7tV2820Qox2gSXYIw8s/jAgmtYA5MyoOm1/Cr3iLeTAMa HU0NM1COZFhEgvZqaD0D2duoE6M7EgOp+3S0SjqpFDnYeEc9KaT2j6hQRwKGh8aSEt39 u5Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726459010; x=1727063810; h=cc:to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=DBT+dYmR/oUjL/zPYVOv3R2VNe0v3cSs++4O3Gj49uU=; b=DF+BTUvDOEfEWCePwOMKMP1IJQf+79fTelZ/lYvRzHFNPXOoie7VWeDskOxif/Ydbd 2sfiQH6+xYzd8Ik/IRoInTRVaEjIL0p9QzU4GVH7JLbHt62shCwIxKcuVu6/etDtW5DO 53cyrY7mpMcSm15z01TO93lBN7G+dcLcf0nNBDd/4Bo5h0wX6JJAiWomy7l0JttFc7h+ C151o/JvCuPTPlO8mszVUHYg7EdZ1+pgaB2jj9Hpz98gOIxtavrQayEIbjM6Z9pUcNaC Y0yGMoqKdVOcsSacDPbX/RF2U25ChvR4H/A7RLFiI8KHQQr35ku9AihHVl8e2cRnPMPo xyUA== X-Gm-Message-State: AOJu0YxG4YNqeExWPpvrtwSP+ljjEs90Z/ajAK/zzeo0JYFNxn+RLHyM 6U/71dm9Ul+DD8VwEd5zc2klqew3T5wwD5otUwqMgv7M4VMQidKlwdwNfYgb7fN2sb9LtdLWHI1 h3QhG2dy8xcNzeavJnnKWBafiwG+48g== X-Received: by 2002:a05:620a:40d2:b0:7a9:c0b8:9343 with SMTP id af79cd13be357-7ab30d34a64mr1441932885a.31.1726459010390; Sun, 15 Sep 2024 20:56:50 -0700 (PDT) Received: from 272419586516 named unknown by gmailapi.google.com with HTTPREST; Sun, 15 Sep 2024 20:56:49 -0700 From: Kevin Wang X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Date: Sun, 15 Sep 2024 20:56:49 -0700 Message-ID: To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v2] avcodec/h264: ignore POC when flag is set 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: Kevin Wang Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: aO/9E9MVkKne When the flag AV_CODEC_FLAG_OUTPUT_CORRUPT or AV_CODEC_FLAG2_SHOW_ALL is set, ignore any out of order POC's as they may still be valid frames. --- Fixes the patch formatting. libavcodec/h264_slice.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) h->next_outputed_poc = INT_MIN; out_of_order = out->poc < h->next_outputed_poc; diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index a66b75ca80..fc5a829755 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1341,7 +1341,8 @@ static int h264_select_output_frame(H264Context *h) out_idx = i; } if (h->avctx->has_b_frames == 0 && - ((h->delayed_pic[0]->f->flags & AV_FRAME_FLAG_KEY) || h->delayed_pic[0]->mmco_reset)) + // Check if we should ignore the output order and output the frame + ((h->delayed_pic[0]->f->flags & AV_FRAME_FLAG_KEY) || h->delayed_pic[0]->mmco_reset || h->avctx->flags & (AV_CODEC_FLAG_OUTPUT_CORRUPT | AV_CODEC_FLAG2_SHOW_ALL)))