From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id B501140D63 for ; Thu, 30 Dec 2021 15:13:35 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5871468AFBA; Thu, 30 Dec 2021 17:13:33 +0200 (EET) Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3BB0268AE71 for ; Thu, 30 Dec 2021 17:13:27 +0200 (EET) Received: by mail-qt1-f171.google.com with SMTP id bp39so21652418qtb.6 for ; Thu, 30 Dec 2021 07:13:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=XnhjAu8czgt9ygTJIz6mqy1AHgewXHj2pjZLfjQNRkk=; b=Xqhk4Hl8wCqFDuNjVEtCNECiouUnuiMWZvBkNsSbfp9fOibQRTz1To7b5lg9S6FI0Z Ne3dPdStq/BtUl73HQmROH+UupmeBG1DOOFMUZaaIrLvgJByc+cpFszsBwu7wjFk2lvN 3q37NVklNF1JInh8DEJEUtkUR9DjdWFezai02PNoYi6eKxUf+H/vDfHWjDY8aSPE8Xze r8q/rwUaIFh1wj4RcXVUEpUyDZsUOVHluk/7b1ZFrMX5vtIuB91Gw5jWm5Ekvqqq5zVj 17yoqN5tx5mxTFVm5nkXxrtm+kO5A9dqTPDimxN3VtwSroaPyHyJh62dWsqCxlc+PJY9 d1xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=XnhjAu8czgt9ygTJIz6mqy1AHgewXHj2pjZLfjQNRkk=; b=NSyFu+e1ZgMttbkKx3ntsnZpapKOdPDj7409ODSbvIhKaEJUE57cfTCHcCq9Be8S5v C4beMVVQvC8UyCLe0Mj9uvHX62easxJRt1cGBESAiSgXxbYzlNEB6JL08ZNTU+C3q/Ob P4fBOjafnnaqPYYiSuiV/Qf0scQtcYnztuXgRnNJ2P9fFwRsCtxLgGD5mdG5gyfATHgN T05AEi20n6mGTGAsjNldEkpdy4MB6v2Lr2hAO7/x9U+VVbAhHFWF5vutA5cRSAFJANfg fAphE2mg4npyyKWllX9T0OY6C6ZL+6vE67PkIGvNTcJfT3GHn8qFllJvANUGKxt1ONIX X7Cg== X-Gm-Message-State: AOAM533ya1V5VVVXJlkWsZ/ilb9IXw+HR6YxmiZcRsunlhRUOcEhQKWa nnIGyUWNMyEXzBpAFMCt1qeVny8juj4O/Q== X-Google-Smtp-Source: ABdhPJysflSYADC6oh6o5Fol/QxrAd25tObuZwF2DIf3A7DLFd7qpQmgXdfAIUOrpZobcx7YPb25ww== X-Received: by 2002:ac8:46d8:: with SMTP id h24mr23005116qto.348.1640877205592; Thu, 30 Dec 2021 07:13:25 -0800 (PST) Received: from [192.168.0.13] ([181.170.250.138]) by smtp.gmail.com with ESMTPSA id f12sm19353933qkh.22.2021.12.30.07.13.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Dec 2021 07:13:24 -0800 (PST) Message-ID: <862f7804-b823-6537-9be0-fb0a3430d214@gmail.com> Date: Thu, 30 Dec 2021 12:13:22 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20211228134929.1164-1-h.leppkes@gmail.com> <20211230150816.500-1-h.leppkes@gmail.com> From: James Almer In-Reply-To: <20211230150816.500-1-h.leppkes@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH v2] hevcdec: skip slices with missing PPS instead of skipping the entire packet 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 12/30/2021 12:08 PM, Hendrik Leppkes wrote: > Aborting decoding of the entire packet on a missing PPS can result in > missing the actual PPS on streams with badly ordered NALs, where the > SPS/PPS/VPS are stitched to the back of the previous frame, instead of > the beginning of the next frame. > > Instead, skip the undecodable slice, and let the decoder process further > NALs in the same packet. > > If this happens on the first slice, the entire frame will be discarded > later, otherwise on other slices the decode error flag will be set to > indicate a missing/corrupt slice. > --- > libavcodec/hevcdec.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c > index 3aa70e2245..89381db240 100644 > --- a/libavcodec/hevcdec.c > +++ b/libavcodec/hevcdec.c > @@ -575,7 +575,9 @@ static int hls_slice_header(HEVCContext *s) > sh->pps_id = get_ue_golomb_long(gb); > if (sh->pps_id >= HEVC_MAX_PPS_COUNT || !s->ps.pps_list[sh->pps_id]) { > av_log(s->avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id); > - return AVERROR_INVALIDDATA; > + if (s->ref) > + s->ref->frame->decode_error_flags |= FF_DECODE_ERROR_DECODE_SLICES; Did you check frame threading decoding with tsan after this? Touching the output frame at this point could result in thread sync races. Maybe it's better to implement signaling slice decoding errors in a separate patch that properly stores such events internally in the per-thread context, then sets the flag in the output frame before returning, like it's done in h264. Like i said it's not a blocker for this fix, so it can be done later. > + return 1; // skip slice with missing PPS, allowing other NALs to be decoded > } > if (!sh->first_slice_in_pic_flag && > s->ps.pps != (HEVCPPS*)s->ps.pps_list[sh->pps_id]->data) { _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".