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 8C0BF4B4BB for ; Fri, 7 Jun 2024 13:09:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C7B8A68D853; Fri, 7 Jun 2024 16:04:28 +0300 (EEST) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 29E0968D77C for ; Fri, 7 Jun 2024 16:03:52 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=EJ/I6N1y; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id E30B84D42 for ; Fri, 7 Jun 2024 15:03:51 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id K32mf7tEP44n for ; Fri, 7 Jun 2024 15:03:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1717765422; bh=wm84nk7UxLUOBxkogvND6S1mJQmEqoT07KDff0HLnZc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EJ/I6N1yTFPkvCh2EgzSDQrpzFl0PX4j9W/0YgEroi/xXUFWHT9HwNg61h7mLNQEk OiXpghYzfSO+kGH2zEzgtLJ5b0ZQA9LSaqNLa7SwreSmTvqqWG3gAe7YngHhOb0lZe k7aZsgTL4VNfUpDb2gE4N+uJ/zPp/CGSvWvc81D121+DxGjsGETilwqtwekxTQRN7P 9tRtszamZ2jrc+FZE5xibofep9pMp9TLC6bd689gHABfLSeDm9LVQulv5Nd5jPrjNl GBWSPMDJZOE3FPVHr3VbCxjl0R3pMiz1ICj9erg+xmCqzGHtqvmo5i2HsWGEsW6/Kz b8eA0afwpNeqg== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id E98E14DFA for ; Fri, 7 Jun 2024 15:03:42 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id E5E443A1EA0 for ; Fri, 07 Jun 2024 15:03:35 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 7 Jun 2024 15:01:30 +0200 Message-ID: <20240607130135.9088-34-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240607130135.9088-1-anton@khirnov.net> References: <20240607130135.9088-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 34/39] lavc/hevcdec: move the check for multiple frames in a 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-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: Do not do it in hls_slice_header(), which is the wrong place for it. Avoids special magic return value of 1 in that function. The comment mentioning potential corrupted state is no longer relevant, as hls_slice_header() modifies no state beyond SliceHeader, which will only get used for a valid frame. --- libavcodec/hevc/hevcdec.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 2809e1e61d..a241e25196 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -598,10 +598,6 @@ static int hls_slice_header(SliceHeader *sh, const HEVCContext *s, GetBitContext // Coded parameters sh->first_slice_in_pic_flag = get_bits1(gb); - if (s->cur_frame && sh->first_slice_in_pic_flag) { - av_log(s->avctx, AV_LOG_ERROR, "Two slices reporting being the first in the same frame.\n"); - return 1; // This slice will be skipped later, do not corrupt state - } sh->no_output_of_prior_pics_flag = 0; if (IS_IRAP(s)) @@ -3131,10 +3127,6 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) ret = hls_slice_header(&s->sh, s, &gb); if (ret < 0) return ret; - if (ret == 1) { - ret = AVERROR_INVALIDDATA; - goto fail; - } if ((s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) || (s->avctx->skip_frame >= AVDISCARD_NONINTRA && s->sh.slice_type != HEVC_SLICE_I) || @@ -3145,6 +3137,12 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) } if (s->sh.first_slice_in_pic_flag) { + if (s->cur_frame) { + av_log(s->avctx, AV_LOG_ERROR, "Two slices reporting being the first in the same frame.\n"); + ret = AVERROR_INVALIDDATA; + goto fail; + } + s->overlap ++; ret = hevc_frame_start(s); if (ret < 0) -- 2.43.0 _______________________________________________ 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".