A strange issue of convertor in MMAPI

Hi, I encountered a strange issue of convertor in MMAPI.

When i modify the output data of convertor, it will affect the future output.
I have modifed “00_video_decode” to reproduce this issue.
In “conv0_capture_dqbuf_thread_callback” function, my modification as follows:

static bool
conv0_capture_dqbuf_thread_callback(struct v4l2_buffer *v4l2_buf,
                                    NvBuffer * buffer, NvBuffer * shared_buffer,
                                    void *arg)
{
    context_t *ctx = (context_t *) arg;

    if (!v4l2_buf)
    {
        cerr << "Error while dequeueing conv capture plane buffer" << endl;
        abort(ctx);
        return false;
    }

    if (v4l2_buf->m.planes[0].bytesused == 0)
    {
        return false;
    }

    // Write raw video frame to file and return the buffer to converter
    // capture plane
    if (!ctx->stats && ctx->out_file)
    {
        write_video_frame(ctx->out_file, *buffer);
    }

	//TEST: modify the output data
	{
		int i, j;
		
		for(i=0; i<120; i++)
		{
			for(j=0; j<120; j++)
			{	
				buffer->planes[0].data[i*buffer->planes[0].fmt.stride + j] = 0;
			}
		}		
	}

    if (!ctx->stats && !ctx->disable_rendering)
    {
        ctx->renderer->render(buffer->planes[0].fd);
    }

    if (ctx->conv->capture_plane.qBuffer(*v4l2_buf, NULL) < 0)
    {
        return false;
    }
    return true;
}

In this function, i modify the output data after write yuv data in file. But I find the yuv data in file is incorrect.

Is there any advice?

Can NVIDIA answer this issue? If you cannot reproduce it, please tell me.
Thanks!

I have tested this issue on L4T R28.1, but it always occur.

I’m waiting the answer, please give me some advices.

Hi zcs, can you share more detail on the issue?
Looks like you modify the buffer after YUV is dumped.
if (!ctx->stats && ctx->out_file)
{
write_video_frame(ctx->out_file, *buffer);
}

//TEST: modify the output data
{
	int i, j;
	
	for(i=0; i<120; i++)
	{
		for(j=0; j<120; j++)
		{	
			buffer->planes[0].data[i*buffer->planes[0].fmt.stride + j] = 0;
		}
	}		
}

Hi DaneLLL,

The modified area looks unusual, have some line or point. But I use the cuda to modify YUV data, that is OK, I don’t know why.

Please refer to https://devtalk.nvidia.com/default/topic/1019543/jetson-tx2/fail-to-mmap-the-capture_plane-of-decoder-in-mmapi/post/5194847/#5194847