RTSP-server delay with "buffer that is too big for memory" warning

I’m trying to get a rtsp stream and sending it away with a rtsp-server. Because of the rtsp-server library I’m now using the launch function “gst_rtsp_media_factory_set_launch()” to make a working pipeline. This works fine with the following launch command:

gst_rtsp_media_factory_set_launch( factory, "( rtspsrc location=rtsp://user:passw@172.16.100.120/axis-media/media.am ! rtph264depay ! rtph264pay name=pay0 pt=96 )" );

This does NOT have a delay. But as soon as I implement nvidia accelerated gstreamer elements, it gets a big delay. I wanted to use those elements, because I want to crop the incomming stream. I call the following launch command:

gst_rtsp_media_factory_set_launch( factory, "( rtspsrc location=rtsp://user:passw@172.16.100.120/axis-media/media.am ! rtph264depay ! h264parse ! nvv4l2decoder num-extra-surfaces=23 ! nvvidconv left=0 right=1200 top=0 bottom=960 ! x264enc ! rtph264pay name=pay0 pt=96 )" );

When its running with a debugger it continuously writes:

WARN v4l2bufferpool gstv4l2bufferpool.c:1482:gst_v4l2_buffer_pool_dqbuf:<nvv4l2decoder1:pool:sink> v4l2 provided buffer that is too big for the memory it was writing into. v4l2 claims 1008 bytes used but memory is only 0B. This is probably a driver bug.

I also notice that he CPU load is almost 100% of all the CPU’s.

Does someone know what’s the cause of this delay and how to solve this.

_
_
_

My setup is a
Jetson nano.
jetpack 4.4…
uname -r shows 4.9.140-tegra
gstreamer version 1.14.5
gst-rtsp-server

My code is directly from a example of the gst-rtsp-server library with only the launch function adjusted. But it looks like:

int main(int argc, char** argv)
{
  GMainLoop *loop;
  GstRTSPServer *server;
  GstRTSPMountPoints *mounts;
  GstRTSPMediaFactory *factory;
  gchar *launch_str;
//  GstElement *testelement;
//	GstRTSPUrl *out_url_rtsp;
	
  gst_init (&argc, &argv);

	
	
  loop = g_main_loop_new (NULL, FALSE);

  /* create a server instance */
  server = gst_rtsp_server_new ();

  /* get the mount points for this server, every server has a default object
   * that be used to map uri mount points to media factories */
  mounts = gst_rtsp_server_get_mount_points (server);

  /* make a media factory for a test stream. The default media factory can use
   * gst-launch syntax to create pipelines. 
   * any launch line works as long as it contains elements named pay%d. Each
   * element with pay%d names will be a stream */
  factory = gst_rtsp_media_factory_new ();
  launch_str = g_strdup( "( rtspsrc location=rtsp://root:RET_CV_7593@172.16.100.120/axis-media/media.amp latency=100 !\
   rtph264depay ! h264parse ! nvv4l2decoder num-extra-surfaces=23 ! \
   nvvidconv left=0 right=1200 top=0 bottom=960 ! \
   x264enc ! rtph264pay name=pay0 pt=96 )" );
	printf ("lauch_string: %s\n", launch_str);
  gst_rtsp_media_factory_set_launch (factory, launch_str );
     // "( rtspsrc location=rtsp://user:passw@172.16.100.120/axis-media/media.amp latency=100 ! rtph264depay ! rtph264pay name=pay0 pt=96 )");

  gst_rtsp_media_factory_set_shared (factory, TRUE);

  /* attach the test factory to the /test url */
  gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
  
//  gst_rtsp_url_parse("rtsp://127.0.0.1:8554/test", &out_url_rtsp);
//	testelement = gst_rtsp_media_factory_create_element(factory, out_url_rtsp);
//	gst_rtsp_url_free(out_url_rtsp);
//	gst_element_set_state(testelement, GST_STATE_PLAYING);
	
  /* don't need the ref to the mapper anymore */
  g_object_unref (mounts);

  /* attach the server to the default maincontext */
  gst_rtsp_server_attach (server, NULL);

  /* start serving */
  g_print ("stream ready at rtsp://127.0.0.1:8554/test\n");
  g_main_loop_run (loop);

  return 0;
}

Hi,
The print is harmless and you can eliminate it. Please refer to