[MMAPI] Under what conditions, ‘conv->capture_plane.qBuffer’ will block

I refer to samples/00_video_decode to write a video decoding display thread, the code can be normal decoding and display, the thread can create multiple (multi-channel decoding), but when I destroy the resources, and then re-create, will block to Query_and_set_capture function ctx->conv->capture_plane.qBuffer(v4l2_buf, NULL);

I have been troubleshooting and have not found the reason for a long time. Please give me some advice
thanks a lot.

Here is part of the code

#include "NvApplicationProfiler.h"
#include "NvUtils.h"
#include <errno.h>
#include <fstream>
#include <iostream>
#include <linux/videodev2.h>
#include <malloc.h>
#include <pthread.h>
#include <string.h>
#include <unistd.h>
#include "NvVideoDecoder.h"
#include "NvVideoConverter.h"
#include "NvEglRenderer.h"
#include <queue>
#include <fstream>
#include <pthread.h>
#include <fcntl.h>

#include "pthread_mmapi_dec_app.h"

#include "suma_osa_thr.h"
#include "davinci_base.h"
#include "pthread_base.h"
#include "suma_trace_log.h"
#include "suma_api.h"
#include "suma_osa.h"

#define TEST_ERROR(cond, str, label) if(cond) { \
	cerr << str << endl; \
	goto label; }

#define CHUNK_SIZE 1000000
#define MIN(a,b) (((a) < (b)) ? (a) : (b))

#define IS_NAL_UNIT_START(buffer_ptr) (!buffer_ptr[0] && !buffer_ptr[1] && \
		!buffer_ptr[2] && (buffer_ptr[3] == 1))

#define IS_NAL_UNIT_START1(buffer_ptr) (!buffer_ptr[0] && !buffer_ptr[1] && \
		(buffer_ptr[2] == 1))

/* report level and macro */
#define RPT_ERR (1) /* error, system error */
#define RPT_WRN (2) /* warning, maybe wrong, maybe OK */
#define RPT_INF (3) /* important information */
#define RPT_DBG (4) /* debug information */

#ifndef S_SPLINT_S /* FIXME */
#define RPTERR(fmt, ...) if(RPT_ERR <= rpt_lvl) fprintf(stderr, "%s: %s: %d: err: " fmt "\n", __FILE__, __func__, __LINE__, ##__VA_ARGS__)
#define RPTWRN(fmt, ...) if(RPT_WRN <= rpt_lvl) fprintf(stderr, "%s: %s: %d: wrn: " fmt "\n", __FILE__, __func__, __LINE__, ##__VA_ARGS__)
#define RPTINF(fmt, ...) if(RPT_INF <= rpt_lvl) fprintf(stderr, "%s: %s: %d: inf: " fmt "\n", __FILE__, __func__, __LINE__, ##__VA_ARGS__)
#define RPTDBG(fmt, ...) if(RPT_DBG <= rpt_lvl) fprintf(stderr, "%s: %s: %d: dbg: " fmt "\n", __FILE__, __func__, __LINE__, ##__VA_ARGS__)
static int rpt_lvl = RPT_WRN; /* report level: ERR, WRN, INF, DBG */
#else
#define RPTERR(fmt...)
#define RPTWRN(fmt...)
#define RPTINF(fmt...)
#define RPTDBG(fmt...)
#endif

#ifndef OFFSET
#define OFFSET(structure, member) ((int) &(((structure *) 0) -> member))
#endif

#define MMAPI_DEC_STACK_SIZE   10*1024*1024
#define MODULE_NAME     "nv_mmapi_dec"

#define MMAPI_DEC_OUTPUT_PLANE_BUFFER_NUM 10

typedef struct
{
	NvVideoDecoder *dec;
	NvVideoConverter *conv;
	uint32_t decoder_pixfmt;

	NvEglRenderer *renderer;

	bool disable_rendering;
	bool fullscreen;
	uint32_t window_height;
	uint32_t window_width;
	uint32_t window_x;
	uint32_t window_y;
	uint32_t out_pixfmt;
	float fps;

	bool disable_dpb;

	bool input_nalu;

	bool stats;

	bool enable_metadata;
	enum v4l2_skip_frames_type skip_frames;

	std::queue < NvBuffer * > *conv_output_plane_buf_queue;
	pthread_mutex_t queue_lock;
	pthread_cond_t queue_cond;

	pthread_t dec_capture_loop;
	bool got_error;
	bool got_eos;
	int chn_id;
} nv_mmapi_dec_context_t;

using namespace std;

typedef struct 
{
	TASK_COMMON_MEMBERS

	suma_ipc_handle ipc_in_es;
	int channel;
	
}nv_mmapi_dec_obj;

params_def nv_mmapi_dec_dynamic_params_def[] = {
	{OFFSET(struct nv_mmapi_dec_dynamic_params, ctrl), PT_VAR_INT | PT_MALLOC_FREE, sizeof(int), FUNC_CLOSE, FUNC_OPEN},
	{OFFSET(struct nv_mmapi_dec_dynamic_params, decode_type), PT_VAR_INT| PT_MALLOC_FREE, sizeof(int), NV_MMAPI_DECODE_H265, NV_MMAPI_DECODE_H264},
	{OFFSET(struct nv_mmapi_dec_dynamic_params, bitrate), PT_VAR_INT| READONLY, sizeof(int), 0, 10000},
	{OFFSET(struct nv_mmapi_dec_dynamic_params, fps), PT_VAR_INT| READONLY, sizeof(int), 0, 10000},
	{OFFSET(struct nv_mmapi_dec_dynamic_params, window_x), PT_VAR_INT| PT_MALLOC_FREE, sizeof(int), 0, 10000},
	{OFFSET(struct nv_mmapi_dec_dynamic_params, window_y), PT_VAR_INT| PT_MALLOC_FREE, sizeof(int), 0, 10000},
	{OFFSET(struct nv_mmapi_dec_dynamic_params, window_width), PT_VAR_INT| PT_MALLOC_FREE, sizeof(int), 0, 10000},
	{OFFSET(struct nv_mmapi_dec_dynamic_params, window_height), PT_VAR_INT| PT_MALLOC_FREE, sizeof(int), 0, 10000},
	{0, 0, 0, 0, 0}
};

const nv_mmapi_dec_dynamic_params glb_nv_mmapi_dec_dynamic_params_default = 
{
	FUNC_OPEN,
	NV_MMAPI_DECODE_H265,
	0,
	0,
	0,
	0,
	0,
	0,
};

static void nv_mmapi_dec_pthread(nv_mmapi_dec_handle h);

	static void
abort(nv_mmapi_dec_context_t *ctx)
{
	ctx->got_error = true;
	ctx->dec->abort();
	if (ctx->conv)
    {
        ctx->conv->abort();
        pthread_cond_broadcast(&ctx->queue_cond);
    }
}

	static bool
conv0_output_dqbuf_thread_callback(struct v4l2_buffer *v4l2_buf,
								   NvBuffer * buffer, NvBuffer * shared_buffer,
								   void *arg)
{
	nv_mmapi_dec_context_t *ctx = (nv_mmapi_dec_context_t *) arg;
	struct v4l2_buffer dec_capture_ret_buffer;
	struct v4l2_plane planes[MAX_PLANES];

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

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

	memset(&dec_capture_ret_buffer, 0, sizeof(dec_capture_ret_buffer));
	memset(planes, 0, sizeof(planes));

	dec_capture_ret_buffer.index = shared_buffer->index;
	dec_capture_ret_buffer.m.planes = planes;

	pthread_mutex_lock(&ctx->queue_lock);
	ctx->conv_output_plane_buf_queue->push(buffer);

	// Return the buffer dequeued from converter output plane
	// back to decoder capture plane
	if (ctx->dec->capture_plane.qBuffer(dec_capture_ret_buffer, NULL) < 0)
	{
		abort(ctx);
		return false;
	}

	pthread_cond_broadcast(&ctx->queue_cond);
	pthread_mutex_unlock(&ctx->queue_lock);

	return true;
}

static bool
conv0_capture_dqbuf_thread_callback(struct v4l2_buffer *v4l2_buf,
									NvBuffer * buffer, NvBuffer * shared_buffer,
									void *arg)
{
	nv_mmapi_dec_context_t *ctx = (nv_mmapi_dec_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;
	}

	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;
}

	
	static void
nv_mmapi_init_args(nv_mmapi_dec_context_t * ctx, nv_mmapi_dec_dynamic_params *params)
{
	memset(ctx, 0, sizeof(nv_mmapi_dec_context_t));
	ctx->fullscreen = false;
	ctx->window_x = params->window_x;
	ctx->window_y = params->window_y;
	ctx->window_height = params->window_height;
	ctx->window_width = params->window_width;
	ctx->out_pixfmt = 1;
	ctx->decoder_pixfmt = params->decode_type == NV_MMAPI_DECODE_H265 ? V4L2_PIX_FMT_H265 : V4L2_PIX_FMT_H264;
	ctx->fps = 25.0;
	ctx->got_eos = false;
	ctx->got_error = false;

	printf("decode ctrl %d, fmt %s, x %d, y %d, w %d, h %d, fps %f\n", 
		params->ctrl,
		params->decode_type == NV_MMAPI_DECODE_H265 ? "H265" : "H264",
		ctx->window_x,
		ctx->window_y,
		ctx->window_width,
		ctx->window_height,
		ctx->fps
	);

	ctx->conv_output_plane_buf_queue = new queue < NvBuffer * >;

	pthread_mutex_init(&ctx->queue_lock, NULL);
	pthread_cond_init(&ctx->queue_cond, NULL);
}

static void
read_decoder_input_nalu(NvBuffer * buffer,
		uint8_t *nal_buffer, int nal_size)
{
	// Length is the size of the buffer in bytes
	char *buffer_ptr = (char *) buffer->planes[0].data;

	// Length is the size of the buffer in bytes
    int bytes_to_copy = MIN(CHUNK_SIZE, nal_size);

    memcpy(buffer_ptr, nal_buffer, bytes_to_copy);
    // It is necessary to set bytesused properly, so that decoder knows how
    // many bytes in the buffer are valid
    buffer->planes[0].bytesused = bytes_to_copy;
}

	static int
sendEOStoConverter(nv_mmapi_dec_context_t *ctx)
{
		printf("%s, %d\n",__func__,__LINE__);

	// Check if converter is running
	if (ctx->conv->output_plane.getStreamStatus())
	{
	printf("%s, %d\n",__func__,__LINE__);
		NvBuffer *conv_buffer;
		struct v4l2_buffer v4l2_buf;
		struct v4l2_plane planes[MAX_PLANES];

		memset(&v4l2_buf, 0, sizeof(v4l2_buf));
		memset(&planes, 0, sizeof(planes));

		v4l2_buf.m.planes = planes;
		pthread_mutex_lock(&ctx->queue_lock);
		while (ctx->conv_output_plane_buf_queue->empty())
		{
			pthread_cond_wait(&ctx->queue_cond, &ctx->queue_lock);
		}
		conv_buffer = ctx->conv_output_plane_buf_queue->front();
		ctx->conv_output_plane_buf_queue->pop();
		pthread_mutex_unlock(&ctx->queue_lock);

		v4l2_buf.index = conv_buffer->index;
		printf("%s, %d\n",__func__,__LINE__);

		// Queue EOS buffer on converter output plane
		return ctx->conv->output_plane.qBuffer(v4l2_buf, NULL);
	}
	return 0;
}

	static void
query_and_set_capture(nv_mmapi_dec_context_t * ctx)
{
	NvVideoDecoder *dec = ctx->dec;
	struct v4l2_format format;
	struct v4l2_crop crop;
	int32_t min_dec_capture_buffers;
	int ret = 0;
	int error = 0;
	uint32_t window_width;
	uint32_t window_height;
	char renderer_name[512];

	// Get capture plane format from the decoder. This may change after
	// an resolution change event
	ret = dec->capture_plane.getFormat(format);
	TEST_ERROR(ret < 0,
			"Error: Could not get format from decoder capture plane", error);

	// Get the display resolution from the decoder
	ret = dec->capture_plane.getCrop(crop);
	TEST_ERROR(ret < 0,
			"Error: Could not get crop from decoder capture plane", error);

	cout << "Video Resolution: " << crop.c.width << "x" << crop.c.height
		<< endl;

	// For file write, first deinitialize output and capture planes
    // of video converter and then use the new resolution from
    // decoder event resolution change
    /*
    if (ctx->conv)
    {
    
        ret = sendEOStoConverter(ctx);
        TEST_ERROR(ret < 0,
                   "Error while queueing EOS buffer on converter output",
                   error);
		printf("%s, %d\n",__func__,__LINE__);

        ctx->conv->capture_plane.waitForDQThread(2000);
		printf("%s, %d\n",__func__,__LINE__);

        ctx->conv->output_plane.deinitPlane();
		printf("%s, %d\n",__func__,__LINE__);
        ctx->conv->capture_plane.deinitPlane();
		printf("%s, %d\n",__func__,__LINE__);

        while(!ctx->conv_output_plane_buf_queue->empty())
        {
            ctx->conv_output_plane_buf_queue->pop();
        }
    }
    */
	printf("%s, %d\n",__func__,__LINE__);

	if (!ctx->disable_rendering)
	{
		// Destroy the old instance of renderer as resolution might have changed
		delete ctx->renderer;

		if (ctx->fullscreen)
		{
			// Required for fullscreen
			window_width = window_height = 0;
		}
		else if (ctx->window_width && ctx->window_height)
		{
			// As specified by user on commandline
			window_width = ctx->window_width;
			window_height = ctx->window_height;
		}
		else
		{
			// Resolution got from the decoder
			window_width = crop.c.width;
			window_height = crop.c.height;
		}

		//sprintf(renderer_name, "renderer%d", ctx->chn_id);
		// If height or width are set to zero, EglRenderer creates a fullscreen
		// window
		ctx->renderer =
			NvEglRenderer::createEglRenderer("renderer0", window_width,
					window_height, ctx->window_x,
					ctx->window_y);
		TEST_ERROR(!ctx->renderer,
				"Error in setting up renderer. "
				"Check if X is running or run with --disable-rendering",
				error);

		ctx->renderer->setFPS(ctx->fps);
		printf("set FPS %f\n", ctx->fps);
	}

	// deinitPlane unmaps the buffers and calls REQBUFS with count 0
	dec->capture_plane.deinitPlane();

	// Not necessary to call VIDIOC_S_FMT on decoder capture plane.
	// But decoder setCapturePlaneFormat function updates the class variables
	ret = dec->setCapturePlaneFormat(format.fmt.pix_mp.pixelformat,
			format.fmt.pix_mp.width,
			format.fmt.pix_mp.height);
	TEST_ERROR(ret < 0, "Error in setting decoder capture plane format", error);

	// Get the minimum buffers which have to be requested on the capture plane
	ret = dec->getMinimumCapturePlaneBuffers(min_dec_capture_buffers);
	TEST_ERROR(ret < 0,
			"Error while getting value of minimum capture plane buffers",
			error);
printf("%s, %d, min_dec_capture_buffers %d\n",__func__,__LINE__, min_dec_capture_buffers);
	// Request (min + 5) buffers, export and map buffers
	ret =
		dec->capture_plane.setupPlane(V4L2_MEMORY_MMAP,
				min_dec_capture_buffers + 5, false,
				false);
	TEST_ERROR(ret < 0, "Error in decoder capture plane setup", error);
	printf("%s, %d, dec cap plane buffs %d\n",__func__,__LINE__, min_dec_capture_buffers + 5);

	if (ctx->conv)
    {
    printf("%s, %d\n",__func__,__LINE__);
        ret = ctx->conv->setOutputPlaneFormat(format.fmt.pix_mp.pixelformat,
                                              format.fmt.pix_mp.width,
                                              format.fmt.pix_mp.height,
                                              V4L2_NV_BUFFER_LAYOUT_BLOCKLINEAR);
        TEST_ERROR(ret < 0, "Error in converter output plane set format",
                   error);
		printf("%s, %d\n",__func__,__LINE__);

        ret = ctx->conv->setCapturePlaneFormat((ctx->out_pixfmt == 1 ?
                                                    V4L2_PIX_FMT_NV12M :
                                                    V4L2_PIX_FMT_YUV420M),
                                                crop.c.width,
                                                crop.c.height,
                                                V4L2_NV_BUFFER_LAYOUT_PITCH);
        TEST_ERROR(ret < 0, "Error in converter capture plane set format",
                   error);
		printf("%s, %d\n",__func__,__LINE__);

        ret = ctx->conv->setCropRect(0, 0, crop.c.width, crop.c.height);
        TEST_ERROR(ret < 0, "Error while setting crop rect", error);
		printf("%s, %d\n",__func__,__LINE__);

        ret =
            ctx->conv->output_plane.setupPlane(V4L2_MEMORY_DMABUF,
                                                dec->capture_plane.
                                                getNumBuffers(), false, false);
        TEST_ERROR(ret < 0, "Error in converter output plane setup", error);
		printf("%s, %d, conv out bufs %d\n",__func__,__LINE__, dec->capture_plane.getNumBuffers());

        ret =
            ctx->conv->capture_plane.setupPlane(V4L2_MEMORY_MMAP,
                                                 dec->capture_plane.
                                                 getNumBuffers(), true, false);
        TEST_ERROR(ret < 0, "Error in converter capture plane setup", error);
		printf("%s, %d, conv cap bufs %d\n",__func__,__LINE__, dec->capture_plane.getNumBuffers());

        ret = ctx->conv->output_plane.setStreamStatus(true);
        TEST_ERROR(ret < 0, "Error in converter output plane streamon", error);

        ret = ctx->conv->capture_plane.setStreamStatus(true);
        TEST_ERROR(ret < 0, "Error in converter output plane streamoff", error);
		printf("%s, %d\n",__func__,__LINE__);

        // Add all empty conv output plane buffers to conv_output_plane_buf_queue
        for (uint32_t i = 0; i < ctx->conv->output_plane.getNumBuffers(); i++)
        {
            ctx->conv_output_plane_buf_queue->push(ctx->conv->output_plane.getNthBuffer(i));
        }
		printf("%s, %d\n",__func__,__LINE__);
		printf("conv cap buffers %d\n", ctx->conv->capture_plane.getNumBuffers());

        for (uint32_t i = 0; i < ctx->conv->capture_plane.getNumBuffers(); i++)
        {
            struct v4l2_buffer v4l2_buf;
            struct v4l2_plane planes[MAX_PLANES];

            memset(&v4l2_buf, 0, sizeof(v4l2_buf));
            memset(planes, 0, sizeof(planes));

            v4l2_buf.index = i;
            v4l2_buf.m.planes = planes;
			printf("%s, %d i %d\n",__func__,__LINE__, i);
            ret = ctx->conv->capture_plane.qBuffer(v4l2_buf, NULL);
            TEST_ERROR(ret < 0, "Error Qing buffer at converter capture plane",
                       error);
        }
		printf("%s, %d\n",__func__,__LINE__);
        ctx->conv->output_plane.startDQThread(ctx);
		printf("%s, %d\n",__func__,__LINE__);
        ctx->conv->capture_plane.startDQThread(ctx);
		printf("%s, %d\n",__func__,__LINE__);

    }
	printf("%s, %d\n",__func__,__LINE__);
	// Capture plane STREAMON
	ret = dec->capture_plane.setStreamStatus(true);
	TEST_ERROR(ret < 0, "Error in decoder capture plane streamon", error);
	printf("%s, %d\n",__func__,__LINE__);

	// Enqueue all the empty capture plane buffers
	for (uint32_t i = 0; i < dec->capture_plane.getNumBuffers(); i++)
	{
		struct v4l2_buffer v4l2_buf;
		struct v4l2_plane planes[MAX_PLANES];

		memset(&v4l2_buf, 0, sizeof(v4l2_buf));
		memset(planes, 0, sizeof(planes));

		v4l2_buf.index = i;
		v4l2_buf.m.planes = planes;
		ret = dec->capture_plane.qBuffer(v4l2_buf, NULL);
		TEST_ERROR(ret < 0, "Error Qing buffer at output plane", error);
	}
	cout << "Query and set capture successful" << endl;
	return;
	printf("%s, %d\n",__func__,__LINE__);

error:
	if (error)
	{
		abort(ctx);
		cerr << "Error in " << __func__ << endl;
	}
}

	static void *
dec_capture_loop_fcn(void *arg)
{
	nv_mmapi_dec_context_t *ctx = (nv_mmapi_dec_context_t *) arg;
	NvVideoDecoder *dec = ctx->dec;
	struct v4l2_event ev;
	int ret;
	uint32_t timer_now, timer_last;

	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
	{
		if (ctx->got_eos)
		{
			RPTWRN("exit waiting event loop");
			break;
		}
	
		ret = dec->dqEvent(ev, 2000);
		if (ret < 0)
		{
			if (errno == EAGAIN)
			{
				cerr <<
					"Timed out waiting for first V4L2_EVENT_RESOLUTION_CHANGE"
					<< endl;
				continue;
			}
			else
			{
				cerr << "Error in dequeueing decoder event" << endl;
			}
			abort(ctx);
			break;
		}
		
			
	}
	while (ev.type != V4L2_EVENT_RESOLUTION_CHANGE);

	// query_and_set_capture acts on the resolution change event
	if (!ctx->got_error)
		query_and_set_capture(ctx);

	// Exit on error or EOS which is signalled in main()
	while (!(ctx->got_error || dec->isInError() || ctx->got_eos))
	{
		NvBuffer *dec_buffer;

		// Check for Resolution change again
		ret = dec->dqEvent(ev, false);
		if (ret == 0)
		{
			switch (ev.type)
			{
				case V4L2_EVENT_RESOLUTION_CHANGE:
					query_and_set_capture(ctx);
					continue;
			}
		}

		while ((dec->capture_plane.getNumQueuedBuffers() > 0) && !ctx->got_eos)
		{
			struct v4l2_buffer v4l2_buf;
			struct v4l2_plane planes[MAX_PLANES];

			memset(&v4l2_buf, 0, sizeof(v4l2_buf));
			memset(planes, 0, sizeof(planes));
			v4l2_buf.m.planes = planes;

			// Dequeue a filled buffer
			ret = dec->capture_plane.dqBuffer(v4l2_buf, &dec_buffer, NULL, 0);
			if (ret)
			{
				if (errno == EAGAIN)
				{
					usleep(1000);
				}
				else
				{
					abort(ctx);
					cerr << "Error while calling dequeue at capture plane" <<
						endl;
				}
				break;
			}

			
#if 0
			// EglRenderer requires the fd of the 0th plane to render the buffer
			ctx->renderer->render(dec_buffer->planes[0].fd);

			timer_now = suma_getCurTimeInMsec();
			RPTDBG("render time delta %u\n",timer_now - timer_last);
			timer_last = timer_now;

			// Not writing to file
			// Queue the buffer back once it has been used.
			if (dec->capture_plane.qBuffer(v4l2_buf, NULL) < 0)
			{
				abort(ctx);
				cerr <<
					"Error while queueing buffer at decoder capture plane"
					<< endl;
				break;
			}

#else
			NvBuffer *conv_buffer;
            struct v4l2_buffer conv_output_buffer;
            struct v4l2_plane conv_planes[MAX_PLANES];

            memset(&conv_output_buffer, 0, sizeof(conv_output_buffer));
            memset(conv_planes, 0, sizeof(conv_planes));
            conv_output_buffer.m.planes = conv_planes;

            // Get an empty conv output plane buffer from conv_output_plane_buf_queue
            pthread_mutex_lock(&ctx->queue_lock);
            while (ctx->conv_output_plane_buf_queue->empty())
            {
                pthread_cond_wait(&ctx->queue_cond, &ctx->queue_lock);
            }
            conv_buffer = ctx->conv_output_plane_buf_queue->front();
            ctx->conv_output_plane_buf_queue->pop();
            pthread_mutex_unlock(&ctx->queue_lock);

            conv_output_buffer.index = conv_buffer->index;

            if (ctx->conv->output_plane.
                qBuffer(conv_output_buffer, dec_buffer) < 0)
            {
                abort(ctx);
                cerr <<
                    "Error while queueing buffer at converter output plane"
                    << endl;
                break;
            }

#endif
			
			

		}

	}
	// Send EOS to converter
    if (ctx->conv)
    {
        if (sendEOStoConverter(ctx) < 0)
        {
            cerr << "Error while queueing EOS buffer on converter output"
                 << endl;
        }
    }
	cout << "Exiting decoder capture loop thread" << endl;
	return NULL;
}

	nv_mmapi_dec_handle 
nv_mmapi_dec_create(nv_mmapi_dec_static_params *static_params, nv_mmapi_dec_dynamic_params *dynamic_params)
{
	nv_mmapi_dec_obj *obj = NULL;
	nv_mmapi_dec_dynamic_params *params = NULL;

	obj = (nv_mmapi_dec_obj *)pthread_base_create(MODULE_NAME, sizeof(*obj));

	if(NULL == obj || NULL == static_params)
    {
        RPTERR(" creat NULL pointer");
        return NULL;
    }
	
	/*static params init*/
	obj->ipc_in_es = static_params->ipc_in_es;
    obj->channel= static_params->channel;

	//dynamic param table init
	obj->tab = nv_mmapi_dec_dynamic_params_def;
	obj->params_nums = sizeof(nv_mmapi_dec_dynamic_params_def) /(sizeof(params_def)) - 1 ; 

	params = (nv_mmapi_dec_dynamic_params *)calloc(1,sizeof(*params));
	if(NULL == params)
	{
		RPTERR("params create NULL pointer");
		pthread_base_delete(obj);
		return NULL;
	}

	if(dynamic_params == NULL)
	{
		memcpy(params,&glb_nv_mmapi_dec_dynamic_params_default,sizeof(nv_mmapi_dec_dynamic_params)); 
	}
	else
	{
		memcpy(params,dynamic_params,sizeof(nv_mmapi_dec_dynamic_params)); 
	}

	obj->params = params;
	obj->thread_func = (SUMA_ThrEntryFunc)nv_mmapi_dec_pthread;
	obj->stack_size = MMAPI_DEC_STACK_SIZE;

	return (nv_mmapi_dec_handle)obj;

}

static void nv_mmapi_dec_pthread(nv_mmapi_dec_handle h)
{
	nv_mmapi_dec_obj *handle = (nv_mmapi_dec_obj *)h;
	nv_mmapi_dec_dynamic_params *params = (nv_mmapi_dec_dynamic_params *)handle->params;
	nv_mmapi_dec_context_t ctx;
	char decname[512];
	char convname[512];
	int ret = 0;
	uint32_t frame_cnt;
	log_level = LOG_LEVEL_DEBUG;
	
	suma_ipc_handle ipc_in_es;
	heap_buf_handle heap_buf = NULL;
	int heap_buf_size = 0;
	uint8_t * heap_buf_ptr = NULL;
	
	ipc_in_es = handle->ipc_in_es;
	handle->exit_done_flg = FALSE;
	handle->exit_ctl = FALSE;
	while(!handle->exit_ctl )
	{
		handle->start_stop_rst = DEF_REMAIN;
		RPTWRN("enter start_stop_rst");
		while(!handle->start_stop_rst)
		{
			//start
			//init  sources,
			nv_mmapi_init_args(&ctx, params);
			ctx.chn_id = handle->channel;
			frame_cnt = 0;

			handle->malloc_free_rst = DEF_REMAIN;
			RPTWRN("enter malloc_free_rst");
			while(!handle->malloc_free_rst)
			{
				//malloc 
				//create dec,sub thread
				
				// Create a decoder
	        	sprintf(decname, "dec%d", handle->channel);
				ctx.dec = NvVideoDecoder::createVideoDecoder(decname, NULL);//, O_NONBLOCK);
				TEST_ERROR(!ctx.dec, "Could not create decoder", cleanup);

				// Subscribe to Resolution change event
				ret = ctx.dec->subscribeEvent(V4L2_EVENT_RESOLUTION_CHANGE, 0, 0);
				TEST_ERROR(ret < 0, "Could not subscribe to V4L2_EVENT_RESOLUTION_CHANGE", cleanup);

				// Set format on the output plane
				ret = ctx.dec->setOutputPlaneFormat(ctx.decoder_pixfmt, CHUNK_SIZE);
				TEST_ERROR(ret < 0, "Could not set output plane format", cleanup);

				// V4L2_CID_MPEG_VIDEO_DISABLE_DPB should be set after output plane
    			// set format
				ret = ctx.dec->disableDPB();
        		TEST_ERROR(ret < 0, "Error in decoder disableDPB", cleanup);

				// Query, Export and Map the output plane buffers so that we can read
				// encoded data into the buffers
				ret = ctx.dec->output_plane.setupPlane(V4L2_MEMORY_MMAP, MMAPI_DEC_OUTPUT_PLANE_BUFFER_NUM, true, false);
				TEST_ERROR(ret < 0, "Error while setting up output plane", cleanup);

				
				// Create converter to convert from BL to PL for writing raw video
				// to file
				sprintf(convname, "conv%d", handle->channel);
				ctx.conv = NvVideoConverter::createVideoConverter(convname);
				TEST_ERROR(!ctx.conv, "Could not create video converter", cleanup);
				ctx.conv->output_plane.
					setDQThreadCallback(conv0_output_dqbuf_thread_callback);
				ctx.conv->capture_plane.
					setDQThreadCallback(conv0_capture_dqbuf_thread_callback);
				
				//Set output plane stream ON
				ret = ctx.dec->output_plane.setStreamStatus(true);
				TEST_ERROR(ret < 0, "Error in output plane stream on", cleanup);

				//create a render task thread
				pthread_attr_t attr;
				struct sched_param param;
				
				pthread_attr_init(&attr);
				pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
				pthread_attr_getschedparam(&attr, &param);
			
				param.sched_priority = 90;
				pthread_attr_setschedparam(&attr, &param);

				pthread_create(&ctx.dec_capture_loop, &attr, dec_capture_loop_fcn, &ctx);
				

				if (handle->ipc_in_es)
					suma_ipc_flush(handle->ipc_in_es);

				
				struct v4l2_buffer v4l2_buf;
				struct v4l2_plane planes[MAX_PLANES];
				NvBuffer *buffer;

				handle->real_time_rst = DEF_REMAIN;
				RPTWRN("enter real_time_rst");
				while(!handle->real_time_rst)
				{
				/*
					if(params->ctrl == FUNC_CLOSE)
					{
						suma_ipc_flush(handle->ipc_in_es);
						suma_mssleep(50);
						continue;
					}
				*/	
					//mmapi dec process
					//send es data to dec
					if(0 < suma_ipc_get_nums(ipc_in_es))
					{

						suma_ipc_get(ipc_in_es, &heap_buf);
						heap_buf_size = heap_buf_get_usedsize((heap_buf_handle)heap_buf);     
	        			heap_buf_ptr = (uint8_t *)heap_buf_get_useptr((heap_buf_handle)heap_buf);
						
						memset(&v4l2_buf, 0, sizeof(v4l2_buf));
						memset(planes, 0, sizeof(planes));
				
						v4l2_buf.m.planes = planes;
				
						if(frame_cnt < ctx.dec->output_plane.getNumBuffers())
						{
							buffer = ctx.dec->output_plane.getNthBuffer(frame_cnt);
							v4l2_buf.index = frame_cnt;
							frame_cnt++;
						}
						else
						{

							ret = ctx.dec->output_plane.dqBuffer(v4l2_buf, &buffer, NULL, -1);
							if (ret < 0)
							{
								cerr << "Error DQing buffer at output plane" << endl;
								abort(&ctx);
								break;
							}
						}

						//copy es data to buffer
						read_decoder_input_nalu(buffer, heap_buf_ptr, heap_buf_size);
				
						v4l2_buf.m.planes[0].bytesused = buffer->planes[0].bytesused;
						
						ret = ctx.dec->output_plane.qBuffer(v4l2_buf, NULL);
						if (ret < 0)
						{
							cerr << "Error Qing buffer at output plane" << endl;
							abort(&ctx);
							break;
						}
						
						suma_ipc_release(ipc_in_es, heap_buf);

					}
					else
					{
						suma_mssleep(10);
					}
					
				}
				RPTWRN("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< chn[%d] quit real_time_rst", handle->channel);
				if (ctx.renderer)
				{
					ctx.renderer->setFPS(100.0);
					suma_mssleep(500);
				}

				//exit realtime
				ctx.dec->output_plane.setStreamStatus(false);
				RPTWRN("set dec->output_plane stream off");
				ctx.dec->capture_plane.setStreamStatus(false);
				RPTWRN("set dec->capture_plane stream off");
				//ctx.conv->output_plane.setStreamStatus(false);
				//RPTWRN("set conv->output_plane stream off");
				//ctx.conv->capture_plane.setStreamStatus(false);
				//RPTWRN("set conv->capture_plane stream off");
				
				// Signal EOS to the decoder capture loop
				ctx.got_eos = true;
				suma_mssleep(100);
				RPTWRN("Signal EOS to the decoder capture loop");

				// After sending EOS, all the buffers from output plane should be dequeued.
				// and after that capture plane loop should be signalled to stop.
				while (ctx.dec->output_plane.getNumQueuedBuffers() > 0 &&
					   !ctx.got_error && !ctx.dec->isInError())
				{
					struct v4l2_buffer v4l2_buf;
					struct v4l2_plane planes[MAX_PLANES];
			
					memset(&v4l2_buf, 0, sizeof(v4l2_buf));
					memset(planes, 0, sizeof(planes));
			
					v4l2_buf.m.planes = planes;
					ret = ctx.dec->output_plane.dqBuffer(v4l2_buf, NULL, NULL, -1);
					if (ret < 0)
					{
						cerr << "Error DQing buffer at output plane" << endl;
						abort(&ctx);
						break;
					}
				}
				RPTWRN("all the buffers from output plane be dequeued");

				if (ctx.conv)
			    {
			        ctx.conv->capture_plane.waitForDQThread(2000);
			    }

			}
			//exit malloc free
			//delete dec and renderer		
	cleanup:

			RPTWRN("before pthread_join dec_capture_loop");
			if (ctx.dec_capture_loop)
			{
				suma_mssleep(100);
				pthread_join(ctx.dec_capture_loop, NULL);
			}
		
			if (ctx.dec && ctx.dec->isInError())
			{
				cerr << "Decoder is in error" << endl;
			}
		
			if (ctx.got_error)
			{

			}
			RPTWRN("decoder destructor cleanup");
			// The decoder destructor does all the cleanup i.e set streamoff on output and capture planes,
			// unmap buffers, tell decoder to deallocate buffer (reqbufs ioctl with counnt = 0),
			// and finally call v4l2_close on the fd.
			delete ctx.dec;
			RPTWRN("decoder all cleanup done");

			delete ctx.conv;
			RPTWRN("converter all cleanup done");
		
			// Similarly, EglRenderer destructor does all the cleanup
			delete ctx.renderer;
			delete ctx.conv_output_plane_buf_queue;

			RPTWRN("ch[%d] dec & renderer cleanup done >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ", handle->channel);

			//suma_mssleep(1000);

			}
			//exit start stop

	}

	RPTWRN("mmapi_dec_pthread  is exit");
	handle->exit_done_flg = TRUE;

	return;
}

The following is the printed information

pthread_mmapi_dec_app.cpp: nv_mmapi_dec_pthread: 919: wrn: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< chn[0] quit real_time_rst
 [LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:267) <renderer0> :Rendered fd=1184
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <conv0> :Capture Plane:Qed buffer 7
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <conv0> :Capture Plane:DQed buffer 8
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:364) <renderer0> :Rendering fd=1185
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:267) <renderer0> :Rendered fd=1185
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <conv0> :Capture Plane:Qed buffer 8
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <conv0> :Capture Plane:DQed buffer 0
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:364) <renderer0> :Rendering fd=1177
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:267) <renderer0> :Rendered fd=1177
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <conv0> :Capture Plane:Qed buffer 0
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Capture Plane:DQed buffer 0
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:468) [LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <conv0> :Output Plane:Qed buffer 1
[LOG_LEVEL_ERROR] (NvV4l2ElementPlane.cpp:167) <<dec0> :Output Plane:STREAMOFF successful
dec0> Capture Plane:Error while DQing buffer: pthread_mmapi_dec_app.cpp: nv_mmapi_dec_pthread: 928: wrn: set dec->output_plane stream off
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:468) <dec0> :Capture Plane:STREAMOFF successfulResource temporarily unavailable

pthread_mmapi_dec_app.cpp: nv_mmapi_dec_pthread: 930: wrn: set dec->capture_plane stream off
sendEOStoConverter, 284
sendEOStoConverter, 289
sendEOStoConverter, 308
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <conv0> :Output Plane:Qed buffer 2
Exiting decoder capture loop thread
[LOG_LEVEL_ERROR] (NvV4l2Element.cpp:106) <dec1> Error while DQing event: [LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <Resource temporarily unavailable[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) conv0> :Capture Plane:DQed buffer 1
<conv0> :Output Plane:DQed buffer 1
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:364) <renderer0> :Rendering fd=[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Capture Plane:
1178
Timed out waiting for first V4L2_EVENT_RESOLUTION_CHANGE
Qed buffer 0
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <conv0> :Output Plane:DQed buffer 2
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:764) <conv0> :Output Plane:Exiting DQthread
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:267) <renderer0> :Rendered fd=1178
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <conv0> :Capture Plane:Qed buffer 1
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <conv0> :Capture Plane:DQed buffer 2
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:764) <conv0> :Capture Plane:Exiting DQthread
pthread_mmapi_dec_app.cpp: nv_mmapi_dec_pthread: 939: wrn: Signal EOS to the decoder capture loop
pthread_mmapi_dec_app.cpp: nv_mmapi_dec_pthread: 961: wrn: all the buffers from output plane be dequeued
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:832) <conv0> :Capture Plane:Stopped DQ Thread
pthread_mmapi_dec_app.cpp: nv_mmapi_dec_pthread: 973: wrn: before pthread_join dec_capture_loop
pthread_mmapi_dec_app.cpp: nv_mmapi_dec_pthread: 989: wrn: decoder destructor cleanup
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:447) <dec0> :Output Plane:Already in STREAMOFF
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:832) <dec0> :Output Plane:Stopped DQ Thread
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 0 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 1 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 2 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 3 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 4 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 5 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 6 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 7 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 8 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 9 unmapped 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:434) <dec0> :Output Plane:Reqbuf returned 0 buffers
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:373) <dec0> :Output Plane:deinit successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:447) <dec0> :Capture Plane:Already in STREAMOFF
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:832) <dec0> :Capture Plane:Stopped DQ Thread
[LOG_LEVEL_WARN] (NvBuffer.cpp:188) <Buffer> Cannot Unmap Buffer 0. Only mapped MMAP buffer can be unmapped
[LOG_LEVEL_WARN] (NvBuffer.cpp:188) <Buffer> Cannot Unmap Buffer 1. Only mapped MMAP buffer can be unmapped
[LOG_LEVEL_WARN] (NvBuffer.cpp:188) <Buffer> Cannot Unmap Buffer 2. Only mapped MMAP buffer can be unmapped
[LOG_LEVEL_WARN] (NvBuffer.cpp:188) <Buffer> Cannot Unmap Buffer 3. Only mapped MMAP buffer can be unmapped
[LOG_LEVEL_WARN] (NvBuffer.cpp:188) <Buffer> Cannot Unmap Buffer 4. Only mapped MMAP buffer can be unmapped
[LOG_LEVEL_WARN] (NvBuffer.cpp:188) <Buffer> Cannot Unmap Buffer 5. Only mapped MMAP buffer can be unmapped
[LOG_LEVEL_WARN] (NvBuffer.cpp:188) <Buffer> Cannot Unmap Buffer 6. Only mapped MMAP buffer can be unmapped
[LOG_LEVEL_WARN] (NvBuffer.cpp:188) <Buffer> Cannot Unmap Buffer 7. Only mapped MMAP buffer can be unmapped
[LOG_LEVEL_WARN] (NvBuffer.cpp:188) <Buffer> Cannot Unmap Buffer 8. Only mapped MMAP buffer can be unmapped
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:434) <dec0> :Capture Plane:Reqbuf returned 0 buffers
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:373) <dec0> :Capture Plane:deinit successful
TVMR: TVMRFrameStatusReporting: 6067: Closing TVMR Frame Status Thread -------------
TVMR: TVMRVPRFloorSizeSettingThread: 5885: Closing TVMRVPRFloorSizeSettingThread -------------
TVMR: TVMRFrameDelivery: 5917: Closing TVMR Frame Delivery Thread -------------
TVMR: NvMMLiteTVMRDecBlockClose: 7740: Done 
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:87) <V4l2Element> Device closed, fd = 158
pthread_mmapi_dec_app.cpp: nv_mmapi_dec_pthread: 994: wrn: decoder all cleanup done
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:468) <conv0> :Output Plane:STREAMOFF successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:832) <conv0> :Output Plane:Stopped DQ Thread
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:434) <conv0> :Output Plane:Reqbuf returned 0 buffers
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:373) <conv0> :Output Plane:deinit successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:468) <conv0> :Capture Plane:STREAMOFF successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:832) <conv0> :Capture Plane:Stopped DQ Thread
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 0 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 1 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 2 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 3 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 4 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 5 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 6 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 7 unmapped 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:201) <Buffer> Buffer 8 unmapped 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:434) <conv0> :Capture Plane:Reqbuf returned 0 buffers
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:373) <conv0> :Capture Plane:deinit successful
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:87) <V4l2Element> Device closed, fd = 166
pthread_mmapi_dec_app.cpp: nv_mmapi_dec_pthread: 997: wrn: converter all cleanup done
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:273) <renderer0> :Stopped render thread
pthread_mmapi_dec_app.cpp: nv_mmapi_dec_pthread: 1003: wrn: ch[0] dec & renderer cleanup done >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
decode ctrl 0, fmt H265, x 0, y 0, w 960, h 540, fps 25.000000
pthread_mmapi_dec_app.cpp: nv_mmapi_dec_pthread: 786: wrn: enter malloc_free_rst
Failed to query video capabilities: Bad address
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:62) <dec0> :Opened, fd = 158
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:215) <dec0> :Successfully subscribed to event 5
NvMMLiteOpen : Block : BlockType = 279 
TVMR: NvMMLiteTVMRDecBlockOpen: 7580: NvMMLiteBlockOpen 
NvMMLiteBlockCreate : Block : BlockType = 279 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:291) <dec0> :Output Plane:VIDIOC_S_FMT at capture plane successful
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:177) <dec0> :Set controls
[LOG_LEVEL_DEBUG] (NvVideoDecoder.cpp:161) <dec0> :Disabling decoder DPB: success
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:434) <dec0> :Output Plane:Reqbuf returned 10 buffers
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Output Plane:QueryBuf for 0th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Output Plane:ExportBuf successful for Buffer 0, Plane 0, fd = 1028
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 0, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Output Plane:QueryBuf for 1th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Output Plane:ExportBuf successful for Buffer 1, Plane 0, fd = 1030
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 1, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Output Plane:QueryBuf for 2th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Output Plane:ExportBuf successful for Buffer 2, Plane 0, fd = 1033
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 2, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Output Plane:QueryBuf for 3th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Output Plane:ExportBuf successful for Buffer 3, Plane 0, fd = 1035
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 3, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Output Plane:QueryBuf for 4th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Output Plane:ExportBuf successful for Buffer 4, Plane 0, fd = 1037
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 4, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Output Plane:QueryBuf for 5th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Output Plane:ExportBuf successful for Buffer 5, Plane 0, fd = 1039
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 5, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Output Plane:QueryBuf for 6th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Output Plane:ExportBuf successful for Buffer 6, Plane 0, fd = 1040
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 6, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Output Plane:QueryBuf for 7th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Output Plane:ExportBuf successful for Buffer 7, Plane 0, fd = 1041
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 7, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Output Plane:QueryBuf for 8th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Output Plane:ExportBuf successful for Buffer 8, Plane 0, fd = 1042
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 8, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Output Plane:QueryBuf for 9th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Output Plane:ExportBuf successful for Buffer 9, Plane 0, fd = 1043
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 9, plane 0 to 
Failed to query video capabilities: Bad address
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:62) <conv0> :Opened, fd = 166
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:468) <dec0> :Output Plane:STREAMON successful
Starting decoder capture loop thread
pthread_mmapi_dec_app.cpp: nv_mmapi_dec_pthread: 854: wrn: enter real_time_rst
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 0
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 1
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 2
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 3
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 4
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 5
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 6
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 7
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 8
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 9
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 0
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 0
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 1
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 1
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 2
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 2
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 3
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 3
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 4
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 4
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 5
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 5
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 6
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 6
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 7
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 7
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 8
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 8
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 9
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 9
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 0
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 0
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 1
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 1
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 2
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 2
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 3
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 3
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 4
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 4
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 5
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 5
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 6
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 6
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 7
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 7
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 8
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 8
TVMR: cbBeginSequence: 1166: BeginSequence  1920x1088, bVPR = 0, fFrameRate = 0.000000
TVMR: BitDepthLuma = 8, BitDepthChroma = 8 
TVMR: LowCorner Frequency = 0 
TVMR: cbBeginSequence: 1545: DecodeBuffers = 3, pnvsi->eCodec = 10, codec = 9 
TVMR: cbBeginSequence: 1606: Display Resolution : (1920x1080) 
TVMR: cbBeginSequence: 1607: Display Aspect Ratio : (1920x1080) 
TVMR: cbBeginSequence: 1649: ColorFormat : 5 
TVMR: cbBeginSequence:1660 ColorSpace = NvColorSpace_YCbCr709
TVMR: cbBeginSequence: 1790: SurfaceLayout = 3
TVMR: cbBeginSequence: 1868: NumOfSurfaces = 4, InteraceStream = 0, InterlaceEnabled = 0, bSecure = 0, MVC = 0 Semiplanar = 1, bReinit = 1, BitDepthForSurface = 8 LumaBitDepth = 8, ChromaBitDepth = 8, ChromaFormat = 5
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:102) <dec0> :DQed event 5
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:273) <dec0> :Capture Plane:Getting format: success
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:309) <dec0> :Capture Plane:Getting crop params: success
Video Resolution: 1920x1080
query_and_set_capture, 371
[LOG_LEVEL_ERROR] (NvEglRenderer.cpp:109) <renderer0> Setting Screen width 960 height 540
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:111) <renderer0> :Display opened successfully 545259573536
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:199) <renderer0> :Egl Got display 2
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 9
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 9
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 0
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 0
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:216) <renderer0> :Got numconfigs as 1
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:667) <renderer0> :Shaders intialized
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:253) <renderer0> :Starting render thread
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:148) <renderer0> :Renderer started successfully
set FPS 25.000000
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:447) <dec0> :Capture Plane:Already in STREAMOFF
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:832) <dec0> :Capture Plane:Stopped DQ Thread
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:434) <dec0> :Capture Plane:Reqbuf returned 0 buffers
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:373) <dec0> :Capture Plane:deinit successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:291) <dec0> :Capture Plane:VIDIOC_S_FMT at capture plane successful
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:158) <dec0> :Got value 4 for control 9963815
[LOG_LEVEL_DEBUG] (NvVideoDecoder.cpp:188) <dec0> :Getting decoder minimum capture plane buffers (4): success
query_and_set_capture, 427, min_dec_capture_buffers 4
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:434) <dec0> :Capture Plane:Reqbuf returned 9 buffers
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Capture Plane:QueryBuf for 0th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 0, Plane 0, fd = 32507006
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 0, Plane 1, fd = 32507007
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Capture Plane:QueryBuf for 1th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 1, Plane 0, fd = 32507008
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 1, Plane 1, fd = 32507009
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Capture Plane:QueryBuf for 2th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 2, Plane 0, fd = 32507010
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 2, Plane 1, fd = 32507011
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Capture Plane:QueryBuf for 3th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 3, Plane 0, fd = 32507012
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 3, Plane 1, fd = 32507013
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Capture Plane:QueryBuf for 4th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 4, Plane 0, fd = 32507014
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 4, Plane 1, fd = 32507015
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Capture Plane:QueryBuf for 5th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 5, Plane 0, fd = 32507016
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 5, Plane 1, fd = 32507017
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Capture Plane:QueryBuf for 6th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 6, Plane 0, fd = 32507018
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 6, Plane 1, fd = 32507019
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Capture Plane:QueryBuf for 7th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 7, Plane 0, fd = 32507020
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 7, Plane 1, fd = 32507021
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <dec0> :Capture Plane:QueryBuf for 8th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 8, Plane 0, fd = 32507022
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <dec0> :Capture Plane:ExportBuf successful for Buffer 8, Plane 1, fd = 32507023
query_and_set_capture, 434, dec cap plane buffs 9
query_and_set_capture, 438
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:177) <conv0> :Set controls
[LOG_LEVEL_DEBUG] (NvVideoConverter.cpp:200) <conv0> :Setting output plane buffer layout to 1: success
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:291) <conv0> :Output Plane:VIDIOC_S_FMT at capture plane successful
[LOG_LEVEL_DEBUG] (NvVideoConverter.cpp:143) <conv0> :Setting output plane format: success
query_and_set_capture, 445
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:177) <conv0> :Set controls
[LOG_LEVEL_DEBUG] (NvVideoConverter.cpp:220) <conv0> :Setting capture plane buffer layout to 0: success
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:291) <conv0> :Capture Plane:VIDIOC_S_FMT at capture plane successful
[LOG_LEVEL_DEBUG] (NvVideoConverter.cpp:114) <conv0> :Setting capture plane format: success
query_and_set_capture, 455
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:335) <conv0> :Capture Plane:Setting selection: success
[LOG_LEVEL_DEBUG] (NvVideoConverter.cpp:296) <conv0> :Setting crop rectangle to left=0, top=0, width=1920, height=1080: success
query_and_set_capture, 459
libv4l2_nvvidconv (1):(765) (INFO) : Allocating (9) OUTPUT PLANE BUFFERS Layout=1
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:434) <conv0> :Output Plane:Reqbuf returned 9 buffers
query_and_set_capture, 466, conv out bufs 9
libv4l2_nvvidconv (1):(775) (INFO) : Allocating (9) CAPTURE PLANE BUFFERS Layout=0
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:434) <conv0> :Capture Plane:Reqbuf returned 9 buffers
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <conv0> :Capture Plane:QueryBuf for 0th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 0, Plane 0, fd = 1177
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 0, Plane 1, fd = 1177
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 0, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 0, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <conv0> :Capture Plane:QueryBuf for 1th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 1, Plane 0, fd = 1178
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 1, Plane 1, fd = 1178
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 1, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 1, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <conv0> :Capture Plane:QueryBuf for 2th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 2, Plane 0, fd = 1179
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 2, Plane 1, fd = 1179
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 2, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 2, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <conv0> :Capture Plane:QueryBuf for 3th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 3, Plane 0, fd = 1180
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 3, Plane 1, fd = 1180
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 3, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 3, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <conv0> :Capture Plane:QueryBuf for 4th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 4, Plane 0, fd = 1181
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 4, Plane 1, fd = 1181
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 4, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 4, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <conv0> :Capture Plane:QueryBuf for 5th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 5, Plane 0, fd = 1182
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 5, Plane 1, fd = 1182
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 5, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 5, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <conv0> :Capture Plane:QueryBuf for 6th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 6, Plane 0, fd = 1183
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 6, Plane 1, fd = 1183
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 6, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 6, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <conv0> :Capture Plane:QueryBuf for 7th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 7, Plane 0, fd = 1184
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 7, Plane 1, fd = 1184
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 7, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 7, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:543) <conv0> :Capture Plane:QueryBuf for 8th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 8, Plane 0, fd = 1185
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:581) <conv0> :Capture Plane:ExportBuf successful for Buffer 8, Plane 1, fd = 1185
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 8, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 8, plane 1 to 
query_and_set_capture, 473, conv cap bufs 9
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:468) <conv0> :Output Plane:STREAMON successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:468) <conv0> :Capture Plane:STREAMON successful
query_and_set_capture, 480
query_and_set_capture, 487
conv cap buffers 9
query_and_set_capture, 500 i 0
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 1
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 1
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 2
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 2
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 3
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 3
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 4
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 4
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 5
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 5
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 6
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 6
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:152) <dec0> :Output Plane:DQed buffer 7
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:258) <dec0> :Output Plane:Qed buffer 7
[LOG_LEVEL_ERROR] (NvV4l2Element.cpp:106) <dec1> Error while DQing event: Resource temporarily unavailable
Timed out waiting for first V4L2_EVENT_RESOLUTION_CHANGE

in query_and_set_capture, I removed the following code, if added, then a Segmentation fault occur when calling ctx->conv->output_plane.deinitPlane().

if (ctx->conv)
{
        ret = sendEOStoConverter(ctx);
        TEST_ERROR(ret < 0,
                   "Error while queueing EOS buffer on converter output",
                   error);

        ctx->conv->capture_plane.waitForDQThread(2000);

        ctx->conv->output_plane.deinitPlane();
        ctx->conv->capture_plane.deinitPlane();

        while(!ctx->conv_output_plane_buf_queue->empty())
        {
            ctx->conv_output_plane_buf_queue->pop();
        }
}

The exact location of the error occurred:

deinitPlane()->reqbufs()->v4l2_ioctl(fd, VIDIOC_REQBUFS, &reqbufs)

This is gdb debugging information

#0  0x0000007fb7fbf7e8 in plugin_ioctl () from /usr/lib/aarch64-linux-gnu/libv4l/plugins/libv4l2_nvvidconv.so
#1  0x0000007fb78166d0 in v4l2_ioctl () from /usr/lib/aarch64-linux-gnu/libv4l2.so.0
#2  0x0000007fb78166d0 in v4l2_ioctl () from /usr/lib/aarch64-linux-gnu/libv4l2.so.0
#3  0x0000007fb78166d0 in v4l2_ioctl () from /usr/lib/aarch64-linux-gnu/libv4l2.so.0

Hi Li,
Could you share a patch to apply to 00_video_decode for reproducing the issue?

Hi DaneLLL,

Thank you for your reply.
In order to reproduce the problems I encountered, I rewritten backend.
Please help me analyze the reasons for the problem.

1,Replace the code v4l2_backend_main.cpp and make

/*
 * This file is designed to test mmapi's multithreaded programming
 */

#include "NvUtils.h"
#include <errno.h>
#include <fstream>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <linux/videodev2.h>
#include <pthread.h>
#include <string.h>
#include <unistd.h>
#include "NvCudaProc.h"
#include "nvbuf_utils.h"
#include "v4l2_nv_extensions.h"
#include "v4l2_backend_test.h"
#include <sys/time.h>

#define TEST_ERROR(cond, str, label) if(cond) { \
	cerr << str << endl; \
	error = 1; \
	goto label; }

#define CHUNK_SIZE 4000000
#ifndef MIN
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif

#define NAL_UNIT_START_CODE 0x00000001
#define MIN_CHUNK_SIZE      50
#define USE_CPU_FOR_INTFLOAT_CONVERSION 0

static const int IMAGE_WIDTH = 1920;
static const int IMAGE_HEIGHT = 1080;

#define IS_NAL_UNIT_START(buffer_ptr) (!buffer_ptr[0] && !buffer_ptr[1] && \
		!buffer_ptr[2] && (buffer_ptr[3] == 1))

#define IS_NAL_UNIT_START1(buffer_ptr) (!buffer_ptr[0] && !buffer_ptr[1] && \
		(buffer_ptr[2] == 1))

using namespace std;

global_cfg cfg;

	static int
read_decoder_input_nalu(ifstream * stream, NvBuffer * buffer,
		char *parse_buffer, streamsize parse_buffer_size)
{
	// Length is the size of the buffer in bytes
	char *buffer_ptr = (char *) buffer->planes[0].data;

	char *stream_ptr;
	bool nalu_found = false;

	streamsize bytes_read;
	streamsize stream_initial_pos = stream->tellg();

	stream->read(parse_buffer, parse_buffer_size);
	bytes_read = stream->gcount();

	if (bytes_read == 0)
	{
		return buffer->planes[0].bytesused = 0;
	}

	// Find the first NAL unit in the buffer
	stream_ptr = parse_buffer;
	while ((stream_ptr - parse_buffer) < (bytes_read - 3))
	{
		nalu_found = IS_NAL_UNIT_START(stream_ptr) ||
			IS_NAL_UNIT_START1(stream_ptr);
		if (nalu_found)
		{
			break;
		}
		stream_ptr++;
	}

	// Reached end of buffer but could not find NAL unit
	if (!nalu_found)
	{
		cerr << "Could not read nal unit from file. File seems to be corrupted"
			<< endl;
		return -1;
	}

	memcpy(buffer_ptr, stream_ptr, 4);
	buffer_ptr += 4;
	buffer->planes[0].bytesused = 4;
	stream_ptr += 4;

	// Copy bytes till the next NAL unit is found
	while ((stream_ptr - parse_buffer) < (bytes_read - 3))
	{
		if (IS_NAL_UNIT_START(stream_ptr) || IS_NAL_UNIT_START1(stream_ptr))
		{
			streamsize seekto = stream_initial_pos +
				(stream_ptr - parse_buffer);
			if (stream->eof())
			{
				stream->clear();
			}
			stream->seekg(seekto, stream->beg);
			return 0;
		}
		*buffer_ptr = *stream_ptr;
		buffer_ptr++;
		stream_ptr++;
		buffer->planes[0].bytesused++;
	}

	// Reached end of buffer but could not find NAL unit
	cerr << "Could not read nal unit from file. File seems to be corrupted"
		<< endl;
	return -1;
}

	static nal_type_e
parse_nalu_unit(NvBuffer * buffer)
{
	unsigned char *pbuf = buffer->planes[0].data;

	return (nal_type_e)(*(pbuf + 4) & 0x1F);
}

	static bool
conv_output_dqbuf_thread_callback(struct v4l2_buffer *v4l2_buf,
		NvBuffer * buffer, NvBuffer * shared_buffer,
		void *arg)
{
	context_t *ctx = (context_t *) arg;
	struct v4l2_buffer dec_capture_ret_buffer;
	struct v4l2_plane planes[MAX_PLANES];

	memset(&dec_capture_ret_buffer, 0, sizeof(dec_capture_ret_buffer));
	memset(planes, 0, sizeof(planes));

	dec_capture_ret_buffer.index = shared_buffer->index;
	dec_capture_ret_buffer.m.planes = planes;

	pthread_mutex_lock(&ctx->queue_lock);
	ctx->conv_output_plane_buf_queue->push(buffer);

	// Return the buffer dequeued from converter output plane
	// back to decoder capture plane
	if (ctx->dec->capture_plane.qBuffer(dec_capture_ret_buffer, NULL) < 0)
	{
		pthread_cond_broadcast(&ctx->queue_cond);
		pthread_mutex_unlock(&ctx->queue_lock);
		return false;
	}

	pthread_cond_broadcast(&ctx->queue_cond);
	pthread_mutex_unlock(&ctx->queue_lock);

	return true;
}

	static bool
conv_capture_dqbuf_thread_callback(struct v4l2_buffer *v4l2_buf,
		NvBuffer * buffer,
		NvBuffer * shared_buffer,
		void *arg)
{
	context_t *ctx = (context_t *) arg;
	Shared_Buffer batch_buffer;
	batch_buffer.bProcess = 0;

	ctx->renderer->render(buffer->planes[0].fd);

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

	return true;
}

	static void
query_and_set_capture(context_t * ctx)
{
	NvVideoDecoder *dec = ctx->dec;
	struct v4l2_format format;
	struct v4l2_crop crop;
	int32_t min_dec_capture_buffers;
	int ret = 0;
	int error = 0;
	uint32_t window_width;
	uint32_t window_height;
	char OSDcontent[512];

	// Get capture plane format from the decoder. This may change after
	// an resolution change event
	ret = dec->capture_plane.getFormat(format);
	TEST_ERROR(ret < 0,
			"Error: Could not get format from decoder capture plane", error);

	// Get the display resolution from the decoder
	ret = dec->capture_plane.getCrop(crop);
	TEST_ERROR(ret < 0,
			"Error: Could not get crop from decoder capture plane", error);

	if (1)//(ctx->cpu_occupation_option == PARSER_DECODER_VIC_RENDER)
	{
		// Destroy the old instance of renderer as resolution might changed
		delete ctx->renderer;

		if (ctx->fullscreen)
		{
			// Required for fullscreen
			window_width = window_height = 0;
		}
		else if (ctx->window_width && ctx->window_height)
		{
			// As specified by user on commandline
			window_width = ctx->window_width;
			window_height = ctx->window_height;
		}
		else
		{
			// Resolution got from the decoder
			window_width = crop.c.width;
			window_height = crop.c.height;
		}

		// If height or width are set to zero, EglRenderer creates a fullscreen
		// window
		ctx->renderer =
			NvEglRenderer::createEglRenderer("renderer0", window_width,
					window_height, ctx->window_x,
					ctx->window_y);
		TEST_ERROR(!ctx->renderer,
				"Error in setting up renderer. "
				"Check if X is running or run with --disable-rendering",
				error);

		ctx->renderer->setFPS(ctx->fps);
	}

	// deinitPlane unmaps the buffers and calls REQBUFS with count 0
	dec->capture_plane.deinitPlane();

	// Not necessary to call VIDIOC_S_FMT on decoder capture plane.
	// But decoder setCapturePlaneFormat function updates the class variables
	ret = dec->setCapturePlaneFormat(format.fmt.pix_mp.pixelformat,
			format.fmt.pix_mp.width,
			format.fmt.pix_mp.height);
	TEST_ERROR(ret < 0, "Error in setting decoder capture plane format",
			error);

	// Get the minimum buffers which have to be requested on the capture plane
	ret =
		dec->getControl(V4L2_CID_MIN_BUFFERS_FOR_CAPTURE,
				min_dec_capture_buffers);
	TEST_ERROR(ret < 0,
			"Error while getting value for V4L2_CID_MIN_BUFFERS_FOR_CAPTURE",
			error);

	// Request (min + 5) buffers, export and map buffers
	ret =
		dec->capture_plane.setupPlane(V4L2_MEMORY_MMAP,
				min_dec_capture_buffers + 5, false,
				false);
	TEST_ERROR(ret < 0, "Error in decoder capture plane setup", error);

	// For file write, first deinitialize output and capture planes
	// of video converter and then use the new resolution from
	// decoder event resolution change
	ctx->conv->waitForIdle(1000);
	ctx->conv->output_plane.stopDQThread();
	ctx->conv->capture_plane.stopDQThread();

	ctx->conv->output_plane.deinitPlane();
	ctx->conv->capture_plane.deinitPlane();
	while(!ctx->conv_output_plane_buf_queue->empty())
	{
		ctx->conv_output_plane_buf_queue->pop();
	}

	ret = ctx->conv->setOutputPlaneFormat(format.fmt.pix_mp.pixelformat,
			format.fmt.pix_mp.width,
			format.fmt.pix_mp.height,
			V4L2_NV_BUFFER_LAYOUT_BLOCKLINEAR);
	TEST_ERROR(ret < 0, "Error in converter output plane set format",
			error);

	ret = ctx->conv->setCapturePlaneFormat(format.fmt.pix_mp.pixelformat,
			crop.c.width,
			crop.c.height,
			V4L2_NV_BUFFER_LAYOUT_PITCH);
	TEST_ERROR(ret < 0, "Error in converter capture plane set format",
			error);

	ret = ctx->conv->setCropRect(0, 0, crop.c.width, crop.c.height);
	TEST_ERROR(ret < 0, "Error while setting crop rect", error);

	ret =
		ctx->conv->output_plane.setupPlane(V4L2_MEMORY_DMABUF,
				dec->capture_plane.
				getNumBuffers(), false, false);
	TEST_ERROR(ret < 0, "Error in converter output plane setup", error);

	ret =
		ctx->conv->capture_plane.setupPlane(V4L2_MEMORY_MMAP,
				dec->capture_plane.
				getNumBuffers(), true, false);
	TEST_ERROR(ret < 0, "Error in converter capture plane setup", error);
	ret = ctx->conv->output_plane.setStreamStatus(true);
	TEST_ERROR(ret < 0, "Error in converter output plane streamon", error);

	ret = ctx->conv->capture_plane.setStreamStatus(true);
	TEST_ERROR(ret < 0, "Error in converter output plane streamoff",
			error);
	// Add all empty conv output plane buffers to conv_output_plane_buf_queue
	for (uint32_t i = 0; i < ctx->conv->output_plane.getNumBuffers(); i++)
	{
		ctx->conv_output_plane_buf_queue->push(ctx->conv->output_plane.
				getNthBuffer(i));
	}

	printf("DEBUG in %s, line %d\n", __func__, __LINE__);
	for (uint32_t i = 0; i < ctx->conv->capture_plane.getNumBuffers(); i++)
	{
		struct v4l2_buffer v4l2_buf;
		struct v4l2_plane planes[MAX_PLANES];

		memset(&v4l2_buf, 0, sizeof(v4l2_buf));
		memset(planes, 0, sizeof(planes));

		v4l2_buf.index = i;
		v4l2_buf.m.planes = planes;
		ret = ctx->conv->capture_plane.qBuffer(v4l2_buf, NULL);
		TEST_ERROR(ret < 0, "Error Qing buffer at converter output plane",
				error);
	}
	printf("DEBUG in %s, line %d\n", __func__, __LINE__);

	ctx->conv->output_plane.startDQThread(ctx);
	ctx->conv->capture_plane.startDQThread(ctx);
	// Capture plane STREAMON
	ret = dec->capture_plane.setStreamStatus(true);
	TEST_ERROR(ret < 0, "Error in decoder capture plane streamon", error);

	// Enqueue all the empty capture plane buffers
	for (uint32_t i = 0; i < dec->capture_plane.getNumBuffers(); i++)
	{
		struct v4l2_buffer v4l2_buf;
		struct v4l2_plane planes[MAX_PLANES];

		memset(&v4l2_buf, 0, sizeof(v4l2_buf));
		memset(planes, 0, sizeof(planes));

		v4l2_buf.index = i;
		v4l2_buf.m.planes = planes;
		ret = dec->capture_plane.qBuffer(v4l2_buf, NULL);
		TEST_ERROR(ret < 0, "Error Qing buffer at output plane", error);
	}
	cout << "Query and set capture  successful" << endl;
	return;

error:
	if (error)
	{
		ctx->got_error = true;
		cerr << "Error in " << __func__ << endl;
	}
}

	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
	{
		ret = dec->dqEvent(ev, 3000);
		if (ret < 0)
		{
			if (errno == EAGAIN)
			{
				cerr <<
					"Timed out waiting for first V4L2_EVENT_RESOLUTION_CHANGE"
					<< endl;
				continue;
			}
			else
			{
				cerr << "Error in dequeueing decoder event" << endl;
			}
			ctx->got_error = true;
			break;
		}
	}
	while (ev.type != V4L2_EVENT_RESOLUTION_CHANGE);

	// query_and_set_capture acts on the resolution change event
	if (!ctx->got_error)
		query_and_set_capture(ctx);

	// Exit on error or EOS which is signalled in main()
	while (!(ctx->got_error || dec->isInError() || ctx->got_eos))
	{
		NvBuffer *dec_buffer;

		// Check for Resolution change again
		ret = dec->dqEvent(ev, false);
		if (ret == 0)
		{
			switch (ev.type)
			{
				case V4L2_EVENT_RESOLUTION_CHANGE:
					query_and_set_capture(ctx);
					continue;
			}
		}

		while (1)
		{
			struct v4l2_buffer v4l2_buf;
			struct v4l2_plane planes[MAX_PLANES];

			memset(&v4l2_buf, 0, sizeof(v4l2_buf));
			memset(planes, 0, sizeof(planes));
			v4l2_buf.m.planes = planes;

			// Dequeue a filled buffer
			if (dec->capture_plane.dqBuffer(v4l2_buf, &dec_buffer, NULL, 0))
			{
				if (errno == EAGAIN)
				{
					usleep(1000);

				}
				else
				{
					ctx->got_error = true;
					cerr << "Error while calling dequeue at capture plane" <<
						endl;
				}
				break;
			}

			// If we need to write to file, give the buffer to video converter output plane
			// instead of returning the buffer back to decoder capture plane
			NvBuffer *conv_buffer;
			struct v4l2_buffer conv_output_buffer;
			struct v4l2_plane conv_planes[MAX_PLANES];

			memset(&conv_output_buffer, 0, sizeof(conv_output_buffer));
			memset(conv_planes, 0, sizeof(conv_planes));
			conv_output_buffer.m.planes = conv_planes;

			// Get an empty conv output plane buffer from conv_output_plane_buf_queue
			pthread_mutex_lock(&ctx->queue_lock);
			while (ctx->conv_output_plane_buf_queue->empty())
			{
				pthread_cond_wait(&ctx->queue_cond, &ctx->queue_lock);
			}
			conv_buffer = ctx->conv_output_plane_buf_queue->front();
			ctx->conv_output_plane_buf_queue->pop();
			pthread_mutex_unlock(&ctx->queue_lock);

			conv_output_buffer.index = conv_buffer->index;

			if (ctx->conv->output_plane.
					qBuffer(conv_output_buffer, dec_buffer) < 0)
			{
				ctx->got_error = true;
				cerr <<
					"Error while queueing buffer at converter output plane"
					<< endl;
				break;
			}

		}
	}

	cout << "Exiting decoder capture loop thread" << endl;
	// Signal EOS to the decoder capture loop
	ctx->got_eos = true;

	//Signal VIC to wait EOS
	sem_post(&(ctx->dec_run_sem));
	return NULL;
}

	static void *
dec_feed_loop_fcn(void *arg)
{
	context_t *ctx = (context_t *) arg;
	int i = 0;
	bool eos = false;
	int ret;
	char *nalu_parse_buffer = NULL;
	nal_type_e nal_type;

	if (ctx->input_nalu)
	{
		nalu_parse_buffer = new char[CHUNK_SIZE];
	}

	// Read encoded data and enqueue all the output plane buffers.
	// Exit loop in case file read is complete.
	while (!eos && !ctx->got_error && !ctx->dec->isInError() &&
			i < (int)ctx->dec->output_plane.getNumBuffers())
	{
		struct v4l2_buffer v4l2_buf;
		struct v4l2_plane planes[MAX_PLANES];
		NvBuffer *buffer;

		memset(&v4l2_buf, 0, sizeof(v4l2_buf));
		memset(planes, 0, sizeof(planes));

		buffer = ctx->dec->output_plane.getNthBuffer(i);
		if (ctx->input_nalu)
		{
			read_decoder_input_nalu(ctx->in_file, buffer,
					nalu_parse_buffer, CHUNK_SIZE);
		}

		v4l2_buf.index = i;
		v4l2_buf.m.planes = planes;
		v4l2_buf.m.planes[0].bytesused = buffer->planes[0].bytesused;
		// It is necessary to queue an empty buffer to signal EOS to the decoder
		// i.e. set v4l2_buf.m.planes[0].bytesused = 0 and queue the buffer
		ret = ctx->dec->output_plane.qBuffer(v4l2_buf, NULL);
		if (ret < 0)
		{
			cerr << "Error Qing buffer at output plane" << endl;
			ctx->got_error = true;
			break;
		}
		if (v4l2_buf.m.planes[0].bytesused == 0)
		{
			eos = true;
			cout << "Input file read complete" << endl;
			break;
		}
		i++;
	}

	// Since all the output plane buffers have been queued, we first need to
	// dequeue a buffer from output plane before we can read new data into it
	// and queue it again.
	while (!eos && !ctx->got_error && !ctx->dec->isInError())
	{
		struct v4l2_buffer v4l2_buf;
		struct v4l2_plane planes[MAX_PLANES];
		NvBuffer *buffer;

		memset(&v4l2_buf, 0, sizeof(v4l2_buf));
		memset(planes, 0, sizeof(planes));
		v4l2_buf.m.planes = planes;

		ret = ctx->dec->output_plane.dqBuffer(v4l2_buf, &buffer, NULL, -1);
		if (ret < 0)
		{
			cerr << "Error DQing buffer at output plane" << endl;
			ctx->got_error = true;
			break;
		}

		if (ctx->input_nalu)
		{
			read_decoder_input_nalu(ctx->in_file, buffer,
					nalu_parse_buffer, CHUNK_SIZE);
		}

		v4l2_buf.m.planes[0].bytesused = buffer->planes[0].bytesused;
		ret = ctx->dec->output_plane.qBuffer(v4l2_buf, NULL);
		if (ret < 0)
		{
			cerr << "Error Qing buffer at output plane" << endl;
			ctx->got_error = true;
			break;
		}
		if (v4l2_buf.m.planes[0].bytesused == 0)
		{
			eos = true;
			cout << "Input file read complete" << endl;
			break;
		}
	}

	// After sending EOS, all the buffers from output plane should be dequeued.
	// and after that capture plane loop should be signalled to stop.
	while (ctx->dec->output_plane.getNumQueuedBuffers() > 0 &&
			!ctx->got_error && !ctx->dec->isInError())
	{
		struct v4l2_buffer v4l2_buf;
		struct v4l2_plane planes[MAX_PLANES];

		memset(&v4l2_buf, 0, sizeof(v4l2_buf));
		memset(planes, 0, sizeof(planes));

		v4l2_buf.m.planes = planes;
		ret = ctx->dec->output_plane.dqBuffer(v4l2_buf, NULL, NULL, -1);
		if (ret < 0)
		{
			cerr << "Error DQing buffer at output plane" << endl;
			ctx->got_error = true;
			break;
		}
	}

	if (ctx->input_nalu)
	{
		delete []nalu_parse_buffer;
	}

	ctx->got_eos = true;
	return NULL;
}

	static void
set_defaults(context_t * ctx)
{
	memset(ctx, 0, sizeof(context_t));
	ctx->fullscreen = false;
	ctx->window_height = 0;
	ctx->window_width = 0;
	ctx->window_x = 0;
	ctx->window_y = 0;
	ctx->input_nalu = 1;
	ctx->fps = 30;
	ctx->do_stat = 0;
	ctx->cpu_occupation_option = 0;
	ctx->dec_status = 0;
	ctx->conv_output_plane_buf_queue = new queue < NvBuffer * >;
	ctx->render_buf_queue = new queue <Shared_Buffer>;
	ctx->stop_render = 0;
	ctx->nvosd_context = NULL;
}

	static void
set_ctx_args(context_t * ctx, context_t * ctx_org)
{
	//Reinitialize the structure
	memset(ctx, 0, sizeof(context_t));
	ctx->fullscreen = false;
	ctx->window_height = 0;
	ctx->window_width = 0;
	ctx->window_x = 0;
	ctx->window_y = 0;
	ctx->input_nalu = 1;
	ctx->fps = 30;
	ctx->do_stat = 0;
	ctx->cpu_occupation_option = 0;
	ctx->dec_status = 0;
	ctx->conv_output_plane_buf_queue = new queue < NvBuffer * >;
	ctx->render_buf_queue = new queue <Shared_Buffer>;
	ctx->stop_render = 0;
	ctx->nvosd_context = NULL;

	//Sets the parameters passed by the command line
	ctx->channel = ctx_org->channel;
	ctx->in_file_path = ctx_org->in_file_path;
	ctx->decoder_pixfmt = ctx_org->decoder_pixfmt;

}

	static void
get_disp_resolution(display_resolution_t *res)
{
	if (NvEglRenderer::getDisplayResolution(
				res->window_width, res->window_height) < 0)
	{
		cerr << "get resolution failed, program will exit" << endl;
		exit(0);
	}

	return;
}

	static void *
multi_dec_main_loop_fcn(void *arg)
{
	context_t *ctx_org = (context_t *) arg;
	context_t *ctx = (context_t*)calloc(1, sizeof(context_t));
	display_resolution_t disp_info;
	int ret = 0;
	int error = 0;
	int loop_count = 0;
	while(1)
	{
		set_ctx_args(ctx, ctx_org);
		sem_init(&(ctx->dec_run_sem), 0, 0);

		get_disp_resolution(&disp_info);

		printf("enter %s[%d] loop_count %d\n", __func__, ctx->channel, loop_count);

		char decname[512];
		sprintf(decname, "dec%d", ctx->channel);
		ctx->dec = NvVideoDecoder::createVideoDecoder(decname);
		TEST_ERROR(!ctx->dec, "Could not create decoder", cleanup);

		// Subscribe to Resolution change event
		ret = ctx->dec->subscribeEvent(V4L2_EVENT_RESOLUTION_CHANGE,
				0, 0);
		TEST_ERROR(ret < 0,
				"Could not subscribe to V4L2_EVENT_RESOLUTION_CHANGE",
				cleanup);

		// Set V4L2_CID_MPEG_VIDEO_DISABLE_COMPLETE_FRAME_INPUT control to false
		// so that application can send chunks/slice of encoded data instead of
		// forming complete frames. This needs to be done before setting format
		// on the output plane.
		ret = ctx->dec->disableCompleteFrameInputBuffer();
		TEST_ERROR(ret < 0, "Error in disableCompleteFrameInputBuffer", cleanup);

		// Set format on the output plane
		ret = ctx->dec->setOutputPlaneFormat(
				ctx->decoder_pixfmt, CHUNK_SIZE);
		TEST_ERROR(ret < 0, "Could not set output plane format", cleanup);

		// V4L2_CID_MPEG_VIDEO_DISABLE_DPB should be set after output plane
		// set format
		if (ctx->disable_dpb)
		{
			ret = ctx->dec->disableDPB();
			TEST_ERROR(ret < 0, "Error in disableDPB", cleanup);
		}

		// Query, Export and Map the output plane buffers so that we can read
		// encoded data into the buffers
		ret = ctx->dec->output_plane.setupPlane(
				V4L2_MEMORY_MMAP, 10, true, false);
		TEST_ERROR(ret < 0, "Error while setting up output plane", cleanup);

		ctx->in_file = new ifstream(ctx->in_file_path);
		TEST_ERROR(!ctx->in_file->is_open(),
				"Error opening input file", cleanup);

		// Create converter to convert from BL to PL for writing raw video
		// to file
		char convname[512];
		sprintf(convname, "conv%d", ctx->channel);
		ctx->conv = NvVideoConverter::createVideoConverter(convname);
		TEST_ERROR(!ctx->conv, "Could not create video converter",
				cleanup);

		ctx->conv->output_plane.
			setDQThreadCallback(conv_output_dqbuf_thread_callback);
		ctx->conv->capture_plane.
			setDQThreadCallback(conv_capture_dqbuf_thread_callback);
		ret = ctx->dec->output_plane.setStreamStatus(true);
		TEST_ERROR(ret < 0, "Error in output plane stream on", cleanup);
		if (cfg.channel_num == 1 && ctx->channel == 0)
		{
			ctx->window_width = disp_info.window_width;
			ctx->window_height = disp_info.window_height;
			ctx->window_x = 0;
			ctx->window_y = 0;
		}
		else
		{
			if (ctx->channel == 0)
			{
				ctx->window_width = disp_info.window_width / 2;
				ctx->window_height = disp_info.window_height / 2;
				ctx->window_x = 0;
				ctx->window_y = 0;
			}
			else if (ctx->channel == 1)
			{
				ctx->window_width = disp_info.window_width / 2;
				ctx->window_height = disp_info.window_height / 2;
				ctx->window_x = disp_info.window_width / 2;
				ctx->window_y = 0;
			}
			else if (ctx->channel == 2)
			{
				ctx->window_width = disp_info.window_width / 2;
				ctx->window_height = disp_info.window_height / 2;
				ctx->window_x = 0;
				ctx->window_y = disp_info.window_height / 2;
			}
			else
			{
				ctx->window_width = disp_info.window_width / 2;
				ctx->window_height = disp_info.window_height / 2;
				ctx->window_x = disp_info.window_width / 2;
				ctx->window_y = disp_info.window_height / 2;
			}
		}
		pthread_create(&ctx->dec_capture_loop, NULL,
				dec_capture_loop_fcn, ctx);
		pthread_create(&ctx->dec_feed_handle, NULL,
				dec_feed_loop_fcn, ctx);

cleanup:

		sem_wait(&(ctx->dec_run_sem)); //we need wait to make sure decode get EOS
		ctx->conv->waitForIdle(-1);
		ctx->conv->capture_plane.stopDQThread();
		ctx->conv->output_plane.stopDQThread();
		pthread_join(ctx->dec_feed_handle, NULL);
		pthread_join(ctx->dec_capture_loop, NULL);

		if (ctx->dec->isInError())
		{
			cerr << "Decoder is in error" << endl;
			error = 1;
		}

		if (ctx->got_error)
		{
			error = 1;
		}

		sem_destroy(&(ctx->dec_run_sem));
		// The decoder destructor does all the cleanup i.e set streamoff on output and capture planes,
		// unmap buffers, tell decoder to deallocate buffer (reqbufs ioctl with counnt = 0),
		// and finally call v4l2_close on the fd.
		delete ctx->dec;
		delete ctx->conv;

		// Similarly, EglRenderer destructor does all the cleanup
		delete ctx->renderer;
		delete ctx->in_file;
		delete ctx->conv_output_plane_buf_queue;
		delete ctx->render_buf_queue;

		if (error)
		{
			cout << "App run failed" << endl;
		}
		else
		{
			cout << "App run was successful" << endl;
		}

	}

}

	int
main(int argc, char *argv[])
{
	context_t ctx[CHANNEL_NUM];
	int iterator;
	char **argp;
	pthread_t main_loop_handle[CHANNEL_NUM];
	memset(&cfg, 0, sizeof(global_cfg));
	log_level = LOG_LEVEL_DEBUG;

	argp = argv;
	parse_global(&cfg, argc, &argp);

	if (parse_csv_args(&ctx[0],
				argc - cfg.channel_num - 1, argp))
	{
		fprintf(stderr, "Error parsing commandline arguments\n");
		return -1;
	}

	for (iterator = 0; iterator < cfg.channel_num; iterator++)
	{
		set_defaults(&ctx[iterator]);
		ctx[iterator].channel = iterator;

		if (parse_csv_args(&ctx[iterator],
					argc - cfg.channel_num - 1, argp))
		{
			fprintf(stderr, "Error parsing commandline arguments\n");
			return -1;
		}

		ctx[iterator].in_file_path = cfg.in_file_path[iterator];
		pthread_create(&main_loop_handle[iterator], NULL,
				multi_dec_main_loop_fcn, &ctx[iterator]);

	}

	pause();

	return 0;
}

2,Record two h264 files

The first file is recorded for a short time

gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), width=(int)176, height=(int)144, format=(string)I420' ! omxh264enc bitrate=2000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! filesink location=t1.h264 -e

The second file is slightly longer

gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420' ! omxh264enc bitrate=2000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! filesink location=t2.h264 -e

3,Run backend, decode two files

./backend 2 t1.h264 t2.h264 H264

4,After the completion of the two files decoding, there will be a variety of problems, There may be a segment fault,there will be a chance I will encounter problems

enter multi_dec_main_loop_fcn[1] loop_count 0
Failed to query video capabilities: Bad address
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:62) <dec1> :Opened, fd = 5
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:215) <dec1> :Successfully subscribed to event 5
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:177) <dec1> :Set controls
[LOG_LEVEL_DEBUG] (NvVideoDecoder.cpp:182) <dec1> :Disabling decoder complete frame input buffer: success
NvMMLiteOpen : Block : BlockType = 261 
TVMR: NvMMLiteTVMRDecBlockOpen: 7580: NvMMLiteBlockOpen 
NvMMLiteBlockCreate : Block : BlockType = 261 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:290) <dec1> :Output Plane:VIDIOC_S_FMT at capture plane successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:433) <dec1> :Output Plane:Reqbuf returned 10 buffers
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Output Plane:QueryBuf for 0th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Output Plane:ExportBuf successful for Buffer 0, Plane 0, fd = 1024
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 0, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Output Plane:QueryBuf for 1th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Output Plane:ExportBuf successful for Buffer 1, Plane 0, fd = 1025
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 1, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Output Plane:QueryBuf for 2th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Output Plane:ExportBuf successful for Buffer 2, Plane 0, fd = 1027
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 2, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Output Plane:QueryBuf for 3th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Output Plane:ExportBuf successful for Buffer 3, Plane 0, fd = 1029
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 3, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Output Plane:QueryBuf for 4th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Output Plane:ExportBuf successful for Buffer 4, Plane 0, fd = 1031
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 4, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Output Plane:QueryBuf for 5th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Output Plane:ExportBuf successful for Buffer 5, Plane 0, fd = 1033
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 5, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Output Plane:QueryBuf for 6th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Output Plane:ExportBuf successful for Buffer 6, Plane 0, fd = 1035
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 6, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Output Plane:QueryBuf for 7th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Output Plane:ExportBuf successful for Buffer 7, Plane 0, fd = 1036
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 7, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Output Plane:QueryBuf for 8th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Output Plane:ExportBuf successful for Buffer 8, Plane 0, fd = 1037
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 8, plane 0 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Output Plane:QueryBuf for 9th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Output Plane:ExportBuf successful for Buffer 9, Plane 0, fd = 1039
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 9, plane 0 to 
Failed to query video capabilities: Bad address
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:62) <conv1> :Opened, fd = 12
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:467) <dec1> :Output Plane:STREAMON successful
Starting decoder capture loop thread
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:257) <dec1> :Output Plane:Qed buffer 0
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:257) <dec1> :Output Plane:Qed buffer 1
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:257) <dec1> :Output Plane:Qed buffer 2
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:257) <dec1> :Output Plane:Qed buffer 3
TVMR: cbBeginSequence: 1166: BeginSequence  1920x1088, bVPR = 0, fFrameRate = 0.000000
TVMR: LowCorner Frequency = 0 
TVMR: cbBeginSequence: 1545: DecodeBuffers = 14, pnvsi->eCodec = 4, codec = 0 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:257) <dec1> :Output Plane:Qed buffer 4
TVMR: cbBeginSequence: 1606: Display Resolution : (1920x1080) 
TVMR: cbBeginSequence: 1607: Display Aspect Ratio : (1920x1080) 
TVMR: cbBeginSequence: 1649: ColorFormat : 5 
TVMR: cbBeginSequence:1660 ColorSpace = NvColorSpace_YCbCr709
TVMR: cbBeginSequence: 1790: SurfaceLayout = 3
TVMR: cbBeginSequence: 1868: NumOfSurfaces = 15, InteraceStream = 0, InterlaceEnabled = 0, bSecure = 0, MVC = 0 Semiplanar = 1, bReinit = 1, BitDepthForSurface = 8 LumaBitDepth = 8, ChromaBitDepth = 8, ChromaFormat = 5
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:102) <dec1> :DQed event 5
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:272) <dec1> :Capture Plane:Getting format: success
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:308) <dec1> :Capture Plane:Getting crop params: success
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:257) <dec1> :Output Plane:Qed buffer 5
[LOG_LEVEL_ERROR] (NvEglRenderer.cpp:109) <renderer0> Setting Screen width 960 height 540
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:111) <renderer0> :Display opened successfully 546467484208
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:199) <renderer0> :Egl Got display 4
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:257) <dec1> :Output Plane:Qed buffer 6
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:216) <renderer0> :Got numconfigs as 1
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:257) <dec1> :Output Plane:Qed buffer 7
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:257) <dec1> :Output Plane:Qed buffer 8
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:257) <dec1> :Output Plane:Qed buffer 9
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:151) <dec1> :Output Plane:DQed buffer 0
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:257) <dec1> :Output Plane:Qed buffer 0
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:151) <dec1> :Output Plane:DQed buffer 1
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:257) <dec1> :Output Plane:Qed buffer 1
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:151) <dec1> :Output Plane:DQed buffer 2
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:257) <dec1> :Output Plane:Qed buffer 2
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:667) <renderer0> :Shaders intialized
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:253) <renderer0> :Starting render thread
[LOG_LEVEL_DEBUG] (NvEglRenderer.cpp:148) <renderer0> :Renderer started successfully
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:446) <dec1> :Capture Plane:Already in STREAMOFF
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:831) <dec1> :Capture Plane:Stopped DQ Thread
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:433) <dec1> :Capture Plane:Reqbuf returned 0 buffers
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:372) <dec1> :Capture Plane:deinit successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:290) <dec1> :Capture Plane:VIDIOC_S_FMT at capture plane successful
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:158) <dec1> :Got value 15 for control 9963815
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:433) <dec1> :Capture Plane:Reqbuf returned 20 buffers
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 0th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 0, Plane 0, fd = 32506981
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 0, Plane 1, fd = 32506982
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 1th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 1, Plane 0, fd = 32507044
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 1, Plane 1, fd = 32507045
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 2th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 2, Plane 0, fd = 32507046
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 2, Plane 1, fd = 32507047
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 3th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 3, Plane 0, fd = 32507048
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 3, Plane 1, fd = 32507049
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 4th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 4, Plane 0, fd = 32507050
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 4, Plane 1, fd = 32507051
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 5th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 5, Plane 0, fd = 32507052
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 5, Plane 1, fd = 32507053
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 6th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 6, Plane 0, fd = 32507054
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 6, Plane 1, fd = 32507055
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 7th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 7, Plane 0, fd = 32507056
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 7, Plane 1, fd = 32507057
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 8th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 8, Plane 0, fd = 32507058
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 8, Plane 1, fd = 32507059
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 9th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 9, Plane 0, fd = 32507060
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 9, Plane 1, fd = 32507061
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 10th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 10, Plane 0, fd = 32507062
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 10, Plane 1, fd = 32507063
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 11th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 11, Plane 0, fd = 32507064
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 11, Plane 1, fd = 32507065
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 12th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 12, Plane 0, fd = 32507066
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 12, Plane 1, fd = 32507067
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 13th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 13, Plane 0, fd = 32507068
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 13, Plane 1, fd = 32507069
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 14th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 14, Plane 0, fd = 32507070
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 14, Plane 1, fd = 32507071
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 15th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 15, Plane 0, fd = 32507072
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 15, Plane 1, fd = 32507073
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 16th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 16, Plane 0, fd = 32507074
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 16, Plane 1, fd = 32507075
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 17th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 17, Plane 0, fd = 32507076
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 17, Plane 1, fd = 32507077
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 18th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 18, Plane 0, fd = 32507078
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 18, Plane 1, fd = 32507079
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <dec1> :Capture Plane:QueryBuf for 19th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 19, Plane 0, fd = 32507080
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <dec1> :Capture Plane:ExportBuf successful for Buffer 19, Plane 1, fd = 32507081
[LOG_LEVEL_WARN] (NvV4l2ElementPlane.cpp:790) <conv1> :Output Plane:Should not be called in blocking mode
[LOG_LEVEL_WARN] (NvV4l2ElementPlane.cpp:790) <conv1> :Capture Plane:Should not be called in blocking mode
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:446) <conv1> :Output Plane:Already in STREAMOFF
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:831) <conv1> :Output Plane:Stopped DQ Thread
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:433) <conv1> :Output Plane:Reqbuf returned 0 buffers
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:372) <conv1> :Output Plane:deinit successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:446) <conv1> :Capture Plane:Already in STREAMOFF
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:831) <conv1> :Capture Plane:Stopped DQ Thread
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:433) <conv1> :Capture Plane:Reqbuf returned 0 buffers
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:372) <conv1> :Capture Plane:deinit successful
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:177) <conv1> :Set controls
[LOG_LEVEL_DEBUG] (NvVideoConverter.cpp:200) <conv1> :Setting output plane buffer layout to 1: success
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:290) <conv1> :Output Plane:VIDIOC_S_FMT at capture plane successful
[LOG_LEVEL_DEBUG] (NvVideoConverter.cpp:143) <conv1> :Setting output plane format: success
[LOG_LEVEL_DEBUG] (NvV4l2Element.cpp:177) <conv1> :Set controls
[LOG_LEVEL_DEBUG] (NvVideoConverter.cpp:220) <conv1> :Setting capture plane buffer layout to 0: success
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:290) <conv1> :Capture Plane:VIDIOC_S_FMT at capture plane successful
[LOG_LEVEL_DEBUG] (NvVideoConverter.cpp:114) <conv1> :Setting capture plane format: success
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:334) <conv1> :Capture Plane:Setting selection: success
[LOG_LEVEL_DEBUG] (NvVideoConverter.cpp:296) <conv1> :Setting crop rectangle to left=0, top=0, width=1920, height=1080: success
libv4l2_nvvidconv (0):(765) (INFO) : Allocating (10) OUTPUT PLANE BUFFERS Layout=1
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:433) <conv1> :Output Plane:Reqbuf returned 10 buffers
libv4l2_nvvidconv (0):(775) (INFO) : Allocating (10) CAPTURE PLANE BUFFERS Layout=0
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:433) <conv1> :Capture Plane:Reqbuf returned 10 buffers
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <conv1> :Capture Plane:QueryBuf for 0th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 0, Plane 0, fd = 1236
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 0, Plane 1, fd = 1236
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 0, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 0, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <conv1> :Capture Plane:QueryBuf for 1th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 1, Plane 0, fd = 1237
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 1, Plane 1, fd = 1237
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 1, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 1, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <conv1> :Capture Plane:QueryBuf for 2th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 2, Plane 0, fd = 1238
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 2, Plane 1, fd = 1238
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 2, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 2, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <conv1> :Capture Plane:QueryBuf for 3th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 3, Plane 0, fd = 1239
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 3, Plane 1, fd = 1239
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 3, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 3, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <conv1> :Capture Plane:QueryBuf for 4th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 4, Plane 0, fd = 1240
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 4, Plane 1, fd = 1240
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 4, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 4, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <conv1> :Capture Plane:QueryBuf for 5th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 5, Plane 0, fd = 1241
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 5, Plane 1, fd = 1241
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 5, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 5, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <conv1> :Capture Plane:QueryBuf for 6th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 6, Plane 0, fd = 1242
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 6, Plane 1, fd = 1242
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 6, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 6, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <conv1> :Capture Plane:QueryBuf for 7th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 7, Plane 0, fd = 1243
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 7, Plane 1, fd = 1243
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 7, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 7, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <conv1> :Capture Plane:QueryBuf for 8th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 8, Plane 0, fd = 1244
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 8, Plane 1, fd = 1244
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 8, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 8, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:542) <conv1> :Capture Plane:QueryBuf for 9th buffer successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 9, Plane 0, fd = 1245
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:580) <conv1> :Capture Plane:ExportBuf successful for Buffer 9, Plane 1, fd = 1245
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 9, plane 0 to 
[LOG_LEVEL_DEBUG] (NvBuffer.cpp:175) <Buffer> Mapped buffer 9, plane 1 to 
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:467) <conv1> :Output Plane:STREAMON successful
[LOG_LEVEL_DEBUG] (NvV4l2ElementPlane.cpp:467) <conv1> :Capture Plane:STREAMON successful
DEBUG in query_and_set_capture, line 330

5,But if only one file decoding, the program is very stable and can be iterative decoding

./backend 1 t1.h264 H264

v4l2_backend_main _lilin.cpp (22.9 KB)

Hi Li,
We are checking with your sample app.

Hi,DaneLLL,

Is there anything new progress in this matter?
Is there any problem with my code?

Hi Li, please replace /usr/lib/aarch64-linux-gnu/libv4l/plugins/libv4l2_nvvidconv.so and give it a try
libv4l2_nvvidconv.so.txt (33.5 KB)

Hi, DaneLLL

Thanks a lot!
I’ll try it now.

Hi, DaneLLL

I also encountered similar problems at TX2,the conv and encoder is unstable when use for multi-channel transcoding[dec-conv-enc].There are any solution for TX2? Thank you.

Hi zcs, please give detail about the issue. Is it the case that you can run multiple [dec-conv-enc] in first time, but fails at second time?

Hi zcs,

Regarding TX2 issue, please file it into TX2 discussion board:
[url]https://devtalk.nvidia.com/default/board/188/jetson-tx2/[/url]

Thanks

Hi DaneLLL,

Thank you for your reply.

It not failing at second time, often fails at the the stop and release.

When stop and release, the program is as follows.

dec->output_plane.setStreamStatus(false);
dec->capture_plane.setStreamStatus(false);
dec->output_plane.stopDQThread();

conv->output_plane.setStreamStatus(false);
conv->capture_plane.setStreamStatus(false);
enc->output_plane.setStreamStatus(false);
enc->capture_plane.setStreamStatus(false);

conv->output_plane.stopDQThread();
conv->capture_plane.stopDQThread();
enc->output_plane.stopDQThread();
enc->capture_plane.stopDQThread();

delete conv;
delete enc;
delete dec;

It will block at “enc->capture_plane.stopDQThread()”, I debug it by gdb, then I see it block at wait the exit of “dqThread”, and the “dqThread” is block at “plane->dqBuffer”. dec/enc/conv is created with “O_NONBLOCK”.

Sometimes it will encounter a segment fault at “delete enc”.

Hi, DaneLLL

After replace libv4l2_nvvidconv.so, can run multiple times in multiple threads.
But after a long time to run the program, repeated Hundreds of times, threre will be a SIGSEGV occurred when calling eglInitialize, is this the same issue that we encountered before?

the issue we encountered in
https://devtalk.nvidia.com/default/topic/1003717/-tegra_multimedia_api-samples-00_video_decode-problem/

the gdb trace message

#0  0x0000007fb7e35ca8 in XQueryExtension () from /usr/lib/aarch64-linux-gnu/libX11.so.6
#1  0x0000007fb7e2a024 in XInitExtension () from /usr/lib/aarch64-linux-gnu/libX11.so.6
#2  0x0000007fb5a2ffb0 in XextAddDisplay () from /usr/lib/aarch64-linux-gnu/libXext.so.6
#3  0x0000007fb66e5580 in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libnvidia-glsi.so.24.2.1
#4  0x0000007fb6699364 in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libnvidia-glsi.so.24.2.1
#5  0x0000007fb6743a94 in ?? () from /usr/lib/aarch64-linux-gnu/tegra-egl/libEGL_nvidia.so.0
#6  0x0000007fb674b8ac in ?? () from /usr/lib/aarch64-linux-gnu/tegra-egl/libEGL_nvidia.so.0
#7  0x0000007fb674d39c in ?? () from /usr/lib/aarch64-linux-gnu/tegra-egl/libEGL_nvidia.so.0
#8  0x0000007fb7f542e8 in eglInitialize () from /usr/lib/aarch64-linux-gnu/tegra-egl/libEGL.so.1
#9  0x0000000000414ee4 in NvEglRenderer::renderThread(void*) ()
#10 0x0000007fb7f8bfc4 in start_thread (arg=0x414d14 <NvEglRenderer::renderThread(void*)>) at pthread_create.c:335
#11 0x0000007fb6c72110 in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:89

Yes. For the fix please wait for next release.

Ok ! thanks for your quick support!

Please try r28.1