Stop display for python deepstream app

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Jetson Nano
• DeepStream Version : Deepstream 5.1
• JetPack Version (valid for Jetson only) JP 4.5
• TensorRT Version 7.1.3.0-1+cuda10.2

• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
deepstream_test_3.py from deepstream_python_apps throws an error when trying to stop display using either of these:

#sink = Gst.ElementFactory.make(“fakesink”, “fakesink”)
#sink = Gst.ElementFactory.make(“fakesink”, “fake-sink”)
#sink = Gst.ElementFactory.make(“nvoverlaysink”, “nvvideo-renderer”)

Error is:
0:00:14.553393432 12815 0x3d068590 WARN nvinfer gstnvinfer.cpp:1975:gst_nvinfer_output_loop: error: Internal data stream error.
0:00:14.553508223 12815 0x3d068590 WARN nvinfer gstnvinfer.cpp:1975:gst_nvinfer_output_loop: error: streaming stopped, reason error (-5)
Error: gst-stream-error-quark: Internal data stream error. (1): /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvinfer/gstnvinfer.cpp(1975): gst_nvinfer_output_loop (): /GstPipeline:pipeline0/GstNvInfer:primary-inference:
streaming stopped, reason error (-5)
Exiting app

For Jetson platform, the nvegltransform plugin is used to generate compatible content for nveglgles, but this content can not be consumed by fakesink or other open source sinks. You need to remove nvegltransform too.

    if is_aarch64():
        nvosd.link(queue5)
        queue5.link(transform)
        transform.link(sink)
    else:
        nvosd.link(queue5)
        queue5.link(sink)  

Should be changed to

nvosd.link(queue5)
queue5.link(sink)