PipeTransporting between different hosts not connected physically

Hi Team,

I am exploring the PipeTransports APIs of mediasoup, for two host connected to same LAN it is possible to pipe the stream from one host to the another. But, is it possible to use the same PipeTransport mechanisms to pipe the stream from one host to another over internet(two hosts not connected with each other over LAN but are on two different domains on internet)?

It’s possible but we need to enable SRTP and RTX o those scenarios. Track this issue. We’ll do it eventually as soon as we get some time or some motivation to prioritize this task:

1 Like

Hi Team,

Thank you so much for considering this🙏🏻

Although i had one thing in my mind, For the time being lets keep this rtp packet loss aside and proceed with the piping between two hosts over internet(say these two hosts are one in US and and other in UK for instance). I have this one to many broadcasting feature and my client is a college in UK, he has like 1000 students who will attend a webinar based lecture. The professor is sitting in US and connected to a mediasoup machine running in US. My client college knows where publisher is publishing(professor). So can i follow the below steps and get the video stream into UKs machine where 1000 students are connected?

Step 1 : create a UKPipeTransport from UK machine and make a http request to US machine sending UKPipeTransport.tuple.localIp, localPort as parameters.

Step 2 : listen to the above request and create USPipeTransport in US machine and connect this USPipeTransport to UKPipeTransport using the localIP, port in the req params(USPipeTransport.connect({ip : UKMachineIP, port : UKMachinePipe port})). also send in response the US machines localIP and port so that UKPipeTransport should be connected to USPipeTransport.

Step 3 : Now make a http request again from UK to US machine to make a pipe producer and send back the rtp params in response. Using these RTP params create a pipe consumer in UK machine with the exact same rtp params…

Following these 3 steps above i should get the video stream from US to UK through piping(assuming this is RTP stream and there could be some packet loss as well)

I hope i am following the documentation here…

Yes, basically those are the steps. You should also exchange more messages between servers to notify about pipeConsumer “close” or “pause” or “resume”, etc, so you can call close(), pause(), resume() etc in the associated pipeProducer in the other side, etc. Exactly the same that router.pipeToRouter() do, so check the code of that method to be sure.

2 Likes

Hi,

thanks for the response.

I have tried the above mentioned approach, followed the exact same steps. When i tried to consume the piped stream from one server to another server. The transport disconnected after a few seconds, after going into connecting state. Am i missing something here?

A PipeTransport just disconnects if you call close() on it (or if the Router that owns it is closed). You may paste the error log anyway.

Hi,

There are no error logs reported on the in the mediasoup client side or at the server side.

I am publishing the stream to ip address 14.140.248.242(Producers are on this VM), and i am subscribing the stream from a different address 34.93.212.173(Consuming the stream on this VM). I have made use of pipe transports to send the producers stream from 14.140.248.242 to 34.93.212.173. All the UDP/TCP ports are kept open.

Below are the screenshot of googCandidatePair

Pair 1 : Producer publishing on 14.140.242.248, It is clearly seen that bytes are being transferred as well as received.

Pair 2 : Consumers consuming on 34.93.212.173.

PS : I am using chrome browser, I am sending the stream of my webcam to 14.140.242.248. Then i am trying to consume the same stream in chrome browser by connecting to 34.93.212.173. Before consuming i have piped the streams between both the servers and no errors were observed while doing this pipe mechanism. I also hear a soft static noise in chrome at the consumers side…

I’m afraid those legacy stats captures in Chrome are mostly useless to figure out the problem. I don’t know what’s the status of your server side Consumer. Is it paused? have you checked server side consumer.getStats()? is consumer.paused === false? or is the producer pause? etc etc.

Hi,

I will be checking the stats of all pipetransports, pipeProducers and pipeConsumers tomorrow and may send it you for verification if i am doing something wrong.
For the servers in same VLAN i have achieved the piping of streams. But i still have this question in my mind that whether the PipeTransport will work for two host not connected to each other by LAN and are present anywhere globally accessible over internet.

They should work fine assuming there is network connectivity between them and assuming it’s a perfect link (no packet loss). If not a perfect link you must wait for this takes to be done:

Hi,

What exactly do u mean by network connectivity and perfect link?
Is it a persistent tcp connection that will be established between those two pipe transports?
Or is there some physical link between those two servers?

I just mean that both hosts are connected by a perfect network connection (LAN) without packet loss.

Hi,

If there is no physical LAN present between such two hosts, are we saying that piping will not take place? Even though i create two pipe transports and make them connect to each other.

No, I didn’t say that. I just said that piping will just work fine if the network connection between both hosts is perfect (no network packet loss) because, as the GitHub issue I referenced explains, currently there is no RTX/NACK (RTP retransmission) in PipeTransports. So if a video packet is lost between both hosts, consumers will get frozen video for 2-3 seconds until they send a RTCP PLI.

Thank you for your response.

I am not aware of RTCP PLI, I should brush up on those concepts first. I will do that now also i will be carrying out this considering there will be a packet loss for now.

Do you not believe the way mediasoup is being used for the huge capabilities that it provides with, this feature is required immediately? This could solve so many peoples problem of scalability, piping a stream from one point to another globally no matter if i am connected with a LAN or not. I see in the group 2-3 people apart from me have asked the similar questions.

Probably, but we have our jobs and our tasks and our priorities. If some mediasoup users need a feature they can contribute with a PR or with a donation to motivate us to re-prioritize things :wink: