From patchwork Fri Dec 29 21:48:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "sergey@gavrushkin.com" X-Patchwork-Id: 7023 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.79.195 with SMTP id r64csp10970764jad; Fri, 29 Dec 2017 13:48:05 -0800 (PST) X-Google-Smtp-Source: ACJfBou7VoYw+vc8kEGOqjYAu1Ny/Qh0rDCdltlM1DcNtkW2fiLoXEzenpHmd5Q/41S6rafVL370 X-Received: by 10.28.147.8 with SMTP id v8mr33894138wmd.136.1514584085412; Fri, 29 Dec 2017 13:48:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514584085; cv=none; d=google.com; s=arc-20160816; b=iICs2uKXfXG5ziZvvX+GQYnLMU9uiOaz2NizuFQrN3WrQ88Vob2W4OHd8+U4wxwGvK 2DPK8Wr1MkAqhr7YpeliwKl0HuelvubxQUYf79kz7TCM8GPEg12E6MUnf8OL1Sie3647 D/D5MElWXk4NjgA7yO0jbpX6v/QwvBpYS3tJecspjLOk5FSOH+hx0A4wFT0s2obJYIOu ZRGO9fSpq/lbzgK7OmVHqXipz6TCkTAjLW0bpOhhsYiud0kLvUDnuOlQ3UHUaINvPUom ob0xXQBEDLDBgRag/wsPjsiyRLApzf/+XTonEhkFqYaPxArKqlF/6O4lDeqljPbcXg+0 XtKQ== 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:message-id:in-reply-to:to:references:date :mime-version:from:dkim-signature:delivered-to :arc-authentication-results; bh=iPQjXMBVZ9AIMfgHwns1FKtwqSFKAstvEiuh9nz6urI=; b=DRxwa/CYPCbqpoNmS0jzZyBrrj7G8oA0LnntQW8CaxKlW/uy7UFqftebIQjttcz2K6 NJL3jwaBPsiI7ECJ4KQx3ajT/l+3/+iPt3vvGm2iyiDhQ6XEK2FWjRj3mkGxY8ufqfM7 NMHxtS3yc6HxWvsnAo5A+pO71N12kQJejEk4/Ai0bd1YhGjPBQGQVLZJ1cv7g2Tw9JOG YUVVAlbxqbNsyWGxX/R8lGa484YlQ+EOAg9luvQCT3XrHeLlkm7AfVLPCwzLICvLB1uf zbgs8cTbQeDh7i0uOetR8RxDHFR8sMdAguOraeHpIOovJKGvYbfMbwMaixv/dgDLFPlw lv3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gavrushkin.com header.s=default header.b=WQtnxW41; 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 v20si20559652wrf.62.2017.12.29.13.48.04; Fri, 29 Dec 2017 13:48:05 -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; dkim=neutral (body hash did not verify) header.i=@gavrushkin.com header.s=default header.b=WQtnxW41; 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 8DE94689893; Fri, 29 Dec 2017 23:47:48 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from gateway30.websitewelcome.com (gateway30.websitewelcome.com [50.116.126.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E01646891F3 for ; Fri, 29 Dec 2017 23:47:42 +0200 (EET) Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway30.websitewelcome.com (Postfix) with ESMTP id AA9D92E87 for ; Fri, 29 Dec 2017 15:47:55 -0600 (CST) Received: from gator4174.hostgator.com ([108.167.133.30]) by cmsmtp with SMTP id V2VPeZEFZmzEzV2VPe3Uz3; Fri, 29 Dec 2017 15:47:55 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gavrushkin.com; s=default; h=Message-Id:In-Reply-To:To:References:Date: Subject:Mime-Version:Content-Type:From:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XWfmYYTAJlPAb15nIrATvJYTL7BPVnyhTMRy6ETUgj8=; b=WQtnxW41sRXkYNxk4uo3AP7b4 ccwefRJYWQoj7sVNpjmRxAkALwVjw34wLXAVG2YE1SroxpAahoSAjOx0Maxb8bchT4mezkLp5lacf lGaE708T5s6kMawdGqsagTXm1mzz9ycsHAmrKMk2/n06YuYUserph9ej3d+8jP8inCzvB1oFzItmX 2wzD4PFVe+aCXEoALcmgSBVo+ZtVUf/VHJhJzWlOW+2J8MGdPRfIxRJfqk476InR9cYUVh5A7Aetx jZXefGvhrYFqj1ambDB5sX+Um9ZQq/WETdH/kHVv4n5HgH7nwmqPOhHW58BLU9Nzwa5aNfpsv1O8x oGFPdD9Ig==; Received: from [46.216.152.78] (port=7034 helo=[172.20.10.5]) by gator4174.hostgator.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eV2VO-0041hx-QF for ffmpeg-devel@ffmpeg.org; Fri, 29 Dec 2017 15:47:55 -0600 From: "sergey@gavrushkin.com" Mime-Version: 1.0 (Mac OS X Mail 11.1 \(3445.4.7\)) Date: Sat, 30 Dec 2017 00:48:19 +0300 References: <75E7EF11-58CF-4088-868F-18C182C71CF7@gavrushkin.com> To: FFmpeg development discussions and patches In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3445.4.7) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4174.hostgator.com X-AntiAbuse: Original Domain - ffmpeg.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - gavrushkin.com X-BWhitelist: no X-Source-IP: 46.216.152.78 X-Source-L: No X-Exim-ID: 1eV2VO-0041hx-QF X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([172.20.10.5]) [46.216.152.78]:7034 X-Source-Auth: sergey@gavrushkin.com X-Email-Count: 1 X-Source-Cap: bmN1eGVyO25jdXhlcjtnYXRvcjQxNzQuaG9zdGdhdG9yLmNvbQ== X-Local-Domain: yes X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: Re: [FFmpeg-devel] h264: fix RTSP stream decoding 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" > Please add "Fixes ticket #6422" to the commit message. > > And maybe remove "rtsp" from the commit title, the issue > is reproducible with files. Done. Please feel free to edit commit title/message as you wish for merge. Thank you, Sergey ------------------------------------- From e90ef7b56d4147ff6555468f0154321b55596846 Mon Sep 17 00:00:00 2001 From: Sergey Gavrushkin > Date: Fri, 29 Dec 2017 20:03:50 +0300 Subject: [PATCH] h264: fix decoding Fixes ticket #6422 . It is a regression fix for an issue that was introduced in commit 98c97994c5b90bdae02accb155eeceeb5224b8ef. Variable err_recognition is ignored while extradata is decoded and the whole decoding process is failed due to timeout. --- libavcodec/h264_parse.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c index fee28d9..009d50c 100644 --- a/libavcodec/h264_parse.c +++ b/libavcodec/h264_parse.c @@ -347,7 +347,7 @@ int ff_h264_init_poc(int pic_field_poc[2], int *pic_poc, } static int decode_extradata_ps(const uint8_t *data, int size, H264ParamSets *ps, - int is_avc, void *logctx) + int is_avc, int err_recognition, void *logctx) { H2645Packet pkt = { 0 }; int i, ret = 0; @@ -363,13 +363,13 @@ static int decode_extradata_ps(const uint8_t *data, int size, H264ParamSets *ps, switch (nal->type) { case H264_NAL_SPS: ret = ff_h264_decode_seq_parameter_set(&nal->gb, logctx, ps, 0); - if (ret < 0) + if (ret < 0 && (err_recognition & AV_EF_EXPLODE)) goto fail; break; case H264_NAL_PPS: ret = ff_h264_decode_picture_parameter_set(&nal->gb, logctx, ps, nal->size_bits); - if (ret < 0) + if (ret < 0 && (err_recognition & AV_EF_EXPLODE)) goto fail; break; default: @@ -393,7 +393,7 @@ static int decode_extradata_ps_mp4(const uint8_t *buf, int buf_size, H264ParamSe { int ret; - ret = decode_extradata_ps(buf, buf_size, ps, 1, logctx); + ret = decode_extradata_ps(buf, buf_size, ps, 1, err_recognition, logctx); if (ret < 0 && !(err_recognition & AV_EF_EXPLODE)) { GetByteContext gbc; PutByteContext pbc; @@ -425,7 +425,7 @@ static int decode_extradata_ps_mp4(const uint8_t *buf, int buf_size, H264ParamSe escaped_buf_size = bytestream2_tell_p(&pbc); AV_WB16(escaped_buf, escaped_buf_size - 2); - (void)decode_extradata_ps(escaped_buf, escaped_buf_size, ps, 1, logctx); + (void)decode_extradata_ps(escaped_buf, escaped_buf_size, ps, 1, err_recognition, logctx); // lorex.mp4 decodes ok even with extradata decoding failing av_freep(&escaped_buf); } @@ -486,7 +486,7 @@ int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps, *nal_length_size = (data[4] & 0x03) + 1; } else { *is_avc = 0; - ret = decode_extradata_ps(data, size, ps, 0, logctx); + ret = decode_extradata_ps(data, size, ps, 0, err_recognition, logctx); if (ret < 0) return ret; }