Choppy video in Videoroom when more than 1 publishers are active

Hello,

I am having a weird problem when I stream to a videoroom with this scenario:
Chrome connects to the Videoroom a “Publisher” even though for now it’s only viewing the video and it works fine.
When a second tab on the same computer connects to the videoroom the same way, after about 5 seconds the video feed for both tabs starts chopping. The same behavior is seen when the 2 tabs are on the same computer, on different computers, different networks. The network bandwidth is OK since if I connect to 2 different video rooms on different tabs there is no problem.
I am getting a lot of slowlink events in the websocket, but nothing in the Janus logs. The video being sent is H264 and something even more strange is that when using a different encoder on the sending side I can connect many browser clients without any problems.

These are the 2 gstreamer pipelines that send the video to Janus via the Simple Whip Server:

gst-launch-1.0 \
    rtspsrc \
        latency=10 \
        drop-on-latency=true \
        location=rtsp://192.168.144.25:8554/main.264 ! \
    rtph264depay ! \
    h264parse config-interval=-1 ! \
    nvv4l2decoder \
        disable-dpb=true enable-max-performance=true ! \
    videorate max-rate=25 ! \
    nvv4l2h264enc \
        profile=0 \
        bitrate=6000000 \
        iframeinterval=15 \
        idrinterval=1 \
        maxperf-enable=true \
        poc-type=2 \
        insert-sps-pps=true ! \
    "video/x-h264, stream-format=(string)byte-stream, alignment=(string)au" ! \
    shmsink wait-for-connection=false socket-path=/tmp/video.socket

and

stream_command = [
            f'shmsrc socket-path={self.shm_socket} is-live=true', 
            'do-timestamp=true',
            '!',
            'h264parse', 
            '!', 
            'identity sync=true !',
            'rtph264pay', 
            'mtu=1300',
            'pt=96', 'ssrc=2', 
            '!',
            'application/x-rtp,media=video,encoding-name=H264,payload=96', '!',
            'whipsink', f"auth-token={self.room_details['room_mgmt_token']}", 
            f"whip-endpoint={SKYHUB_SERVER_URL}/whip/endpoint/{self.room_details['room_id']}"
        ]

when I use x264enc I can connect many browser tabs ( silent publishers ) without ant stuttering/chopping problems.

stream_command = [
    'rtspsrc', f'location={rtsp_url}', 
    'latency=5',
    'drop-on-latency=true',
    '!',
    'rtph264depay', 
    '!',
    'h264parse', 
    'config-interval=-1', 
    '!', 
    'avdec_h264',
    '!',
    'x264enc', 'bitrate=2000', 'speed-preset=ultrafast', 'tune=zerolatency', 'sliced-threads=true',
    'byte-stream=true',
    '!',
    'rtph264pay', 
    'aggregate-mode=zero-latency', 
    'config-interval=1', 'pt=96', 'ssrc=2', 
    '!',
    'application/x-rtp,media=video,encoding-name=H264,payload=96', '!',
    'whipsink', f"auth-token={self.room_details['room_mgmt_token']}", 
    f"whip-endpoint={SKYHUB_SERVER_URL}/whip/endpoint/{self.room_details['room_id']}"
]

I suspect that there is something missing or misconfigured in the pipeline, since the last time I saw slowlink events when only a single “Publisher” is connected they were fixed by adding
‘identity sync=true’ to the pipeline. If I decrease the non-working pipeline bitrate from 6mbps to say 4mbps I can open more tabs, but on the 3rd open tab the problem appears again. Janus is running in AWS , CPU is below 35%, RAM is below 5%. My connection is 1Gbit so it should be enough. When creating a videoroom I am specifying I need 3 threads and also I am specifying some random bitrate (64000). Also when I pass the camera stream directly even though it doesn’t play on all browsers ( high profile ) I get no such problems and its bitrate is 10Mbps or 20Mbps. What could I look into to further diagnose the root cause ?

Never encountered an issue like that.
Have you tried increasing Janus logging to 5 to see if something shows up?
Then get a packet capture from publisher and subscribers and inspect it. The slow link events suggest missing upstream packets.

The VideoRoom is not optimized for broadcasting high bitrates. Try adding some helper threads (see VideoRoom docs or its config file for context/info).