The Tx1 API NvCreateBuffer is corruption when i use this interface to create buffer

I use NvCreateBuffer to create an image buffer at the pixel format NvBufferColorFormat_ABGR32,it will corrupt at this interface. The code as follow:

if (-1 == NvBufferCreate(&fd, dst_roi_.width , dst_roi_.height,
                                        NvBufferLayout_Pitch,
                                       <b> NvBufferColorFormat_ABGR32))</b>
                                        //NvBufferColorFormat_NV12))

but use the pixel format NvBufferColorFormat_NV12 is not corrupt. I really dont konw why?
the gdb info as follow:

#0  0x0000007fb4b53528 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x0000007fb4b549e0 in __GI_abort () at abort.c:89
#2  0x0000007fb4b8a8c4 in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7fb4c3b550 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175
#3  0x0000007fb4b902ec in malloc_printerr (action=<optimized out>, str=0x7fb4c3b628 "double free or corruption (!prev)", ptr=<optimized out>, ar_ptr=<optimized out>) at malloc.c:5006
#4  0x0000007fb4b91088 in _int_free (av=0x7fb4c639a0 <main_arena>, p=<optimized out>, have_lock=0) at malloc.c:3867
<b>#5  0x0000007fb6ed9b6c in NvBufferCreate () from /usr/lib/aarch64-linux-gnu/tegra/libnvbuf_utils.so.1.0.0</b>
#6  0x000000000041208c in ArgusSamples::stitch_vic_init () at main.cpp:1405
#7  0x0000000000413070 in main (argc=5, argv=0x7ffffff4c8) at main.cpp:1843
(gdb)

@Allen
Could you help to confirm the “NvBufferLayout_BlockLinear” have the same problem?

yes ,it will also corrupt use “NvBufferLayout_BlockLinear”

Hi allen, which sample do you run?

  1. We are using 4 cameras, it means 4 threads running to get frames from argus API. then convert to ABGR32 to handle the rgb iamge.
  2. One VIC to convert the ABGR32 to YUV42M, then feed to One encoder for RTMP.

The camera we are using are OV4689 with NV ISP.

NvBufferCreate will be corrupt with ABGR32 format. I tried to place it at the beginning of the main(), it corrupt, just follow the args API it corrupt. looks like it will corrupt with NV ISP enabled.

We tried to using OV5645 with almost the same pipe line but with V4l2 to get framte. it works fine.

Hi Allen, Argus outputs only NV12 and I420. You need NvVideoConverter to convert to RGBA.

@NaneLLL

Yes, I know that, We convert from argus ouput to BGRA. then handle the BGRA image, after that we create a NVBUFFER with format BGRA, so that we can convert the BGRA to YUV420M for encoder input.

Please share a test code to reproduce the issue with onboard ov5693. Thanks.

We flush a new ubuntu os and instll essential packages ,and test use ov5693, it will also corrupt.we put the NvBufferCreate on the first line of main() function. The code as follow:

int main(int argc, const char *argv[])
{
      printf("---------------before NvBufferCreate\n");
      int fd = 0;
       NvBufferCreate(&fd, 1000 , 1000, NvBufferLayout_Pitch, NvBufferColorFormat_NV12);
     printf("---------------after NvBufferCreate\n");
}

Does someone else has ever encounter the same problem ? I doubt is the developing environment lead to this problem.

We would like you to share full sample and Makefile to reproduce the issue. Fragmented information cannot help us check further. Please.

I have put the whole code on baiduyun, you can donload and have a test.
the test code and makefile’s path is as follow:

camera/camera/test1

the baiduyu share link is as follow:

链接:http://pan.baidu.com/s/1c13OP0G 密码:7by0

hi Allen,
On r28.1/TX1, it runs fine:

nvidia@tegra-ubuntu:~/camera/camera/test1$ ls
detection  main.cpp  main.o  Makefile
nvidia@tegra-ubuntu:~/camera/camera/test1$ ./detection
-----before NvBufferCreate---
-----after NvBufferCreate---
nvidia@tegra-ubuntu:~/camera/camera/test1$$

Are you on r28.1?

we test on 24.2.1, could you have a test on this version.we hope a resolution based on 24.2.1, which is close to our product

Hi allen, your nvbuf_utils.h is not correct. On r24.2.1, it only supports

typedef enum
{
  NvBufferColorFormat_YUV420,
  NvBufferColorFormat_YVU420,
  NvBufferColorFormat_NV12,
  NvBufferColorFormat_NV21,
  NvBufferColorFormat_UYVY,
  NvBufferColorFormat_ABGR32,
  NvBufferColorFormat_XRGB32,
  NvBufferColorFormat_Invalid,
} NvBufferColorFormat;

thank you very much ,it’s just the ‘enum’ which lead to this problem.