Hi team!
I’m working on h265 decoding via the multimedia API, and while I’ve gotten the tool initially working, I find its not very stable when working with more complex/random-like data. Whenever I enter encoded H265 frames of snow or other complex samples, it segfaults when entering the decoder capture loop thread, as shown below. From my own debugging, I believe this may be a problem internal to the ‘ctx->dec->dqEvent(ev, 50000);’ call at the beginning do-while loop of dec_capture_loop_fcn(), but unfortunately I do not access to debug it further (I made sure ctx->dec exist as well). Is this a known bug with the decoder, or the encoder, or possibly even user error? The goal is to encode/decode frames beyond just snow, but the same problem is causing my actual samples to fail decoding as well.
$ gst-launch-1.0 videotestsrc num-buffers=30 pattern=snow ! ‘video/x-raw, width=(int)1920, height=(int)1080, format=(string)NV24’ ! filesink location=~/snow30.yuv
$ ./01_video_encode/video_encode ~/snow30.yuv 1920 1080 H265 ~/snow30_comp.h265 --elossless -cf 3 --sp
$ ./00_video_decode/video_decode H265 --disable-rendering -f 4 -o ~/snow30_decomp.yuv ~/snow30_comp.h265
Set governor to performance before enabling profiler
Creating decoder in blocking mode
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 279
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 279
Setting frame input mode to 1
Starting decoder capture loop thread
Segmentation fault (core dumped)
static void *
dec_capture_loop_fcn(void *arg)
{
context_t *ctx = (context_t *) arg;
NvVideoDecoder *dec = ctx->dec;
struct v4l2_event ev;
int ret;
cout << "Starting decoder capture loop thread" << endl;
/* Need to wait for the first Resolution change event, so that
the decoder knows the stream resolution and can allocate appropriate
buffers when we call REQBUFS. */
do
{
/* Refer ioctl VIDIOC_DQEVENT */
ret = dec->dqEvent(ev, 50000); // Culprit in question !!!
if (ret < 0)
{
if (errno == EAGAIN)
{
cerr <<
"Timed out waiting for first V4L2_EVENT_RESOLUTION_CHANGE"
<< endl;
}
else
{
cerr << "Error in dequeueing decoder event" << endl;
}
abort(ctx);
break;
}
}
while ((ev.type != V4L2_EVENT_RESOLUTION_CHANGE) && !ctx->got_error);
/* Received the resolution change event, now can do query_and_set_capture. */
if (!ctx->got_error)
query_and_set_capture(ctx);
...