From patchwork Thu Oct 17 08:29:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 15798 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 52B72449FA2 for ; Thu, 17 Oct 2019 11:30:48 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4520268A718; Thu, 17 Oct 2019 11:30:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7453B68A67D for ; Thu, 17 Oct 2019 11:30:45 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id w18so718842wrt.3 for ; Thu, 17 Oct 2019 01:30:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hDqs9RPGRGbe1t7PChYSCuA7vEIf3iuwbHZyDjDQRu4=; b=tDOk0CO+Rf/uc1463J9Knhi41ANLPSMJTezQUiuY8IjwTeC/hYGPNIOsbMW1sC9Le1 cIYQamnKyLT5R2VxvltvJQV+OjoyDeH36XWXRvQLiekkxBKmc7XLYrpRt20YLFgUijVF rZA2lRxM011bBPNbdo6OpULXwfhpjkvpwEKmZneLJ2O8Ea8UB3ryq/n7uxH0co9QasWl +ShppW/rJZ91I1+unjn20yG9Wzd0FVAyTil8VH+/dJumIhy6NuHsZL12jlMd75KGlfNq LcF/E1XR1O9abNV9Njr4hsUDJbxQjDqJVJ0Z01lG+4pWCAwB4xv9SJp0liGAcPMSFzMb TmRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hDqs9RPGRGbe1t7PChYSCuA7vEIf3iuwbHZyDjDQRu4=; b=cxE3/tLgy0kbgfp2T6dthVTnPgz6HQJfiAabkjeUEg9qqK91w+Mu0IPj4HFjCNeKjW VB+UmN7Mrer8CqyHX+JptSLWX/r2usFiMONZ8C1UHf73JTfaXbLbyaSUd9bHReLIzetR KjIQ7L7zUyLahYsWWV7vJYbkUvWgAzcL9ioiC5KrZY5L6ue1+xWFQXvBZERRKbwTzv+f ZmYVDOWbt+Un3wFi0EvNmgOfh3KIqaNLBDpDYDMsSBMjJof131vs1T4Ydv3t4MWs3Zob Trd3eDq8qi1LNgIZRTUJmAHOBDkHN/G5/vbUoKQZWc9xes8CR4/UhTMjpY09ofdWRxCh BArQ== X-Gm-Message-State: APjAAAWlgnN66s8azTOjprJt8DbUw9bkLBndrxSsIZTG3X8KBQLq5qjU KqWAVc603aHY/fWiguml8vYhQMOG X-Google-Smtp-Source: APXvYqxCiOic6K5rB/ax//EE6yiupgU0zFk2/lo+79veXJUrIhhwcmaG0EBZvPJQI7P117WzUAkUsw== X-Received: by 2002:adf:dcc6:: with SMTP id x6mr1852413wrm.81.1571301044758; Thu, 17 Oct 2019 01:30:44 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc08937.dynamic.kabel-deutschland.de. [188.192.137.55]) by smtp.gmail.com with ESMTPSA id l7sm1369273wrv.77.2019.10.17.01.30.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 01:30:44 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 17 Oct 2019 10:29:40 +0200 Message-Id: <20191017082945.13534-10-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191017082945.13534-1-andreas.rheinhardt@gmail.com> References: <20191017082945.13534-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 10/15] h264_mp4toannexb: Consistently use pointer comparisons X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" h264_mp4toannexb_filter currently uses both indices/offsets as well as direct pointers comparisons for the checks whether one has reached or even surpassed the end. This commit removes the offsets. Signed-off-by: Andreas Rheinhardt --- libavcodec/h264_mp4toannexb_bsf.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c index 7f46644294..afcc9ad680 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -176,10 +176,8 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out) AVPacket *in; uint8_t unit_type; int32_t nal_size; - uint32_t cumul_size = 0; const uint8_t *buf; const uint8_t *buf_end; - int buf_size; int ret = 0, i; ret = ff_bsf_get_packet(ctx, &in); @@ -194,7 +192,6 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out) } buf = in->data; - buf_size = in->size; buf_end = in->data + in->size; do { @@ -262,8 +259,7 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out) } buf += nal_size; - cumul_size += nal_size + s->length_size; - } while (cumul_size < buf_size); + } while (buf < buf_end); ret = av_packet_copy_props(out, in); if (ret < 0)