AR# 73274

2019.1 Zynq UltraScale+ MPSoC VCU - Why does the VCU decoder crash when trying to read video data from a file in small chunks using the vcu_omx_decoder application?

描述

Why does the VCU decoder crash when trying to read video data from a file in small chunks?

When the decoder tries to read data chunk by chunk (for example reading 10240 bytes each time), it crashes.

Process 286759 (vcu_omx_decoder) terminated SIGSEGV code=1 fltno=11 ip=0000000001079358(/usr/lib/ldqnx-64.so.2@__memcpy_isr+0x0000000000000198) mapaddr=0000000000079358. ref=0000000028000000
Memory fault (core dumped) 

解决方案

Normally the VCU decoder allocates a large buffer using the frame.data() argument from the infile.read API.

The infile.read API is part of main.cpp.

The following change needs to be made to the code to read data in small chunks:

static bool readFrame(OMX_BUFFERHEADERTYPE* pInputBuf, Application& app)
{
  assert(pInputBuf->nAllocLen != 0);
  vector<uint8_t> frame(pInputBuf->nAllocLen);
 
  printf("readFrame, pInputBuf->nAllocLen: %d, pInputBuf->nOffset: %d, frame.size: %d\n", pInputBuf->nAllocLen, pInputBuf->nOffset, frame.size());

  infile.read((char*)frame.data(), 10240);
  auto data = (char*)(pInputBuf->pBuffer + pInputBuf->nOffset);
  memcpy(data, frame.data(), 10240);

  pInputBuf->nFilledLen = infile.gcount();
  printf("readFrame, pInputBuf->nFilledLen: %d\n", pInputBuf->nFilledLen);
  if(infile.peek() == EOF)
 

{    printf("EXIT readFrame, true\n");     return true;   }
  printf("EXIT readFrame, false\n");
  return false;
}


There is a known issue with the vcu_omx_decoder application when it is modified to read chunks of 10240 bytes from the file source. 

Once the input buffer has read the first bytes of data, it gets deleted by buffer handling operations to free it up to read new data. 

As a result of this operation, a memory fault error is reported. 

For effective operation of the decoder, complete frame data should be retained and the buffer should be freed without destroying memory.

  • 2019.1 - Users can download the PetaLinux Recipes and Patch files from (Xilinx Answer 72324) to work around this issue
  • 2019.2 - This issue will be resolved in the 2019.2 release and later versions

链接问答记录

主要问答记录

AR# 73274
日期 01/25/2020
状态 Active
Type 已知问题
器件
Tools
IP
Boards & Kits