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 A87A440D79 for ; Thu, 30 Dec 2021 15:31:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 01DF268AFED; Thu, 30 Dec 2021 17:31:38 +0200 (EET) Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2706068AED4 for ; Thu, 30 Dec 2021 17:31:31 +0200 (EET) Received: by mail-qv1-f50.google.com with SMTP id a9so22358654qvd.12 for ; Thu, 30 Dec 2021 07:31:31 -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=+3B0bPk0pNRO7usMsE0bwYPNBvwFLj2d/8vFd6pM9VU=; b=nGnPwMbqlpqaNh8Iflwz2s8tgZNI0nx+olnbYDXxL47qrzM77fSWxJ8YDJD6K587KU RZ7xsMHMfGIT4TelBbgih+CZbFxAByUgCnzLmZLQXLn8zpHl+02vDvTzwF9ounfDIffA PLFpAZmF7WduS//meIdqS/TvdntxBFyqCoo1z92/JdWcP09wFFY5MZVMpbkxJl1WaOqu 38WHBeQaC3Tr6v2xUImPQTnZbN5h/UdBaP/zfL4xMwjJLE0+btWlUAsSF4lt3ec9rO1p miNByp3NbGWNvpFVohCGZ0AS6UDQK+ybwmXyeuwyrYNJwAnkeWXqn/T9QVmsTjOiYyOg 2K2Q== 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=+3B0bPk0pNRO7usMsE0bwYPNBvwFLj2d/8vFd6pM9VU=; b=ooWbKaCIrc+6KFVuim9ukZy0zVTYIs4LM/N2gpkNTlckyKU2iaj2xdhlv0cwaSAmRt q+hxIWut3gCgdgmBPpeUbxSTJsK7XxrUd/Xga9klhpMkaKuVxJGWh+CbjhcPtFUMkQUm b3dbnckb/sC82b9yUCr+b7gDIhFRIln1VmbYSRRRGCBm594YNHOX+54DPnqUw3lJpQ7a PFU+kyMwiIct0TYXOo/V7U4ufRzLJZIBL7J87Ooq7ZbxFJJ5QKsFvvHX7C7jTP9r//oF Kxf0dY+u4CEwsQwlCKzGxaoVcNId/v9JVpGyXtNT7vaXXZWc3GlxiNDUrA+GcMQ6KNUh wmtQ== X-Gm-Message-State: AOAM531tNup6v2sGEm1l45AtAG8RLtd5VAM9lKknTET7AunO1VaoKvWc 9vnPUBE+WfVn3JGSI0/IWf/erYo51yw8Mw== X-Google-Smtp-Source: ABdhPJy0XgK79Z0NPgruxPxPf8CHWIvMxNN9TF5N/3jRuKmPtYz8SbTPmEXVhQu7kyjhMEnCWmHZ3w== X-Received: by 2002:ad4:5b87:: with SMTP id 7mr27132217qvp.23.1640878289382; Thu, 30 Dec 2021 07:31:29 -0800 (PST) Received: from [192.168.0.13] ([181.170.250.138]) by smtp.gmail.com with ESMTPSA id d1sm19122747qtn.56.2021.12.30.07.31.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Dec 2021 07:31:29 -0800 (PST) Message-ID: <80c0c399-42f3-4c5e-c1c3-c4433635afb6@gmail.com> Date: Thu, 30 Dec 2021 12:31:27 -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> <862f7804-b823-6537-9be0-fb0a3430d214@gmail.com> From: James Almer In-Reply-To: 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:26 PM, Hendrik Leppkes wrote: > On Thu, Dec 30, 2021 at 4:13 PM James Almer wrote: >> >> >> >> 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. >> > > As far as I can tell, there is no threading issues here. There is no > slice-threading here (only through wave-front parallel processing, > which comes later), and no other thread would ever read or write the > error field. The HEVCContext "s" is per-thread, and s->ref is accessed > quite freely by the surrounding code. Ok, s->ref doesn't seem to be touched by hevc_update_thread_context(), so i guess it's fine. > But I can take it out if there is any remaining concern. In reality, > its quite likely that the entire frame is undecodable in this scenario > anyway, and the change is only to possibly recover decoding of future > frames - not partially decode this one, although that might be a bonus > in some rare cases. > > - Hendrik > _______________________________________________ > 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". _______________________________________________ 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".