Gstdsexample_optimized.cpp got stuck with nvinfer

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Jetson AGX Xavier
• DeepStream Version 5.0
• JetPack Version (valid for Jetson only) 4.4

cd /opt/nvidia/deepstream/deepstream/sources/gst-plugins/gst-dsexample
and
make and sudo make install successfully.
then run the following pipeline successfully:

gst-launch-1.0 filesrc location= ~/data/sample_1080p_h264.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! m.sink_0 nvstreammux name=m batch-size=1 width=1280 height=720 ! nvinfer config-file-path= /opt/nvidia/deepstream/deepstream-5.0/sources/apps/sample_apps/deepstream-test1/dstest1_pgie_config.txt ! nvvideoconvert ! dsexample full-frame=0 ! nvdsosd ! nvegltransform ! nveglglessink

now change Makefile

USE_OPTIMIZED_DSEXAMPLE?=1

to compile gstdsexample_optimized.cpp and make/sudo make install successfully.

When run the above same pipeline again, got following error message:

Setting pipeline to PAUSED ...

Using winsys: x11 
Opening in BLOCKING MODE 
0:00:02.492726509 11673   0x55c20350a0 INFO                 nvinfer gstnvinfer.cpp:602:gst_nvinfer_logger:<nvinfer0> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1577> [UID = 1]: deserialized trt engine from :/opt/nvidia/deepstream/deepstream-5.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
INFO: [Implicit Engine Info]: layers num: 3
0   INPUT  kFLOAT input_1         3x368x640       
1   OUTPUT kFLOAT conv2d_bbox     16x23x40        
2   OUTPUT kFLOAT conv2d_cov/Sigmoid 4x23x40         

0:00:02.492908434 11673   0x55c20350a0 INFO                 nvinfer gstnvinfer.cpp:602:gst_nvinfer_logger:<nvinfer0> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:1681> [UID = 1]: Use deserialized engine model: /opt/nvidia/deepstream/deepstream-5.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
0:00:02.495228566 11673   0x55c20350a0 INFO                 nvinfer gstnvinfer_impl.cpp:311:notifyLoadModelStatus:<nvinfer0> [UID 1]: Load new model:/opt/nvidia/deepstream/deepstream-5.0/sources/apps/sample_apps/deepstream-test1/dstest1_pgie_config.txt sucessfully
Pipeline is PREROLLING ...
Got context from element 'eglglessink0': gst.egl.EGLDisplay=context, display=(GstEGLDisplay)NULL;
NvMMLiteOpen : Block : BlockType = 261 
NVMEDIA: Reading vendor.tegra.display-size : status: 6 
NvMMLiteBlockCreate : Block : BlockType = 261 
ERROR: from element /GstPipeline:pipeline0/GstDsExample:dsexample0: scale_and_fill_data:can not scale by ratio > 16 or < 1/16 for Jetson
Additional debug info:
gstdsexample_optimized.cpp(594): scale_and_fill_data (): /GstPipeline:pipeline0/GstDsExample:dsexample0
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...

** (gst-launch-1.0:11673): WARNING **: 20:30:18.850: Use gst_egl_image_allocator_alloc() to allocate from this allocator
0:00:02.767418217 11673   0x55c19966d0 WARN                 nvinfer gstnvinfer.cpp:1946:gst_nvinfer_output_loop:<nvinfer0> error: Internal data stream error.

Anything missing causing this error? Please advise. Thanks.

update: tracing the code and found where the error occurred: at line 591 in gstdsexample_optimized.cpp which causes the following error

dsexample0: scale_and_fill_data:can not scale by ratio > 16 or < 1/16 for Jetson

questions:

  1. why need this check in Jetson platform?
  2. why gstdsexample.cpp has the same code (at line 551) but not causing the error when running the same pipeline?
  1. Jetson performance is not enough to do the transform with ratio larger than 16 or less than 1/16. The check is to skip the transformation of such objects.
  2. The gstdsexample_optimized.cpp override submit_input_buffer() of GstBaseTransform. But it is not a proper way to generate output buffer in submit_input_buffer(). gstdsexample.cpp is the proper reference.