From patchwork Tue Mar 14 20:53:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: wallak@free.fr X-Patchwork-Id: 2928 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.50.79 with SMTP id y76csp7201vsy; Tue, 14 Mar 2017 13:53:42 -0700 (PDT) X-Received: by 10.28.95.85 with SMTP id t82mr1512836wmb.107.1489524822791; Tue, 14 Mar 2017 13:53:42 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z83si1276605wmb.16.2017.03.14.13.53.42; Tue, 14 Mar 2017 13:53:42 -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 4BCB5680CC1; Tue, 14 Mar 2017 22:53:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtp6-g21.free.fr (smtp6-g21.free.fr [212.27.42.6]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 863A9680721 for ; Tue, 14 Mar 2017 22:53:16 +0200 (EET) Received: from zimbra44-e7.priv.proxad.net (unknown [172.20.243.194]) by smtp6-g21.free.fr (Postfix) with ESMTP id 52EB478038C; Tue, 14 Mar 2017 21:53:31 +0100 (CET) Date: Tue, 14 Mar 2017 21:53:31 +0100 (CET) From: wallak@free.fr To: FFmpeg development discussions and patches Message-ID: <1225176707.239197387.1489524811067.JavaMail.root@zimbra44-e7> In-Reply-To: <20170313204034.2cc760b7@fido6> MIME-Version: 1.0 X-Originating-IP: [78.196.199.83] X-Mailer: Zimbra 7.2.0-GA2598 (ZimbraWebClient - FF3.0 (Linux)/7.2.0-GA2598) X-Authenticated-User: wallak@free.fr Subject: Re: [FFmpeg-devel] The Crystalhd video decoder is broken - last ffmpeg good commit: 6d160afab2fa8d3bfb216fee96d3537ffc9e86e8 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: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" I've a first patch, working with the software decoder. But it fails with the crystalhd decoder. If you know how to fix it. Wallak. ----- Mail original ----- De: "Philip Langdale" À: "Marton Balint" Cc: "FFmpeg development discussions and patches" Envoyé: Mardi 14 Mars 2017 04:40:34 Objet: Re: [FFmpeg-devel] The Crystalhd video decoder is broken - last ffmpeg good commit: 6d160afab2fa8d3bfb216fee96d3537ffc9e86e8 On Mon, 13 Mar 2017 19:39:35 -0700 Philip Langdale wrote: > On Tue, 14 Mar 2017 02:49:27 +0100 (CET) > wallak@free.fr wrote: > > > Indeed 7447ec91b5a692121b81a04c6501a5811d867775 is working; But I > > have the following errors with the last ffmpeg git state: > > [h264_crystalhd @ 0x7fda3c060500] This decoder requires using the > > avcodec_send_packet() API. Last message repeated 456 times ... > > > > I've 'bisected' this last issue; The last good commit (with ffplay > > -vcodec h264_crystalhd working without error) is the > > following one: 234d3cbf469e9feef255e229202d4b029e66e9fe > > > > Is there a configuration flag to fix this issue? A software update > > is required? > > Heh - I switched the crystalhd decoder to the new send_packet API in > the next change, so that's entirely expected. CrystalHD basically > requires the new API as it allows for flexibility in how often frames > are returned vs submitted to the decoder; I only ever got it barely > working with the old API using vicious hacks that failed in many edge > cases. > > As it uses the new API, the application using the decoder must also > support the new API. 'ffmpeg' does, but I guess ffplay does not. My > first reaction is to ask why you're using ffplay. I'd recommend using > mpv - which is much more capable, and does support the new API; it's > what I use for all my testing. > Marton, Would you be interested in updating ffplay to use the new decode API? --phil From 0a221c04973b988fda41d96e4e96f274f8f3caee Mon Sep 17 00:00:00 2001 From: wallak Date: Tue, 14 Mar 2017 21:46:16 +0100 Subject: [PATCH] ffplay: new send_packet API test. --- ffplay.c | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/ffplay.c b/ffplay.c index cf138dc515..486dc6e26b 100644 --- a/ffplay.c +++ b/ffplay.c @@ -583,7 +583,28 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) { switch (d->avctx->codec_type) { case AVMEDIA_TYPE_VIDEO: - ret = avcodec_decode_video2(d->avctx, frame, &got_frame, &d->pkt_temp); +#define CONFIG_FFMPEGNEWAPISENDPACKET +#ifdef CONFIG_FFMPEGNEWAPISENDPACKET + { + int decoded = 0; + ret = avcodec_send_packet(d->avctx, &d->pkt_temp); + got_frame = 0; + if (ret >= 0 || ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { + if (ret >= 0) { decoded = d->pkt_temp.size; } + ret = avcodec_receive_frame(d->avctx, frame); + if (ret >= 0) + got_frame = 1; + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) + ret = 0; + } else { + decoded = d->pkt_temp.size; + } + if (ret >= 0) ret = decoded; + } +#else /*CONFIG_FFMPEGNEWAPISENDPACKET*/ + ret = avcodec_decode_video2(d->avctx, frame, &got_frame, &d->pkt_temp); +#endif /*CONFIG_FFMPEGNEWAPISENDPACKET*/ + if (got_frame) { if (decoder_reorder_pts == -1) { frame->pts = av_frame_get_best_effort_timestamp(frame); @@ -593,7 +614,26 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) { } break; case AVMEDIA_TYPE_AUDIO: +#ifdef CONFIG_FFMPEGNEWAPISENDPACKET + { + int decoded = 0; + ret = avcodec_send_packet(d->avctx, &d->pkt_temp); + got_frame = 0; + if (ret >= 0 || ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { + if (ret >= 0) { decoded = d->pkt_temp.size; } + ret = avcodec_receive_frame(d->avctx, frame); + if (ret >= 0) + got_frame = 1; + if (ret == AVERROR_EOF) + ret = 0; + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) + ret = 0; + } + ret = decoded; + } +#else /*CONFIG_FFMPEGNEWAPISENDPACKET*/ ret = avcodec_decode_audio4(d->avctx, frame, &got_frame, &d->pkt_temp); +#endif /*CONFIG_FFMPEGNEWAPISENDPACKET*/ if (got_frame) { AVRational tb = (AVRational){1, frame->sample_rate}; if (frame->pts != AV_NOPTS_VALUE) -- 2.12.0