gstCamera with UDP Stream

Hi, I want to detect objects on video stream coming with udp. I have been following the steps explained on

https://devtalk.nvidia.com/default/topic/1026076/jetson-tx2/can-imagenet-camera-link-with-ip-camera-/2/

Now, luckily I can open the gstreamer from the console with the following command,

udpsrc port=5600 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! queue ! avdec_h264 ! xvimagesink sync=false async=false -e

What I want is to run detectnet-camera.cpp such that it detects objects on video coming from udp, instead of webcam. To achieve this, I manipulated the buildLaunchStr method in gstCamera.cpp file like below: (Not sure if it is correct)

bool gstCamera::buildLaunchStr( gstCameraSrc src ) {
std::ostringstream ss;
ss << " udpsrc port=5600 !";
	ss << " application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse !"; 
	ss << " queue ! avdec_h264 ! xvimagesink sync=false async=false -e";
        mLaunchStr = ss.str();
	printf(LOG_GSTREAMER "gstCamera pipeline string:\n");
	printf("%s\n", mLaunchStr.c_str());
	return true;
}

But still, after I run detectnet-camera.cpp, I am getting the webcam video. Is there something I should change in detectnet-camera.cpp file too, or changes in gstCamera.cpp are wrong or missing ?

Thank you.

Hints from amateur.
My case:
Stream h264 udp from ip camera, captured with gstreamer frame operated with opencv sift feature. 4 fps. Rest of data from stream goes into memory buffer (??? I don’t know) and after some time program stuck on lack of memory etc.
I don’t know is it good to analyze stream better in my opinion is to catch frame, do something with it, catch next etc operate on it etc.
If Your process is quick not complicated maybe reduction of frames gives results.

https://devtalk.nvidia.com/default/topic/1071219/jetson-nano/ip-camera-rstp-using-with-jetson-nano-/post/5428452/#5428452

Changes in gstcamera.cpp and h are in attachments.

Maybe it will help You.