H264 CUDA stream decoder problem

I have a problem when I decode H264 stream data with nvidia video decoding library.

I modified cudaDecodeGL sample source in order to feed stream data from CCTV, not video file.

I saved the first frame as a file and then loaded that file to initialize decoder and the way is exactly the same as cudaDecodeGL sample source.

And then I put the stream data into the decoder.

The following is my feeding source code.

void CCudaDecoder::FuncDecodePicture(unsigned char* pBitstreamData, unsigned int nBitstreamDataLen)

{

VideoSourceData videoSouceData = { g_pVideoParser->hParser_, g_pFrameQueue };

CUVIDSOURCEDATAPACKET dataPacket = { 0, nBitstreamDataLen, pBitstreamData, 0 };

g_pVideoSource->HandleVideoData(&videoSouceData, &dataPacket);

return;

}

But this code is not working properly.

As soon as I made my function call, VideoParser calls the following function; “VideoDecoder::decodePicture(CUVIDPICPARAMS * pPictureParameters, CUcontext * pContext)”

However nothing happens in FrameQueue even though decodePicture function returns CUDA_SUCCESS.

It was supposed to be called “HandlePictureDisplay” function and then enqueue the decoded frame to the frameQueue.

If I change my code like this

CUVIDSOURCEDATAPACKET dataPacket = { CUVID_PKT_ENDOFSTREAM, nBitstreamDataLen, pBitstreamData, 0 };

, the first frame is decoded and enqueue the frameQueue.

But the first frame only changed.

Even the decodePicture function does not called after I changed the code.

The data is absolutely correct!

Because it works well in any other libraries.

Please let me know what I can do to solve this problem.

Thank you in advance.

Depending on your data format, if you’re passing in your first frame and it’s not a keyframe, then it won’t be decoded. If you’re doing streaming, it’s possible that this could happen.
The CUVID library is a black box, and the users only way of interacting with it is though those user-defined asynchronous callback functions. If it’s not triggering your callback function in the next stage of the decoding pipeline, then it means the CUVID library failed somewhere between there.

Hi sky0714

Were you able to solve this issue. I am also trying to do the same thing here and don’t know how to proceed.

Thanks

Hi,

I’m currently facing the same issue of the callbacks not being triggered. Did anyone have to initialize the decoder? additionally, were you able to resolve this issue?