From patchwork Mon Jan 24 17:00:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 33801 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:e71a:0:0:0:0:0 with SMTP id b26csp495295ioh; Mon, 24 Jan 2022 09:01:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyDXMfU1DqoiLxU9kwXVM7BvB/MaUviUIQ7sd+Qy4CJdWTHEu5yTM0mqARgv9//dWo3zN0H X-Received: by 2002:a17:906:58c8:: with SMTP id e8mr12875062ejs.444.1643043675034; Mon, 24 Jan 2022 09:01:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643043675; cv=none; d=google.com; s=arc-20160816; b=dGuPh6bnTLn7hQmiX2n0mqdkon5hIlw4oA8GuVTkgRoGOrzavR5FjPTY4MIvXIE7ue x0ZjKCFhClOXbmYvhBh9EWTPqmNccecyamvIG3LGiaKtbx1x2nFooctJwo5l8Bcxp0yP Q9xsynrB63sgdaB3uc1UNxBkIdHKS3V2cH3jrdoCST+I7wyyjbGMMFV63NYxI5mYN8/f OU20RDNT9b4lwPICoJrQhp3lthrreibSReiQtqCVP/veAYNshcBI7SvuGb05Yb9FkB/9 VR5KVZresl/ygIv3TgOuV5p5m8QSCo6nHWetKD6hIiohHP/dZM8//l6DAVWRrNlMKr7D hL2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=w0U8ncsux+3xIHj15lymzZ/3wpimg3ytL1RoKrWZYh0=; b=TjMkeu0NwaGBdZ4iQDVen2rogrgYnSr9Ir1rAXjJzNU4/B0f2utHQLTGzbcsdPGjqk f32uIPPqMXq3l1ZpEmirnDVBQi111dYYbeZQEmOgRfVqMvW4+cKaqVgow+Z/zKiWSddl hxcJv58uKJq/xdlTfTW5AYePuUehwgXlzPpWEjMOP3OJIYDj0eOX1Ny/CTnOOcbf89ao 2nd4oHYyKyHa+ffy45Sb0ymcddTG2K0qxGGFvJ0H9GVkghmRkf2ytJfrRJGU1cTEeWcQ YjlmebOb1xbTa89QkNSQiUqylSITNWDFqvGaRYcUpJFkharLMGhOX2DdYmWIx+4lIxmj rHCw== 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 hu8si8576688ejc.247.2022.01.24.09.01.14; Mon, 24 Jan 2022 09:01:15 -0800 (PST) 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 5755A68B113; Mon, 24 Jan 2022 19:00:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A5F8968B0C7 for ; Mon, 24 Jan 2022 19:00:32 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 20D38240506 for ; Mon, 24 Jan 2022 18:00:32 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id zSFdrCy2Fm3i for ; Mon, 24 Jan 2022 18:00:31 +0100 (CET) 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 mail0.khirnov.net (Postfix) with ESMTPS id CC7512404FE for ; Mon, 24 Jan 2022 18:00:29 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 951B43A0404; Mon, 24 Jan 2022 18:00:26 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Jan 2022 18:00:03 +0100 Message-Id: <20220124170014.17189-2-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124170014.17189-1-anton@khirnov.net> References: <20220124170014.17189-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 02/13] lavc/h264_parser: stop accessing H264Context 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 6g4e+vuO5fwH Parsers should not mess with decoder private data. It is also completely unnecessary here. --- libavcodec/h264_parser.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index e3a11702c5..816b04845e 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -247,7 +247,6 @@ static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t * const buf, int buf_size) { H264ParseContext *p = s->priv_data; - H264Context *h = avctx->priv_data; H2645RBSP rbsp = { NULL }; H2645NAL nal = { NULL }; int buf_index, next_avc; @@ -553,11 +552,10 @@ static inline int parse_nal_units(AVCodecParserContext *s, p->last_picture_structure = s->picture_structure; p->last_frame_num = p->poc.frame_num; } - if (h && sps->timing_info_present_flag) { + if (sps->timing_info_present_flag) { int64_t den = sps->time_scale; - if (p->sei.unregistered.x264_build >= 0) - h->x264_build = p->sei.unregistered.x264_build; - if (h->x264_build < 44U) + if (p->sei.unregistered.x264_build >= 0 && + p->sei.unregistered.x264_build < 44U) den *= 2; av_reduce(&avctx->framerate.den, &avctx->framerate.num, sps->num_units_in_tick * avctx->ticks_per_frame, den, 1 << 30);