Mediasoup as multiple broadcasting endpoint

I’m using mediasoup and mediasoup-client to broadcast video from GStreamer to a browser. Mediasoup works as an endpoint for multiple GStreamer streams ( now I have one worker, one router, few plain transports and few producers with its consumers). Everything works fine, except for one thing: when I start more than one stream, the first one works fine (in 95% of cases) and the following have “black screen” for few seconds and then go fine, or crashes with the following error:

RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:3821358884, payloadType:96]

I was researching the issue but found no errors or problems with GStreamer. I guess, the issue might be connected with wrong RtpEncodingParameters, defined in my solution.
The RtpParameters for my producer:

    kind: 'video',
    rtpParameters: {
      codecs: [{
        mimeType: 'video/H264',
        clockRate: 90000,
        payloadType: 96,
        parameters: { 'packetization-mode': 1, 'level-asymmetry-allowed': 1 },
        rtcpFeedback: [
          { type: 'nack' },
          { type: 'nack', parameter: 'pli' },
          { type: 'ccm', parameter: 'fir' },
          { type: 'goog-remb' },
          { type: 'transport-cc' },
      encodings: [{ ssrc: 111110 }],

I wonder if the ssrc value should be different for every producer?

Could you advise me smth? Let me know if you need more additional info.

May I know why you chose “mediasoup libraries” category instead of “integration”?

I’m sorry, probably It was a mistake. I read carefully the “integration” topic and it fits me more. Thanks!

But actually any thoughts about my issue?

I hope people in this forum with more expertise in GStreamer than me can help.

As I Mentioned before, I guess the problem is not with GStreamer. I think the problem is with RTPparameters from my producers. Should the ssrc value be different for every producer?

The rtpParameters given to transport.produce() in serveer side must represent what the real endpoint (GStreamer in your case) will send to mediasoup.

SSRC must be different for each Producer if you create many Producers on top of the same Plain/WebRtcTransport. The thing is: are you telling your GStreamer to really send RTP using that SSRC?

          { type: 'goog-remb' },
          { type: 'transport-cc' },

These ^ are currently not supported by GStreamer, even master branch.

UPD: transport-cc is present in master branch, but only for RTP and I’m not sure how usable it is.

I have different plain transports with single producer on top of each transport. And these producers have the same ssrc value.

The thing is: are you telling your GStreamer to really send RTP using that SSRC?

yes, sure. I instruct GStreamer to send rtp using ssrc and payload, used in producer options.

May it be the reason of mentioned issue?

Then that’s not a problem.

So the issue is probably not connected to mediasoup? :thinking:

It’s usually never connected to mediasoup but to external libs usage or wrong API usage.

Okay, so I’m gonna share my GStreamer pipeline, so may be somebody from this forum could help me

    'rtpbin', 'name=rtpbin', 'rtp-profile=avpf',
    'fdsrc', 'fd=0', 'blocksize=276480',
    '!', 'queue', 'max-size-bytes=0', 'max-size-buffers=0', 'max-size-time=0', 'min-threshold-buffers=1',
    '!', 'image/x-portable-pixmap,width=1280,height=720,framerate=20/1',
    '!', 'pnmdec',
    '!', 'videoconvert',
    '!', 'queue', 'max-size-bytes=0', 'max-size-buffers=0', 'max-size-time=0', 'min-threshold-buffers=1',
    '!', 'x264enc', 'tune=zerolatency', 'speed-preset=1', 'dct8x8=true', 'quantizer=23', 'pass=qual',
    '!', 'video/x-h264, profile=baseline',
    '!', 'rtph264pay', `ssrc=${ssrc}`, 'pt=96',
    '!', 'rtprtxqueue', 'max-size-time=2000', 'max-size-packets=0',
    '!', 'rtpbin.send_rtp_sink_0',
    '!', 'udpsink', 'bind-address=', 'host=', 'bind-port=5004', `port=${videoRtpPort}`,
    '!', 'udpsink', 'bind-address=', 'host=', `port=${videoRtcpPort}`, 'sync=false', 'async=false', 'udpsrc', 'port=5005',
    '!', 'rtpbin.recv_rtcp_sink_0',

@ibc there are a lot of debug logs from mediasoup:

[pid:10604] RTC::Transport::HandleRtcpPacket() | no Consumer found for received PLI Feedback packet [sender ssrc:1234, media ssrc:1234]
[pid:10604] RTC::Transport::HandleRtcpPacket() | no Consumer found for received Receiver Report [ssrc:309484411]
[pid:10604] RTC::PlainTransport::OnRtcpDataReceived() | ignoring RTCP packet from unknown IP:port
[pid:10604] RTC::TransportCongestionControlClient::MayEmitAvailableBitrateEvent() | high BWE value decrease detected, notifying the listener [now:1040000, before:1768093]

May it cause the issue?

No. That’s just that gstreamer send unsolicited RTCP PLI feedbacks.

You are telling the mediasoup Producer that it will receive RTP packets with SSRC 111110, but packets arrive with SSRC 3821358884 . That’s the problem.

Why? No idea. I don’t know if the way you are telling Gstreamer to send packets with SSRC 111110 is correct or not.

Hm, yes, probably that’s the reason. But i wonder should the SSRC value of Producer be the same as the one of Consumer? For example, consumer and producer stats:

{ bitrate: 1822285,
    byteCount: 28147645,
    firCount: 0,
    fractionLost: 0,
    kind: 'video',
    mimeType: 'video/H264',
    nackCount: 3234,
    nackPacketCount: 10022,
    packetCount: 64762,
    packetsDiscarded: 0,
    packetsLost: 848,
    packetsRepaired: 9856,
    packetsRetransmitted: 9996,
    pliCount: 71,
    roundTripTime: 82.6263427734375,
    rtxSsrc: 115972259,
    score: 9,
    ssrc: 332489534,
    timestamp: 1137999595,
    type: 'outbound-rtp' },
  { bitrate: 1773005,
    byteCount: 28024089,
    firCount: 0,
    fractionLost: 0,
    jitter: 0,
    kind: 'video',
    mimeType: 'video/H264',
    nackCount: 0,
    nackPacketCount: 0,
    packetCount: 67597,
    packetsDiscarded: 0,
    packetsLost: 0,
    packetsRepaired: 0,
    packetsRetransmitted: 0,
    pliCount: 18,
    score: 10,
    ssrc: 111110,
    timestamp: 1137999595,
    type: 'inbound-rtp' }

is it ok?

No, SSRC of Producer and Consumer don’t have the same value.

No. Please, focus on the producer side error. No Consumer involved here. No need for a Consumer to have the issue. Make your GStreamer send RTP packets with the same SSRC than then one you signal into transport.produce(), that’s all (for now).

Well, I instructed my GStreamer to send RTP packets with specific SSRC. It works fine i guess. The first video goes perfect, the problem is with another one. I looked at gstreamer logs and i noticed a warnings

0:05:23.307114113 14353 0x558ec5ba0120 DEBUG             rtpsession rtpsession.c:2817:rtp_session_process_rtcp: received RTCP packet
0:05:23.307128497 14353 0x558ec5ba0120 DEBUG             rtpsession rtpsession.c:2317:rtp_session_process_rr: got RR packet: SSRC 00000000
0:05:23.307135949 14353 0x558ec5ba0120 DEBUG             rtpsession rtpsession.c:2227:rtp_session_process_rb: RB 0: SSRC 0001b206, jitter 0
0:05:23.307142200 14353 0x558ec5ba0120 WARN              rtpsession rtpsession.c:2859:rtp_session_process_rtcp: got unknown RTCP packet
0:05:23.307145672 14353 0x558ec5ba0120 DEBUG             rtpsession rtpsession.c:2878:rtp_session_process_rtcp: 0x558ec5b9e440, received RTCP packet, avg size 80, 80

That means that GStreamer gets wrong RTCP packet from mediasoup or not? I see strange SSRC with zeros. What does it mean?