Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebRtcServer #834

Merged
merged 60 commits into from
Jun 22, 2022
Merged

WebRtcServer #834

merged 60 commits into from
Jun 22, 2022

Conversation

ibc
Copy link
Member

@ibc ibc commented Jun 17, 2022

Details

So instead of having each WebRtcTransport listening into its own local ports, here we introduce a new WebRtcServer class that listens in given protocol, IPs and ports and we extend the router.createWebRtcTransport() API so now it accepts a webRtcServer as option (if so, listenIps are ignored).

Usage example in mediasoup-demo project: versatica/mediasoup-demo#110

TODO

@nazar-pc
Copy link
Collaborator

transport has been closed by someone else

Isn't it sufficient to just know that transport has closed, without knowing why exactly? If that is the case, current close event is already sufficient for router to clean its maps.

@ibc
Copy link
Member Author

ibc commented Jun 18, 2022

transport has been closed by someone else

Isn't it sufficient to just know that transport has closed, without knowing why exactly? If that is the case, current close event is already sufficient for router to clean its maps.

There is no "close" event in Transport telling its parent Router that it has been closed. It's never been that way. The router closes the transport so it never needs to listen to any "close" event. Of course I'm talking about C++ side.

@nazar-pc
Copy link
Collaborator

There is no "close" event in Transport telling its parent Router that it has been closed. It's never been that way. The router closes the transport so it never needs to listen to any "close" event. Of course I'm talking about C++ side.

Hm, that is strange then. We do have transport.close message, which I would have expected triggers closing of the transport and everything related to it cleans up automatically.

@ibc
Copy link
Member Author

ibc commented Jun 18, 2022

Hm, that is strange then. We do have transport.close message, which I would have expected triggers closing of the transport and everything related to it cleans up automatically.

Of course we have, but it's the Router the one that intercepts it and closes the transport. I insist, in C++ parent closes the child, always :)

CleanShot-2022-06-18-at-18 57 24@2x

@nazar-pc
Copy link
Collaborator

Of course we have, but it's the Router the one that intercepts it and closes the transport. I insist, in C++ parent closes the child, always :)

Hm, if it was like that before then I guess it is fine, but I do find C++ less elegant and quite convoluted comparing to TypeScript.

@ibc
Copy link
Member Author

ibc commented Jun 18, 2022

Take into account that we don't expose any public C++ API. If we did then indeed we should do something more similar to what is done in TS.

@fippo
Copy link
Contributor

fippo commented Jun 18, 2022

I wonder if it is possible to measure if recv_mmsg in libuv gets more efficient with this since the chance that you pull multiple packets in a single read increases. Maybe @saghul knows

@ibc
Copy link
Member Author

ibc commented Jun 18, 2022

I wonder if it is possible to measure if recv_mmsg in libuv gets more efficient with this since the chance that you pull multiple packets in a single read increases. Maybe @saghul knows

We already use it for long.

@fippo
Copy link
Contributor

fippo commented Jun 19, 2022

We already use it for long.

I know but if you have more packets coming into the single port you get more efficiency here which would be 🎉

@jmillan
Copy link
Member

jmillan commented Jun 19, 2022

I know but if you have more packets coming into the single port you get more efficiency here which would be 🎉

That's my understanding too.

@ibc
Copy link
Member Author

ibc commented Jun 22, 2022

MERGING

@ibc ibc merged commit 5c85860 into v3 Jun 22, 2022
@ibc ibc deleted the webrtcserver branch June 22, 2022 10:15
@nazar-pc
Copy link
Collaborator

Working on Rust support for this and wondering if port should be optional in WebRtcServerListenInfo. I think it would make sense to be able to allocate port from the pool of ports available to the worker just like in case of individual transports.

@Robokishan
Copy link

Robokishan commented Jul 9, 2022

This is most amazing thing @ibc Thanks for mediasoup :). This is totally magic. as soon as I saw this and I did bring down my another ec2 workers. and it is very cost effective

@truanguyenvan
Copy link

hi @ALL, is there any way we can use webRtcServer in pipeTransport?

@nazar-pc
Copy link
Collaborator

Questions on the forum, don't abuse this PR

@truanguyenvan
Copy link

oh, so sorry. thank @nazar-pc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

6 participants