@DaneLLL Thanks for the response
Not sure but the plane may not be completely cleaned. Please try like:
NvBufferParams par;
int size;
NvBufferGetParams (dmabuf_fd, &par);
void *ptr_uv;
NvBufferMemMap(dmabuf_fd, 1, NvBufferMem_Write, &ptr_uv);
NvBufferMemSyncForCpu(dmabuf_fd, 1, &ptr_uv);
memset (ptr_uv, 0x80, par.psize[1]);
NvBufferMemSyncForDevice (dmabuf_fd, 1, &ptr_uv);
NvBufferMemUnMap(dmabuf_fd, 1, &ptr_uv);
We will try it out and update
We suggest apply your thoughts to the sample and give it a try. Ideally it should work. If it doesn’t work as your expectation, please follow the default sample and put nvbuff_do_clearchroma() in the for loop and while loop.
On this issue
We had tried the following logic as suggested earlier to avoid twice calling the UV cleaning function in the for and while loop in the 10_camera_recording MM API sample
while (!m_gotError)
{
for (int bufferIndex = 0; bufferIndex < MAX_ENCODER_FRAMES; bufferIndex++) /*MAX_ENCODER_FRAMES = 5 */
{
printf("\n Inside the encoder function\n");
v4l2_buf.index = bufferIndex;
Buffer* buffer = stream->acquireBuffer(); /*stream->acquireBuffer();*/
/* Convert Argus::Buffer to DmaBuffer and queue into v4l2 encoder
*/
DmaBuffer *dmabuf = DmaBuffer::fromArgusBuffer(buffer);
CHECK_ERROR(m_VideoEncoder->output_plane.qBuffer(v4l2_buf, dmabuf)); /*qBuffer_to_encoder;*/
);
}
NvBuffer *share_buffer;
CHECK_ERROR(m_VideoEncoder->output_plane.dqBuffer(v4l2_buf, NULL,
&share_buffer, 10/*retry*/)); /*dqBuffer_from_encoder;*/
DmaBuffer *dmabuf = static_cast<DmaBuffer*>(share_buffer);
stream->releaseBuffer(dmabuf->getArgusBuffer()); /* stream->releaseBuffer();*/
}
But we were getting the following error logs
PRODUCER: Launching consumer thread
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
875967048
842091865
create video encoder return true
H264: Profile = 100, Level = 50
Inside the encoder function
PRODUCER: Starting repeat capture requests.
Inside the encoder function
Inside the encoder function
Inside the encoder function
Inside the encoder function
Inside the encoder function
Inside the encoder function
[ERROR] (NvV4l2ElementPlane.cpp:256) Output Plane:Error while Qing buffer: Device or resource busy
Error generated. main_1.cpp, threadExecute:470 m_VideoEncoder->output_plane.qBuffer(v4l2_buf, dmabuf) failed
Error generated. /usr/src/jetson_multimedia_api/argus/samples/utils/Thread.cpp, threadFunction:132 (propagating)
[ERROR] (NvV4l2ElementPlane.cpp:178) Capture Plane:Error while DQing buffer: Broken pipe
Could you please provide some insights where we are wrong on the above logic, from these error logs?