From patchwork Mon May 24 20:43:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 27939 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp3282915iof; Mon, 24 May 2021 13:50:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEfFe1zB6ghQdter92YivT4CoIW+HpwHYVveiV/KAZeKKXajmIW7i+8A3cBk4bnW1ffNEf X-Received: by 2002:a17:906:5d0c:: with SMTP id g12mr24975264ejt.447.1621889430986; Mon, 24 May 2021 13:50:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621889430; cv=none; d=google.com; s=arc-20160816; b=FDn5TWlQDBevjRXopfTRJVzmI54WkfOK0O5TYbqcRaeS+Z3RFhTRKJpKHH2SPMxsJX xtNPQ/2tuHn/2l8ZBAdTC3PDN9ttKVGjVfUzBgpoFc82GQLC9+jhP6+XeSNK7525RwyD rlS4XSlAB1QGgNfm9khCdM4iBGQfDWAkP7zfBD9Nr20mluRXovjTHefrd2hdd+QSi+RM VeodfLapXGKHBRgvrYRPYKJvKmPxiw92I531Y5qcWpiK9KNpQ7JvWT8smZwNVFU0Ozne RKRQ0QhIyfTa5BEl8hZo2ooxDgs5hLQH8pdrgDEH9PbyCy7hMYwdwnmYpf038x4qplEi nqMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to; bh=o/VkmwCd1Ig0Qfv2fxFV0544FQ0UnCCYir1onlCxXLY=; b=XZSmB70BCQsRhLgsNGYErXTaJjDpbzBrC+P4qRUaU+J+TanqFTu1Pu9SQzik65vy/6 u/vxS5xBFR2H8OJbdbmm+yTQDeehtC836d2/Fcglw4qoyilpZyELdw1S3V4MITyAJ0Ff B5tzHUgx+BQcsbygHocPJl5GsQ3LI2W6+eP1Zq0H9Soybkwhhgur3hHaoo92HQSrH97s 6Vuwop7eI6TzHQbD/bfutIx2J1HnR6zNJHIjuD5MRjdnkQD2K2U80BJi3IZfK8E7P5DD bxlMYeaBQcnxFhaDfguKlBJqSFE7YTVxZxjyx2bG7EYQ6LxCVp3dUUvZTg6M32lzTn6m 1n2A== 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 a14si6447089ejc.384.2021.05.24.13.50.30; Mon, 24 May 2021 13:50:30 -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 4C2C06899A7; Mon, 24 May 2021 23:50:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-1.mx.upcmail.net (vie01a-dmta-pe05-1.mx.upcmail.net [84.116.36.11]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B62E36805AE for ; Mon, 24 May 2021 23:50:20 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe05.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1llHRX-009Aaz-0I for ffmpeg-devel@ffmpeg.org; Mon, 24 May 2021 22:44:55 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id lHQZlSFVlljeHlHQZlDrcP; Mon, 24 May 2021 22:43:55 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=BoHjPrf5 c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=V2_XOquHJMyTEPFCslgA:9 a=pHzHmUro8NiASowvMSCR:22 a=Ew2E2A-JSTLzCXPT_086:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 24 May 2021 22:43:55 +0200 Message-Id: <20210524204355.6312-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210524204355.6312-1-michael@niedermayer.cc> References: <20210524204355.6312-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfPvsb+itwR+c7MJTpOYORLtlsiHqT50SQBAvEcbDU+/YH/ER0qdnORidlT3n8ZkSklqpG2J/iGd+jqiA8vDwXB3mN1cTtotmabErzc1VL4u+0LgKID2T 9lk4T+9jkDp5WAzxy8wuUJyxzfFyZSwyoXYvmbYotQ6peCDBO7Q0ohUC Subject: [FFmpeg-devel] [PATCH 2/2] avcdec: move setting decode_error_flags from h264 decoder to error concealment code 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: YQQmxGSfqzHR This should fix some minor race condition Untested (no testcase, the flag is not tested by fate) Signed-off-by: Michael Niedermayer --- libavcodec/error_resilience.c | 3 +++ libavcodec/h264dec.c | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index 68bc10ac31..e880efcc51 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -907,6 +907,9 @@ void ff_er_frame_end(ERContext *s) int is_intra_likely; int size = s->b8_stride * 2 * s->mb_height; + if (s->error_occurred && s->cur_pic.f) + s->cur_pic.f->decode_error_flags |= FF_DECODE_ERROR_DECODE_SLICES; + /* We do not support ER of field pictures yet, * though it should not crash if enabled. */ if (!s->avctx->error_concealment || !atomic_load(&s->error_count) || diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 38f8967265..05e46cb456 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -716,11 +716,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size) if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) goto end; - // set decode_error_flags to allow users to detect concealed decoding errors - if ((ret < 0 || h->slice_ctx->er.error_occurred) && h->cur_pic_ptr) { - h->cur_pic_ptr->f->decode_error_flags |= FF_DECODE_ERROR_DECODE_SLICES; - } - ret = 0; end: