Error: ssrc already exists in RTP listener

Hi,

I am running a PTT scenario.
The app works by opening send/receive transports initially.
Whenever you want to talk a new producer is created along with matching consumers on the receiving end.
When you finish talking I close the producer and the consumers are automatically closed.

Once in awhile, I get the following error: “ssrc already exists in RTP listener” which seems to come from inside the mediasoup workier.

I am not sure exactly how ssrc are allocated so I have no idea how to approach this issue.

Any advice will be greatly appreciated.

Thanks!

Could you enable mediasoup debug logs and share the output?

Could also check to make sure you aren’t calling produce more than once on the same producer.

Looks like you are creating a producer (this is, calling to transport.produce()) with the same parameters multiple times.

Why are you deleting the producer when the person finishes talking, and then creating a new one again when starts talking, instead of reusing the producer and simply pause and resume it?

I think you are both right regarding creating the producer with the same parameter more than once.
I still haven’t figured it out 100% but from the looks of it this could be a race condition in my code that is causing this. Thanks for the advice!

@jmillan, there are 2 reasons for not pausing the producer:

  1. There is sometime a need to switch the consumers, I could not find a way to stop the current consumers and create new ones without generating a new producer entirely.
  2. I noticed that although there is silence there are still packets going through the stream. I want to conserve the battery when the user stops talking for a long time.

If you have an idea how to tackle these 2 issues that would be great because pausing and resuming takes much less time and that would be a far better solution.

Thanks,
Yonatan

No idea with “switch to consumers” means. Regarding “a way to stop the current consumers and create new ones”: what is the problem? You don’t need to close and re-recreate a Producer for that. Just close a Consumer and create a new one. I’m afraid there is absolutely no reason for doing that.

In clisen side call audioProducer.replaceTrack({ track: null }). It will make the browser not send any RTP packet, not even silence RTP packets (but just STUN packets from time to time). Then, when talking again, call audioProducer.replaceTrack({ track: originalTrack }) again.

Ok, I see your point.
I will try and see if signalling the remote side to close the consumer works (in terms of performance).

Regarding the 2nd point, I am working on native (iOS/Android) currently I am disabling the native track but I will try and see if there is a native API for replacing the track with some null value.

Thanks