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 B6FAB40D59 for ; Thu, 30 Dec 2021 15:08:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C3A9B68AF2D; Thu, 30 Dec 2021 17:08:42 +0200 (EET) Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5C30268A8F5 for ; Thu, 30 Dec 2021 17:08:36 +0200 (EET) Received: by mail-ed1-f45.google.com with SMTP id w16so99190697edc.11 for ; Thu, 30 Dec 2021 07:08:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YGiPHgQ8S8GP5GmnONu61yaGv10SJQA8soooI4l9lIQ=; b=BH2yUx/aQL+RO0AnQWSG0sB5ofdla0zgnARrkypldZ5nHP+RF5R50THwCw8ZorGgKx 4RHfD+dgWmOQxljpOa3VcoHyv67u/YwqLzp8KJCc1ZGazpsEeHNyJbubsVFWeKDapD87 bT0Tvh2Urt9R1GPzIKAxkiN4gaper9liflIUHLQgP92h4UFvfhlekEC78OMV8Fz63jEE VPoE1zVJNIzXWUVh43x/b2gT5cmjtSQd0nGUJXBH6XogE2IXXLB9Gzs+epB+t5v0OETR kg+XY0VlULMcy1/eMh+n9Wx9CuptgXjW1IdGM/WyTBI55ZgnLwZ4ddIoOPlBJOooAMXA uJDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YGiPHgQ8S8GP5GmnONu61yaGv10SJQA8soooI4l9lIQ=; b=frOAo6NiUY1034sxJ1GObB5xSe+B0mxAoYp+k82ZrhmaRaGlzDuMe6fk1x0TN6o64i kdltyCx8X+GPF4DlEeXHa/3pu8j6Bffoddm9tAsMjHJEGJ0SQ5eioIl7Lu3z1Uztk5Hc MnTK9JJDB6HSGWNpr4e5pYWy1gteMviovlQEhzpxDfIBd1Q8pLr3JwOW0e9rAH3ZvC/w O7k+nGGb3Ae5NR7kesrDA6IPvlZ2SZsps1wVeNChUK4IRRjQxfyM43k7u+l02extwHOT UuN8Zb8GYNSLdb2PNzoGSFMpq+mlRNED65/PR09hMBcExUvcfqOHNDAyVT9/cHB3nm5K +gbQ== X-Gm-Message-State: AOAM532mE1NhnG/0vp0Y6IVDxUnGJoK9YNwkDCJjOyTgiFM8jwa3CEUd LTvbqbkXl7SBXCHEcxujmsFkoj1JfWA= X-Google-Smtp-Source: ABdhPJxedeFbsqjqW6LVl7vlWYxRs8qeTZYV/PvW0IKU4SH2h4SgMJzEz+fGboc5hZAUW3yQOpG3AQ== X-Received: by 2002:a05:6402:2031:: with SMTP id ay17mr31153740edb.182.1640876915566; Thu, 30 Dec 2021 07:08:35 -0800 (PST) Received: from localhost.localdomain (p200300ccf7135a000c71ac01fe98e4d0.dip0.t-ipconnect.de. [2003:cc:f713:5a00:c71:ac01:fe98:e4d0]) by smtp.gmail.com with ESMTPSA id z26sm9506785edr.11.2021.12.30.07.08.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Dec 2021 07:08:34 -0800 (PST) From: Hendrik Leppkes To: ffmpeg-devel@ffmpeg.org Date: Thu, 30 Dec 2021 16:08:16 +0100 Message-Id: <20211230150816.500-1-h.leppkes@gmail.com> X-Mailer: git-send-email 2.33.0.windows.2 In-Reply-To: <20211228134929.1164-1-h.leppkes@gmail.com> References: <20211228134929.1164-1-h.leppkes@gmail.com> MIME-Version: 1.0 Subject: [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 Cc: Hendrik Leppkes Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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; + 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) { -- 2.33.0.windows.2 _______________________________________________ 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".