Aspect ratio disturb with multi source

We are trying to add multiple source with different different width height in deepstream 5.0 streammux and enable-padding true but the output of tiler on rtsp with grid view not proper and it is not maintaining aspect ratio,please suggest how we maintain aspect ratio with different different width height input source.
Thanks

Can you show me the result of tiler? Also pls share your config file with us if your are using deepstream-app

Pls also share your setup info.

thanks @bcao
Below is config file of pgie and some other configuration {tiler and streammux} directly set in my code not from config file

##config file changes
[property]
gpu-id=0
net-scale-factor=0.0039215697906911373
model-key=tlt_encode
model-engine-file= ./Model/resnet18_peoplenet_pruned.etlt_b16_gpu0_int8.engine
labelfile-path=./Model/resnet34_peoplenet.txt
workspace-size=1000
batch-size=1
network-mode=1
process-mode=1
model-color-format=0
num-detected-classes=3
interval=0
#maintain-aspect-ratio=1
gie-unique-id=1
output-blob-names=output_bbox/BiasAdd;output_cov/Sigmoid

[streammux]
enable=1
gpu-id=0
batch-size=1
batched-push-timeout=40000
width=1920
height=1080
enable-padding=1

and other changes in code below
##Codebase lavel configuration

streammux.set_property(‘width’, 1920)
streammux.set_property(‘height’, 1080)
streammux.set_property(‘batch-size’,number_sources )
streammux.set_property(‘batched-push-timeout’, 4000000)
streammux.set_property(‘enable-padding’, 1)

tiler_rows=int(math.sqrt(number_sources))
tiler_columns=int(math.ceil((1.0*number_sources)/tiler_rows))
tiler.set_property(“rows”,tiler_rows)
tiler.set_property(“columns”,tiler_columns)
tiler.set_property(“width”, 1920)
tiler.set_property(“height”, 1080)

##System Details:
GRX 1650 and also facing on xavier NX (jetpack 4.4)
ubantu 18
deepstream 5.0

Note: My input video 1 size is 960*1080 and input video 2 size is 960 * 576
PFA for output view screenshot

So the 960 is height or width?
And the left stream is video 1 or 2?

thanks
960 is width of video and left stream is video 1 9601080 and right one is 2 960576

All the frames coming out of streammux are 1920x1080

Tiler is stitching two 1920x1080 frames horizontally. So the combined output will have resolution of 3840x1080 , Tiler will scale the output while combining. So to maintain aspect ratio of the output, the output resolution should have the same aspect ratio as 3840x1080