From patchwork Wed Jun 27 22:12:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stebbins X-Patchwork-Id: 9530 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp1360116jad; Wed, 27 Jun 2018 15:12:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpey/dSPDbYePZuLnEEAoJIc4nx0MbvW7jhBtBwt1SmOSzjdjwcggfyo+BOPOCNLJyubjdYG X-Received: by 2002:a5d:4203:: with SMTP id n3-v6mr5627912wrq.55.1530137560399; Wed, 27 Jun 2018 15:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530137560; cv=none; d=google.com; s=arc-20160816; b=ly/j6BPVwkVslUa/jdt7PyRtJTU//CdfBz6vqsm3apX4s3Q87ATmNMHEhWuWqT9gBI +FSI3TPVLlpc3JOQ6asaafexJJd3cdk8G1YvvRblN4FwMnsnwJZNd+wp64jyDeKEWQ4h 5mu+aeHfB/WqGda01Pp/0F/hcPNPKfwTyQUQaMj72pRdpuJluWiD+fZ6uF3RBnSgdu41 bN7UeSSZjDzVAAPLgZ39EbFMdlT/CjPO7NGXCE36KpDZ1VkZbqZD+FkEntWLZ5niLOqk ly2xvt9Yfwi2qAEzxvwvkKwLDofRhErOh1DTUo6ozdoBt8t/PQ0zAI4iw/ljBobc3Yd7 DMJg== 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:message-id:date:to:from :delivered-to:arc-authentication-results; bh=DbmoICI/SfSuqZdm/d7jzCE4o0lu/B1OKQs4txQRN/k=; b=ToYmoRjPJMBpQ1Q7B5lFPXaF2Q3semOOkostAsdHiUZKn7YV3/5mOduxU4JXTeOh4r R1a1UiElAc6OQ1BE0FlOTMV8hPqP8EyEkl9gcVzMP5yr8Y7/68X+pKEvVt12xPUkS3Y9 zJGw/LeUsc4ULd0SMhB0TZYUGeiW5Ux6nigs/Q3Twc3hs8Udt0JB1bit4KgF3OBNjX3o kWbDhpLPswPKQeJbh8GE+YSEhD3B+V3W5relnEThkHPUNq4aCNrss+PRs012KFJGZq0n eqbg88PM33PpJ5Ss26bOTyKY2SLNMgBsxavNhSRsibrQXfTUNopHP+CHkMm7fIaYtEkk Wu9w== 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 r128-v6si4720458wmr.164.2018.06.27.15.12.39; Wed, 27 Jun 2018 15:12:40 -0700 (PDT) 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 8736168A457; Thu, 28 Jun 2018 01:12:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.jetheaddev.com (mail.jetheaddev.com [70.164.99.34]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 910516802BD for ; Thu, 28 Jun 2018 01:12:30 +0300 (EEST) Received: from dionysus.jetheaddev.com (10.13.12.63) by cas.jetheaddev.com (192.168.13.27) with Microsoft SMTP Server (TLS) id 14.3.351.0; Wed, 27 Jun 2018 15:12:27 -0700 Received: from dionysus.jetheaddev.com (localhost [127.0.0.1]) by dionysus.jetheaddev.com (8.15.2/8.14.7) with ESMTP id w5RMCRcs020327 for ; Wed, 27 Jun 2018 15:12:28 -0700 Received: (from jstebbins@localhost) by dionysus.jetheaddev.com (8.15.2/8.15.2/Submit) id w5RMCRIk020326 for ffmpeg-devel@ffmpeg.org; Wed, 27 Jun 2018 15:12:27 -0700 From: John Stebbins To: Date: Wed, 27 Jun 2018 15:12:24 -0700 Message-ID: <20180627221224.20278-1-jstebbins@jetheaddev.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.13.12.63] Subject: [FFmpeg-devel] [PATCH] h264_slice: Fix return of incomplete frames from decoder 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" When not using libavformat for demuxing, AVCodecContext.has_b_frames gets set too late causing the recovery frame heuristic in h264_refs to incorrectly flag an early frame as recovered. This patch sets has_b_frames earlier to prevent improperly flagging the frame as recovered. --- libavcodec/h264_slice.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index d71ddbe9ba..ede9a1a6ea 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1407,6 +1407,11 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl, sps = h->ps.sps; + if (sps && sps->bitstream_restriction_flag && + h->avctx->has_b_frames < sps->num_reorder_frames) { + h->avctx->has_b_frames = sps->num_reorder_frames; + } + last_pic_droppable = h->droppable; last_pic_structure = h->picture_structure; h->droppable = (nal->ref_idc == 0);