[FFmpeg-devel] [PATCH] avcodec/cuvid: Use a dummy packet to flush cuvid.

Timo Rothenpieler timo at rothenpieler.org
Tue May 16 11:32:08 EEST 2017


Am 16.05.2017 um 10:27 schrieb Wiki Wang:
> ---
>  libavcodec/cuvid.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
> index 218be8495d..0b1710bd46 100644
> --- a/libavcodec/cuvid.c
> +++ b/libavcodec/cuvid.c
> @@ -1029,20 +1029,13 @@ static void cuvid_flush(AVCodecContext *avctx)
>          return;
>      }
>  
> -    if (ctx->cudecoder) {
> -        ctx->cvdl->cuvidDestroyDecoder(ctx->cudecoder);
> -        ctx->cudecoder = NULL;
> -    }
> +    seq_pkt.flags = CUVID_PKT_ENDOFSTREAM;
>  
> -    if (ctx->cuparser) {
> -        ctx->cvdl->cuvidDestroyVideoParser(ctx->cuparser);
> -        ctx->cuparser = NULL;
> -    }
> -
> -    ret = CHECK_CU(ctx->cvdl->cuvidCreateVideoParser(&ctx->cuparser, &ctx->cuparseinfo));
> +    ret = CHECK_CU(ctx->cvdl->cuvidParseVideoData(ctx->cuparser, &seq_pkt));
>      if (ret < 0)
>          goto error;
>  
> +    seq_pkt.flags = 0;
>      seq_pkt.payload = ctx->cuparse_ext.raw_seqhdr_data;
>      seq_pkt.payload_size = ctx->cuparse_ext.format.seqhdr_data_length;
>  
> 

I'm not exactly sure what was the issue for this to be done this way,
but I remember there being some issue with just flushing the decoder,
hence the re-creation.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170516/f72f1465/attachment.sig>


More information about the ffmpeg-devel mailing list