From patchwork Fri Dec 1 00:27:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stebbins X-Patchwork-Id: 6487 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp528249jah; Thu, 30 Nov 2017 16:27:18 -0800 (PST) X-Google-Smtp-Source: AGs4zMYXcBXMzWBOWl4hFef+W15vSgB2lik+ZMobG0t8GE6QLaK4MTK52hTjUW1j6yPFBeRaRydb X-Received: by 10.28.212.148 with SMTP id l142mr1684102wmg.99.1512088038277; Thu, 30 Nov 2017 16:27:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512088038; cv=none; d=google.com; s=arc-20160816; b=kbXgCUA53lMwtHqybdB1NS4TKDlbzwKFy913Zl044mGgzFBf7wRA2DmiBMSilbN0Jt /rMYvLyxLiJI82PBMx9q5NSVmo26TZxO8O5kiJoq+cqFtOgzMAuwXpWTbAZnsbtO2rYB Bs6A8I6+VVvn/Pw1Wi9f3vb/+O6xZsg5vlbx/CdSRLFKnbtQbGXx1D4gHJHAq/FCIulO PomwrtnSmt9AjtMxW1tFCQPUZIQBXZd0T84Lg6gv39UTIbZtcnWJvdERphM3FSJH1D3a Io3j/weTrQZ0GRLOn/PHLvu/Fnw5BLR0aLWb46d+G4m8ymeKoOxU/PUsX4as+1EAAP5u 0LHQ== 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=OI4XmHxNljQyk52DAxDGu8W4HKXjM6k2zUJY/rvmw/c=; b=0HUmtFSpBBqEuOEeG2KchSdw/kFPBACyH4+xnh/MOnbD4v7c5orpoxW2vhxToTmg2j D8up4XeNYug2dCpyuq5S61Da5RYWw2r/JNIkkEOApX65MYdV8UOkQJPVvCBwttQLCGck JOONx4/gN8qpeJvbFYt46BRo2aDTJiC4S81OZb7ViHhcd355F83Lra+BfPx4HvJvrYs8 KAAtWyUB7ce8JKAtcrOjkulK1lvvAixovd8el9pHCDzB5ZUhj3MiaK2BSqW8HJorqQfb eqFzCDwBeOESYPRZBWjdGXGh6WLHWBgsEesRd3ejDLpY0SBt5NATWSkPMCcIPKX/KZ7v ALnw== 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 5si4024494wmg.226.2017.11.30.16.27.17; Thu, 30 Nov 2017 16:27:18 -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 4CA3368A438; Fri, 1 Dec 2017 02:27:13 +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 937FD68A427 for ; Fri, 1 Dec 2017 02:27:06 +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; Thu, 30 Nov 2017 16:27:03 -0800 Received: from dionysus.jetheaddev.com (localhost [127.0.0.1]) by dionysus.jetheaddev.com (8.15.2/8.14.7) with ESMTP id vB10R3Vb024650 for ; Thu, 30 Nov 2017 16:27:03 -0800 Received: (from jstebbins@localhost) by dionysus.jetheaddev.com (8.15.2/8.15.2/Submit) id vB10R3g5024649 for ffmpeg-devel@ffmpeg.org; Thu, 30 Nov 2017 16:27:03 -0800 From: John Stebbins To: Date: Thu, 30 Nov 2017 16:27:01 -0800 Message-ID: <20171201002701.24592-2-jstebbins@jetheaddev.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171201002701.24592-1-jstebbins@jetheaddev.com> References: <20171201002701.24592-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 | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index 10a917194d..152d220cdb 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -198,6 +198,8 @@ typedef struct Decoder { int64_t next_pts; AVRational next_pts_tb; SDL_Thread *decoder_tid; + int drop_disposable; + int frame_drops_disposable; } Decoder; typedef struct VideoState { @@ -660,10 +662,16 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) { ret = got_frame ? 0 : (pkt.data ? AVERROR(EAGAIN) : AVERROR_EOF); } } else { - if (avcodec_send_packet(d->avctx, &pkt) == AVERROR(EAGAIN)) { - av_log(d->avctx, AV_LOG_ERROR, "Receive_frame and send_packet both returned EAGAIN, which is an API violation.\n"); - d->packet_pending = 1; - av_packet_move_ref(&d->pkt, &pkt); + if (d->avctx->codec_type == AVMEDIA_TYPE_VIDEO && + d->drop_disposable && + (pkt.flags & AV_PKT_FLAG_DISPOSABLE)) { + d->frame_drops_disposable++; + } else { + if (avcodec_send_packet(d->avctx, &pkt) == AVERROR(EAGAIN)) { + av_log(d->avctx, AV_LOG_ERROR, "Receive_frame and send_packet both returned EAGAIN, which is an API violation.\n"); + d->packet_pending = 1; + av_packet_move_ref(&d->pkt, &pkt); + } } } av_packet_unref(&pkt); @@ -1622,6 +1630,7 @@ retry: frame_queue_next(&is->pictq); goto retry; } + is->viddec.drop_disposable = 0; } if (is->subtitle_st) { @@ -1699,7 +1708,8 @@ display: get_master_clock(is), (is->audio_st && is->video_st) ? "A-V" : (is->video_st ? "M-V" : (is->audio_st ? "M-A" : " ")), av_diff, - is->frame_drops_early + is->frame_drops_late, + is->frame_drops_early + is->frame_drops_late + + is->viddec.frame_drops_disposable, aqsize / 1024, vqsize / 1024, sqsize, @@ -1767,6 +1777,7 @@ static int get_video_frame(VideoState *is, AVFrame *frame) is->frame_drops_early++; av_frame_unref(frame); got_picture = 0; + is->viddec.drop_disposable = 1; } } }