From patchwork Sun Nov 19 20:46:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stebbins X-Patchwork-Id: 6209 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp3166361jah; Sun, 19 Nov 2017 13:15:57 -0800 (PST) X-Google-Smtp-Source: AGs4zMZgWBtgF+6rRXzNw6oWi66vZ0dCXKYNDRv+GsBZe1hoRlDUJhNUmz4gaEJDrH21eXaQgBcb X-Received: by 10.28.229.19 with SMTP id c19mr7731487wmh.156.1511126157741; Sun, 19 Nov 2017 13:15:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511126157; cv=none; d=google.com; s=arc-20160816; b=K4DnJ2Sj1ACbwr6JGdVIQ7enjx/+wC0T8UnOE5Fur0AR3ekEMdmny8UFD63ba8QMzi kvY3Pr2IC931yHDB8DQFvlgoEsTCHSL58G5Gb3bE5SH7h5aAf/GaiT9YTouNM7XUsZqe Tnl38vT9drY7bX4VvMFB9VgozuS2R601xTJ63Ic+I8zNxbuGrzkGADDgIeVFN03od450 8ibkKXWH+OXWUyUeUkxSoIqS25lxjBOW41/vmGHDOAO7Ch9dXQroaaqpXs3yTKrwdSiE j+k/unZn1rqjh0Ez1fjTyn32fNaysnvEd8sK4SLPq0YQrJXB5Fi/bxXqbRzSPSTsysEu 7DOg== 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:references:in-reply-to:message-id :date:to:from:delivered-to:arc-authentication-results; bh=l3rzGn+ElfcfQBZWjjPFX4yO9a7U8zl0eIJhm0kzRK0=; b=huJ08LmFFxesELHWhNmNBCzz/y98WUsatKYgzz1Dhn0gDibhy4zH4Cvr2GaCtEFMlw DKoFR28EeQfMFKkcxSotPo1eX4Fgm2krnLCa81QBmazA0KtQFaDfF75J6G1aA34AzPmE uuSRXa3Cv6Da+0BgakVgvgvqJiu+LVuCOeTMM68LrNPysOXx8L0hF6iGos8wMEQJRJiX yH98P8iYG8DjkZM8tZcLYy6bxsbyHLIVxDST0ojFyJ8KNLLQzz6wUIymRQ7WtEYKJ2Fd naCFqSfRkMW3pYb/yVDGZxSY5GsDypm5LputlNikSN8wAAx1OZrjdSUx7461/5txGKH4 kYlA== 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 41si5551301wrc.108.2017.11.19.13.15.57; Sun, 19 Nov 2017 13:15:57 -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; 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 BF7F06882C9; Sun, 19 Nov 2017 23:15:38 +0200 (EET) 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 A538E6802BB for ; Sun, 19 Nov 2017 23:15:32 +0200 (EET) 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; Sun, 19 Nov 2017 13:15:47 -0800 Received: from dionysus.jetheaddev.com (localhost [127.0.0.1]) by dionysus.jetheaddev.com (8.15.2/8.14.7) with ESMTP id vAJKliXa004701 for ; Sun, 19 Nov 2017 12:47:44 -0800 Received: (from jstebbins@localhost) by dionysus.jetheaddev.com (8.15.2/8.15.2/Submit) id vAJKli9G004700 for ffmpeg-devel@ffmpeg.org; Sun, 19 Nov 2017 12:47:44 -0800 From: John Stebbins To: Date: Sun, 19 Nov 2017 12:46:35 -0800 Message-ID: <20171119204635.4593-7-jstebbins@jetheaddev.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171119204635.4593-1-jstebbins@jetheaddev.com> References: <20171119204635.4593-1-jstebbins@jetheaddev.com> MIME-Version: 1.0 X-Originating-IP: [10.13.12.63] Subject: [FFmpeg-devel] [PATCH 6/6] ffplay: use AV_PKT_FLAG_DISPOSABLE in frame drop logic 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" --- fftools/ffplay.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index 10a917194d..97555d5047 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -257,6 +257,7 @@ typedef struct VideoState { struct SwrContext *swr_ctx; int frame_drops_early; int frame_drops_late; + int drop_disposable; enum ShowMode { SHOW_MODE_NONE = -1, SHOW_MODE_VIDEO = 0, SHOW_MODE_WAVES, SHOW_MODE_RDFT, SHOW_MODE_NB @@ -1619,9 +1620,11 @@ retry: duration = vp_duration(is, vp, nextvp); if(!is->step && (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) && time > is->frame_timer + duration){ is->frame_drops_late++; + is->drop_disposable = 1; frame_queue_next(&is->pictq); goto retry; } + is->drop_disposable = 0; } if (is->subtitle_st) { @@ -2900,6 +2903,7 @@ static int read_thread(void *arg) infinite_buffer = 1; for (;;) { + AVStream * st; if (is->abort_request) break; if (is->paused != is->last_paused) { @@ -3008,6 +3012,12 @@ static int read_thread(void *arg) } else { is->eof = 0; } + st = ic->streams[pkt->stream_index]; + if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && + is->drop_disposable && pkt->flags & AV_PKT_FLAG_DISPOSABLE) { + av_packet_unref(pkt); + continue; + } /* check if packet is in play range specified by user, then queue, otherwise discard */ stream_start_time = ic->streams[pkt->stream_index]->start_time; pkt_ts = pkt->pts == AV_NOPTS_VALUE ? pkt->dts : pkt->pts;