Piping producers to other router with the same producer ID

I understand that producer ID must be unique, this is why it is generated automatically.

However when piping producers to other routers, it would have been extremely convenient to hide the implementation details and have the piped producer with the same exact producer ID as original.

We use this to map the same original source in multiple places, so this is out anchor across clients both server-side and client-side.
With producerId being different on piped producer this unfortunately causes a bunch of inconveniences and requires a log of mappings back and forth (and yes, appData helps here, but only so far).

Thoughts on having such an option available to the developer?

@nazar-pc could you have as a workaround a producerId of the form {id}_{sufx} with {sufx} related to the Router.id (or any other form of suffix)?
When you need the “global” producerId, you strip the suffix, and conversely when you are in a given Router, you build the {id}_{sufx} from the Router.id

I’m afraid we’re talking about different things.
My request is about Producer.id, which is auto-generated UUID inside of mediasoup internals. You can’t specify it externally at the moment.

I have already implemented everything necessary to map producers back and forth between routers, but with this feature (which should not be hard to implement technically) a lot of code and non-trivial logic would be gone.

1 Like

Indeed! Good point, would definitely simplify that case.

When using pipeToRouter() the generated pipe Producer in target router has the same id as the original Producer:

pipeProducer = await remotePipeTransport!.produce(
		id            : producer.id,
		kind          : pipeConsumer!.kind,
		rtpParameters : pipeConsumer!.rtpParameters,
		paused        : pipeConsumer!.producerPaused,
		appData       : producer.appData

Oh, it does indeed. I was a bit overengineering things at 2AM :slightly_smiling_face: