From patchwork Thu Nov 9 20:38:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaroslav Kysela X-Patchwork-Id: 5916 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp2647887jah; Thu, 9 Nov 2017 15:08:56 -0800 (PST) X-Google-Smtp-Source: ABhQp+QSxtEYQhD+dStB++UerKUF1xCDZZ5FA+BRqO9xVs6cUc/MyV4Kb08v8kYssAbkuuPnLP0p X-Received: by 10.223.130.196 with SMTP id 62mr1895077wrc.60.1510268936817; Thu, 09 Nov 2017 15:08:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510268936; cv=none; d=google.com; s=arc-20160816; b=DYyMaPkTIqdEY7UxasnjaSV/nGd1kJpFNgrQyJvg5l5+d4l+wwJo8nY6OGRzO5Jf+7 5gI62LeUFm2amZ0RRiRfKs3rW/0u+QTI0gIfpl7SyUmlCfQIeGEQ5iNVO2QNSQ2M9XuL m+raCp1aVw1uMfesA0QCAlzBsMhwRUcvf2y7irkYb2rPtTEbyq5ajHzbUGUHYPuCnnJi qKAxbUaI3GHKfNUz11n1y35oPvgKVLZkfE69Y7Vg15hDxGQLw6yAdCJRGCO6BYvFBcdy U97LI7Qa2O2D3zSR9fLN4q+O4I/4tmeL/OFuA6gUTAhpRXM+qRLHXjVpVfdFBNWGCWr+ +KuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :dkim-filter:delivered-to:arc-authentication-results; bh=6xmqE2O34dl/ITQn4x69tVrfhR4XKyjLyRrRO0yTdJI=; b=0cV9FjohitWHYnuOO9Y1IijgSPjw5Yko3T3LmANEcHoFqkXRqt0coWKK8YD8RL79/G jsYs5Y8J3pOiCZCDUEJOWGu5OSb0pKcnRYceDCp3pQYXPtq6o1mel0A5h1SboNCV/r1r mupkHuyyCNREQIa41dJCtto8NmmLRYCrm2UDXDKrCaYbcGgQtJWcbGlQpQ1YuRwcxy/N TPYEWFXgRFXM0wSvdKnGNEYntgqtxw5OLCo0OOrX9wqvYb3ye/s5WrWh3o0nHLjr33Qa Qa2sjyBbKbG05N97dh3H15G0XRHCx3rEQufSgyu6T8mYJYjaTDYYeCKlcMp2+DrhlfRq Ox5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@perex.cz header.s=default header.b=KjynaEui; 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 p75si6438411wrc.194.2017.11.09.15.08.56; Thu, 09 Nov 2017 15:08:56 -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=@perex.cz header.s=default header.b=KjynaEui; 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 2CD11689B99; Fri, 10 Nov 2017 01:08:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.perex.cz (mail1.perex.cz [77.48.224.245]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 964D4689E35 for ; Thu, 9 Nov 2017 22:38:29 +0200 (EET) Received: from mail1.perex.cz (localhost [127.0.0.1]) by smtp1.perex.cz (Perex's E-mail Delivery System) with ESMTP id 0E120A0048; Thu, 9 Nov 2017 21:38:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.perex.cz 0E120A0048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=perex.cz; s=default; t=1510259922; bh=2Ufax7PtOl+XW/MW872D4pZ/SuOsBeW3+6bqI56xWiY=; h=From:To:Cc:Subject:Date:From; b=KjynaEuiNZ15tJXCbg0gXGsLDLjjchPuyRedWRG/gT6E9EQGnIyxgD9SimB4DKN0B Tkj7BLbSPKKcCxttd6cfLiLrGdvIBHKCkZJEvumhxZFvZMMAerE7O/2pPDFTe0RHIp pKUDEnBvymuL/l+K/8J5NHd0ir23rdl4Ic0f/Cbs= Received: from p50.perex-int.cz (unknown [192.168.100.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: perex) by mail1.perex.cz (Perex's E-mail Delivery System) with ESMTPSA; Thu, 9 Nov 2017 21:38:39 +0100 (CET) From: Jaroslav Kysela To: ffmpeg-devel@ffmpeg.org Date: Thu, 9 Nov 2017 21:38:36 +0100 Message-Id: <20171109203836.11152-1-perex@perex.cz> X-Mailer: git-send-email 2.13.6 X-Mailman-Approved-At: Fri, 10 Nov 2017 01:08:40 +0200 Subject: [FFmpeg-devel] [PATCH] h264dec: h264_select_output_frame() - fill correctly has_b_frames based on the level 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: Jaroslav Kysela MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The current code does not handle correctly the situation when sps->num_reoder_frames was set using the level. The incorrect has_b_frames results in the wrong DTS guess and malformed output (wrong 'Non-monotonous DTS' fixup). sps->num_reorder_frames is set in the function ff_h264_decode_seq_parameter_set(), see comment: 'if the maximum delay is not stored in the SPS, derive it based on the level'. Issue: #6810 --- libavcodec/h264_slice.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 35dcabd611..04b10656e0 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1287,6 +1287,7 @@ static int h264_select_output_frame(H264Context *h) h->mmco_reset = 0; if (sps->bitstream_restriction_flag || + sps->ref_frame_count || h->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT) { h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, sps->num_reorder_frames); }