Renater / SIPMediaGW

A media gateway to provide SIP access (audio+video) on top of Jitsi Meet, BBB,...web conferences
Apache License 2.0
30 stars 9 forks source link

Laggy video with sip video resolution 720p #11

Open NimbleDev opened 1 year ago

NimbleDev commented 1 year ago

Thank you for your great project, which has allowed us to successfully set up a sip video bridge. However, we are currently facing an issue: the video becomes extremely laggy, essentially unusable, when the sip source video resolution is set to 720p. Do you have any suggestions to solve this problem?

nicotyze commented 1 year ago

Thanks for the feedback :) A key point to keep in mind is that a SIP media gateway is really CPU consuming (=> auto scaling logic strongly recommended). This is the output of docker stats and top commands for a gateway (gw1) currently running from our side:

image

Moreover, in a cloud environment, you should use VM instances which provide the highest CPU performances . For instance, with this CSP: CPU v5 and performance flag = 1 (highest)

NimbleDev commented 1 year ago

Thanks for the feedback :) A key point to keep in mind is that a SIP media gateway is really CPU consuming (=> auto scaling logic strongly recommended). This is the output of docker stats and top commands for a gateway (gw1) currently running from our side:

image

Moreover, in a cloud environment, you should use VM instances which provide the highest CPU performances . For instance, with this CSP: CPU v5 and performance flag = 1 (highest)

Thx for your reply!

We ran our SIP media gateway in a VMWare virtual hots which has 24 cpu core and 64G ram. I think hardware resource is enough.

Below is the output of top command of the host, from which you can see the cpu load is not very high. image

Actually, from gw01 log which is shown below, we can see a lot of "decode_slice_header error". image

Would you pls kindly give some advise about these errors?

nicotyze commented 1 year ago

There are mainly two possible causes for "decode_slice_header error":

I see also efps=10.0/23.8 which means that the gateway encodes/sends a video at only 10fps and receives/decodes the video stream coming form your SIP endpoint at 23.8fps. Classically, these values should be close to efps=30.0/30.0 => there is a bottleneck somewhere...

From my experiments, low framerate values are in most cases due to lack of CPU ressources. Multithreading support for video encoding/decoding processes is quite limited and having many vCPUs may not be enough if the physicall CPU behind is not powerfull enough or if the vCPU:pCPU ratio is to high (for this kind off application it should be 1:1...).

Did you try with lower video resolutions ?

NimbleDev commented 1 year ago

Yes. If we downgrade the video resoluton, the video qualitiy would be stable. But in our use case, we require at least 720p resolution...... Other than using more powerful physical CPU, is there some config options we can try to improve the video performance?