From patchwork Thu Jun 11 04:43:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: rcombs X-Patchwork-Id: 20273 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 4810C448CDE for ; Thu, 11 Jun 2020 07:43:38 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 25AD268B11E; Thu, 11 Jun 2020 07:43:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from so254-54.mailgun.net (so254-54.mailgun.net [198.61.254.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C9B0268AD72 for ; Thu, 11 Jun 2020 07:43:31 +0300 (EEST) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=rcombs.me; q=dns/txt; s=mx; t=1591850614; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: To: From: Sender; bh=wI50wvJdHK24Y+JQZqhD/SqLhsYqEO5UcYs/tpa6amI=; b=ISAObKatwRF0L9PgE0dwj3gYpRBO+ZmOrzV9xtpb/BvzbZJm81OEV2O+yFOSGXuwCOhg8GfL MfuxfHYMiXlli+al8SdC968Z2qWh6nvoCifTcq98QqTsHvfUKB/r0b5f+HrjGioqiDaGB14N SYgOPKaepfRJfgCTG14jn5TBuIk= X-Mailgun-Sending-Ip: 198.61.254.54 X-Mailgun-Sid: WyJiZDU1MSIsICJmZm1wZWctZGV2ZWxAZmZtcGVnLm9yZyIsICJiMGJhIl0= Received: from rcombs-mbp.localdomain ( [24.14.135.13]) by smtp-out-n12.prod.us-west-2.postgun.com with SMTP id 5ee1b6676f2ee827da09e928 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 11 Jun 2020 04:43:19 GMT From: rcombs To: ffmpeg-devel@ffmpeg.org Date: Wed, 10 Jun 2020 23:43:10 -0500 Message-Id: <20200611044312.38981-3-rcombs@rcombs.me> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200611044312.38981-1-rcombs@rcombs.me> References: <20200611044312.38981-1-rcombs@rcombs.me> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/5] lavc/h264dec: loosen new-extradata check 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavcodec/h264dec.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 6270ea80df..0d7492cfad 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -988,6 +988,8 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data, AVFrame *pict = data; int buf_index; int ret; + const uint8_t *new_extra; + int new_extra_size; h->flags = avctx->flags; h->setup_finished = 0; @@ -999,13 +1001,10 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data, if (buf_size == 0) return send_next_delayed_frame(h, pict, got_frame, 0); - if (h->is_avc && av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) { - int side_size; - uint8_t *side = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); - if (is_extra(side, side_size)) - ff_h264_decode_extradata(side, side_size, - &h->ps, &h->is_avc, &h->nal_length_size, - avctx->err_recognition, avctx); + if ((new_extra = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &new_extra_size))) { + ff_h264_decode_extradata(new_extra, new_extra_size, + &h->ps, &h->is_avc, &h->nal_length_size, + avctx->err_recognition, avctx); } if (h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC) { if (is_extra(buf, buf_size))