From patchwork Thu Sep 15 02:56:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 580 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp2974673vsd; Wed, 14 Sep 2016 20:06:58 -0700 (PDT) X-Received: by 10.194.59.116 with SMTP id y20mr5365652wjq.181.1473908817990; Wed, 14 Sep 2016 20:06:57 -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 p13si336158wmd.97.2016.09.14.20.06.56; Wed, 14 Sep 2016 20:06:57 -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; dkim=neutral (body hash did not verify) header.i=@overt.org; dkim=neutral (body hash did not verify) header.i=@overt.org; 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 536DB689ECD; Thu, 15 Sep 2016 06:06:28 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from rs224.mailgun.us (rs224.mailgun.us [209.61.151.224]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 67F2F689E54 for ; Thu, 15 Sep 2016 06:06:20 +0300 (EEST) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=overt.org; q=dns/txt; s=k1; t=1473908791; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=4dcgTfCSklzgWfkcrK/NPKm/l2YHuTVYSnXpT0ZErQ8=; b=IhMAfwj5U8+ln1PwkcDU6xUE8zW9DmxJAYGQ057Ml+NH4jTNH7F4kkH5ypIs1DWuWsUMVmSk CYZdzENPl1GSzanLbGPulUTMhBwi05+ZorzdtZDZtfiIy0KsN/zblLG51KGHVAWqOLIQRaDh thcn6eL9WGRujQSlb2QKnqyLS58= DomainKey-Signature: a=rsa-sha1; c=nofws; d=overt.org; s=k1; q=dns; h=Sender: From: To: Cc: Subject: Date: Message-Id: In-Reply-To: References; b=QlLmAfZvQ/1+FDhAEEjOxhCsWye9AVkstJ0eNWY9uF88fLZkZGlBRkv20rAoj7tIPupn08 prXorwJ9lfepCmuRNN5gJIjTw0FyUqj+PZ8wtwo5tIzmcZzH4gGHMbmSPzCnSfzQq5qBB63C RN5snyDHrBcdn6zXNZRDjfEuQuKY4= X-Mailgun-Sending-Ip: 209.61.151.224 X-Mailgun-Sid: WyIyM2Q3MCIsICJmZm1wZWctZGV2ZWxAZmZtcGVnLm9yZyIsICI0YTg5NjEiXQ== Received: from mail.overt.org (155.208.178.107.bc.googleusercontent.com [107.178.208.155]) by mxa.mailgun.org with ESMTP id 57da0dce.7f432867a998-in06; Thu, 15 Sep 2016 02:56:14 -0000 (UTC) Received: from authenticated-user (mail.overt.org [107.178.208.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id 443F66AA81; Thu, 15 Sep 2016 02:56:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1473908174; bh=DIMLFKb98CnDoU0vixqjukrfEkeMxcMbOuxoTmAsTLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R/2BWcsiWa5zTMNFltu8awJzZWNsp4VaHS/0a7GCptJpBO0qMBR1AeuZQIwzNNsV1 jI/ZAJ91D7fN8SW4q6BYDLOPye6sCLNowcRvew46WDUhRWhtexZ0cVx/oJ6P3J15E6 bk3WStI0vm9HueGBmha7GezPsrNgHGjbYsyIS/tHNb0b6R5TRSUjXnq4puAg3bPs9E lVUuRJ2C/bjYZ82J33098UNrpYsxqTx0pgTjvBTVH0vKzp4Jsv2aY+dgsX62oQ0KhF VUdJdl3m7FJXjBZQFhniWRWtk/6boxhZ7RaWmJxyX2vbpn8rZCmQ/GNHdnmB627XMM uYtOe/3Eg9Z8g== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Sep 2016 19:56:07 -0700 Message-Id: <1473908168-31888-2-git-send-email-philipl@overt.org> In-Reply-To: <1473908168-31888-1-git-send-email-philipl@overt.org> References: <1473908168-31888-1-git-send-email-philipl@overt.org> Subject: [FFmpeg-devel] [PATCH 1/2] cuvid: Fully re-initialize the parser after a flush. 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: Philip Langdale MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" I'm not really sure how this worked at all before, but we do need to reinitalize the parser with the stream extradata. Signed-off-by: Philip Langdale --- libavcodec/cuvid.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c index 19a7772..880a572 100644 --- a/libavcodec/cuvid.c +++ b/libavcodec/cuvid.c @@ -706,6 +706,7 @@ static void cuvid_flush(AVCodecContext *avctx) AVHWDeviceContext *device_ctx = (AVHWDeviceContext*)ctx->hwdevice->data; AVCUDADeviceContext *device_hwctx = device_ctx->hwctx; CUcontext dummy, cuda_ctx = device_hwctx->cuda_ctx; + CUVIDSOURCEDATAPACKET seq_pkt = { 0, }; int ret; ctx->ever_flushed = 1; @@ -736,6 +737,15 @@ static void cuvid_flush(AVCodecContext *avctx) if (ret < 0) goto error; + seq_pkt.payload = ctx->cuparse_ext.raw_seqhdr_data; + seq_pkt.payload_size = ctx->cuparse_ext.format.seqhdr_data_length; + + if (seq_pkt.payload && seq_pkt.payload_size) { + ret = CHECK_CU(cuvidParseVideoData(ctx->cuparser, &seq_pkt)); + if (ret < 0) + goto error; + } + ret = CHECK_CU(cuCtxPopCurrent(&dummy)); if (ret < 0) goto error;