Skip to content

Commit

Permalink
cuda: release old parser before create
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Mar 25, 2014
1 parent b6e2ed3 commit 61390de
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/VideoDecoderCUDA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 30,8 @@
/*
* TODO: update helper_cuda with 5.5
* avc1, ccv1 => h264 sps, pps, nal. use filter or lavcudiv
* http://blog.csdn.net/gavinr/article/details/7183499
* https://www.ffmpeg.org/ffmpeg-bitstream-filters.html
* flush api
* CUDA_ERROR_INVALID_VALUE "cuvidDecodePicture(p->dec, cuvidpic)"
*/
Expand Down Expand Up @@ -155,7 157,14 @@ class VideoDecoderCUDAPrivate : public VideoDecoderPrivate
return true;
}
bool releaseCuda() {
cuvidDestroyDecoder(dec);
if (dec) {
cuvidDestroyDecoder(dec);
dec = 0;
}
if (parser) {
cuvidDestroyVideoParser(parser);
parser = 0;
}
if (stream) {
cuStreamDestroy(stream);
stream = 0;
Expand Down Expand Up @@ -218,6 227,10 @@ class VideoDecoderCUDAPrivate : public VideoDecoderPrivate
available = false;
return false;
}
if (parser) {
cuvidDestroyVideoParser(parser);
parser = 0;
}
//lavfilter check level C
CUVIDPARSERPARAMS parser_params;
memset(&parser_params, 0, sizeof(CUVIDPARSERPARAMS));
Expand Down

0 comments on commit 61390de

Please sign in to comment.