From patchwork Mon Sep 16 04:26:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wang X-Patchwork-Id: 51612 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:9fc3:0:b0:48e:c0f8:d0de with SMTP id k3csp1050392vqy; Sun, 15 Sep 2024 21:26:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUhxt/QIHYTlhUsCEer7/YTFoKXRe4ri/QT6ZWQ+Kc3UgiEhAP1jZN1dY6B+X8w+O+F3qyJ2HKijqqutrDMM4Ek@gmail.com X-Google-Smtp-Source: AGHT+IGIruEi7eTveZWnR+K/jy/Uo5S+q20U7fpSU2oaEbekBdgXii+dG70XPYwHQtZ+0lyEmbwQ X-Received: by 2002:a05:6512:224f:b0:52f:e5:3765 with SMTP id 2adb3069b0e04-53678fec44fmr2001751e87.6.1726460806568; Sun, 15 Sep 2024 21:26:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726460806; cv=none; d=google.com; s=arc-20240605; b=Sr7jBbZo3tli+WcqYp1tdhYFvbkHwK95OPc6+hn2tPZFddbCBjQaLC/D28cgf+5grH YdqBFajIzDkJZhz/nBT9DKrrOt18ghxqZSF3ls89yAs4ynZ98NDlfRB+73hlzOWgzdy3 cc+x6OFMHOn0fDH3MoRdoz/f4dyBqbxYcRwpAqA/dKFoQcqGQ/YSNR+aSifGYOJ7JTjD ty8zlwW3z2P/vklvgwzK56kteNKaAuiIz8QNlaK3rpTuQ6h284ZW9S/3K4exqaZl0/PT hNRO5Cz397WX4Bzk45nT42sis4GHzuu3NJZDZvqqGT1giqjHIJuSjV79seWi5JNn/frv QBBQ== 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=dxbJOE4V4+6Ru0DNDJor0Twq+JwewJhY2TxJk0gTIYw=; fh=4yZsIQoPJJREUPwTmtp9+mZwIGSD2GAqdTM0lnjqQjI=; b=jJaYXs07Xa8VQXBegyss5Jl/X/kSCoB09hu249efq93LGOzvArBB5uXkoXG6C9dBMr rwiZOYrAxygJJd4oB+R0fztLDI+qBKHHBUM5JO5BO2aNcdMrTylzrFr7Pk0iJz/656zD zyJtph3ha4EHxZuHDTkLLyBNHM9r7hX/WNDLMuAvED9nt7iVcCoO0tlXSfZVOwxtS/py 7EECtNmk4IpZKNtS5xxZzjh6pguxRyfRjipMuh7oC5SPddOMPODtR2IO+AMLjxvcLpw4 mbEZMH0UPkRIQUg6jyJtQulhqha6aCZpyyoWhKPFgAZhse3JPPLFPm1yBrHQSIp8R06c fMBw==; 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=b55UswgO; 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 2adb3069b0e04-5368709dd2dsi1517435e87.328.2024.09.15.21.26.46; Sun, 15 Sep 2024 21:26:46 -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=b55UswgO; 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 2C33268D57B; Mon, 16 Sep 2024 07:26:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 35B1A68D169 for ; Mon, 16 Sep 2024 07:26:36 +0300 (EEST) Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-7a99e8c32c0so438303785a.3 for ; Sun, 15 Sep 2024 21:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726460795; x=1727065595; darn=ffmpeg.org; h=cc:to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=za9rtShT4wzFGtgDWnTlFd+/axkhzASRHSphKJdODas=; b=b55UswgOr3TP7FNeL64lgS5IIQkXio7x8QSCWVVRsqGr5jrnirS4npfwxAIsw7wzpt N9BkPbuQQEnbYVwUirtShUEv24k/v9fLS3riZdCKt27DAqE7lMvi460sDt+RfaQU278C Wh+misYwzmCrnFQ+XY2X/a4OCc3+C2fht+3NqyphisQtKEUo9cLo4YjoMKt0J+Cxk6Lq vgRuktJJC6+J+6yKMkBJjG7cIUtbK+qv7me0pDBPoCUJ8DnDRiZur8+g1dAvTQ50aery 9jEIxncNAzY1vppmQnlrIhsrLchb+FWzr8S2ZJ1l1F0T/YYHi91A589DiKv6TBlR/lsm xN5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726460795; x=1727065595; h=cc:to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=za9rtShT4wzFGtgDWnTlFd+/axkhzASRHSphKJdODas=; b=rotyyN9eaRld2kZfR/GQhL5/InBO/r1LdHJ1Aha9v44xakU5tW5fMf76tN29C/z+FH zOpPcTeoMJIppr+BjYy7TBQ98Mr7xDWHKeT2wuV9iTmRiWQhZPWqZxIKeG7uZKB2Qcl8 1BogQ0mTMAKB8bERjzM23TYdELTgqjOwgrJ2SWxUF1N4sjIKDMPHzDpBeUYfW6cI1e24 kAeWhr/T5yKNZyyj7+s4DU9kcoe6YhXSCfVpg1qGdpjP0dtmf7azOMe+0yseo40ziICt GLoOx+7p9a3AYefJTb6CjsqOYpxTqO6igPwnjX/37CEbFi0Kj5ISElwaJYgc8gGL03fV EaDw== X-Gm-Message-State: AOJu0Yy7PkngTpLW4lAqtR8J+Y9g91V68iAwIl/mCkTy8JFeibuB/OzO 1HrHoWd++PgLnf6FcT+1gsplnKwP4KYDlrVOt3wn/xtFTmjsex3Rc6olWrIjOfnti0etvWb4vSm sB0z5atkWDp1S2jrP//dlwGyqwBUyGw== X-Received: by 2002:a05:620a:28d2:b0:7a5:27e:8814 with SMTP id af79cd13be357-7a9e5f5ef8amr2407333085a.44.1726460794606; Sun, 15 Sep 2024 21:26:34 -0700 (PDT) Received: from 272419586516 named unknown by gmailapi.google.com with HTTPREST; Sun, 15 Sep 2024 23:26:34 -0500 From: Kevin Wang X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Date: Sun, 15 Sep 2024 23:26:34 -0500 Message-ID: To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v3] 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: +1nWOtZDPxaZ 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. --- Reformat with more lines so the patch is better. libavcodec/h264_slice.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) out_of_order = out->poc < h->next_outputed_poc; diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index a66b75ca80..ddecd152a7 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1341,7 +1341,10 @@ 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)))) h->next_outputed_poc = INT_MIN;