Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

Commit

Permalink
avcodec/cuvid: Fully re-initialize the parser after a flush.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Timo Rothenpieler <[email protected]>
  • Loading branch information
philipl authored and BtbN committed Sep 17, 2016
1 parent 4096bb1 commit 8a06669
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libavcodec/cuvid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8a06669

Please sign in to comment.