-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support for multistream PeerConnections (replaces #1459) #2211
Conversation
For some more context, you can refer to this talk I made last year at CommCon, where I described the relevant changes: |
hi,@lminiero |
@jamken it IS optional. Read the first changes in janus_videoroom.c which is where the updated documentation is. |
Hi Lorenzo, First of all, thank you for the hard work and nice feature! We have a question how multistreams will affect Streaming plugin in the following use-case: Currently we are using the Streaming plugin and rtp_forward request from VideoRoom to Streaming plugin for horizontal scalability. The question is what will happen when a new publisher comes to the scene. We would need somehow to add that publisher to the existing streaming mountpoint list. How should the above use-case be handled? We don't consider destroying and recreating the streaming mountpoint as a great idea, because it will be disruptive to the subscribers. Or maybe we misunderstand how the above use-case should be handled in the new multistream approach? Thank you in advance for any guidance! |
@digitalsamba Streaming mountpoints are static in the current iteration. As such, an approach might be pre-creating mountpoints with enough slots as you'll need, and "fill" them as people come in, without renegotiating. Not ideal, as you'll have to exchange info yourself out-of-band on who's what in that PeerConnection, but that's the only way to do that right now I guess. It's explicitly stated in the presentation I listed above as well that scaling the VideoRoom is a TBD I don't plan to change the way the new Streaming plugin works right now. One thing we might do in the future is make the VideoRoom itself support remote publishers, but that won't happen here. It's something we'll only look into once this effort has stabilized and it has been merged. |
5f46145
to
d0d449c
Compare
When will this be merged and docs get updated? How will this affect videoroom plugin? |
The sooner you provide feedback, the sooner I'll merge. I can't magically know it works for you if you don't try it and tell me. Check #1459 for docs and changes. |
Hi there, I am kind of beginner about webrtc stuffs. I was trying to send both screen and camera on same peer connection and came across with this pr. I want to ask a question about mid and its description. In order to differentiate the camera and screen, i want to pass descriptions. However I do not know anything about mid which belongs to my track. For example, user firstly publishes its camera which is mostly assigned to mid "0". Then, when user also publishes its screen, via configure request, there are two streams listed with mids "1" and "2". May be I need to add the new track into peer connection via addTrack function. However, again, there is no information about what does this track represents, screen or camera? And other users are not get notified about this track with event which has publishers array, when I have added track with configure request. Do you have any suggestion about this or have any idea to solve problem? I think I am missing some points about publishing and adding tracks. I don't know if I should open an issue or comment under this pr. And thanks for the efforts for the whole project and this pr. |
You're right, this bit is still partly missing, mostly because the way you add streams has not been properly updated yet. I want to update Until that happens (I'm busy with other things for the moment) you'll have to take care of the mapping yourself: e.g., negotiate an audio/video publisher as usual (to send audio/video), and then manually add a new track yourself and send a new offer; if you inspect the PeerConnection object ( |
Thanks for the answer. Specifying the mid foreach track can be really good idea, and if mid already exists, overriding the mid will help the application, because we will not need description anymore. For now, I will try to implement your temporary suggestion. |
hi.I have deploy the multistream branch to server but serveral problems
|
@kinserlin please check the guidelines again, before dropping a megaton of text in here. |
Firefox seems to be having issues with simulcast on this branch. I'm seeing constant |
Is there any specific reason sdp-utils.c has JANUS_BUFSIZE defined as 16384? It's causing SDP parsing to be cutoff in janus core when trying to negotiate multiple streams (5 audio and 5 video in my test case) in one SDP. |
This is a great addition to Janus. Thank you for taking it on. |
I puted 32768 there. Tested with 25 feeds in room |
Simply a value that we thought was large enough. Can't remember if we had a higher value in #1459. Anyway, I have tried a VideoRoom subscription with ~20 videos in and it seemed to work. If you experiment with different values and have proposals, happy to hear them. |
Not sure. Making them configurable would mean putting this burden on plugins, making them more complicated, as the core obviously doesn't know the relations between tracks: pretty sure it would have an impact on other parts of the core too (possibly RTCP SDES?). I'd rather not worry about that now, and get everything else working before that and merged, and in case it's an issue fix it later on. |
From what I've read in another issue, Firefox has other issues too. I'll have a look probably next week. |
Hi Lorenzo, |
I've hit the limit by letting the browser generate the offer. Most of the SDP is taken up by multiple h264 profiles for each video mline. Note that I am not using janus.js but using my own front end. |
Just noticed I didn't write it here explicitly as well: there is a date for when multistream will be merged, and a strategy for how to deal with those that prefer to keep on using the current 0.x branch. Please see PR #2855 for more information. |
The moment has finally come: merging the multistream branch on the day of Janus' 8th birthday! 🥳 🍰 |
For those that are interested, I wrote a blug post to summarize the changes: |
So great. I also saw your intervention to FOSDEM 2022. Congrats paisà! |
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [meetecho/janus-gateway](https://github.com/meetecho/janus-gateway) | major | `v0.11.7` -> `v1.0.0` | --- ### Release Notes <details> <summary>meetecho/janus-gateway</summary> ### [`v1.0.0`](https://github.com/meetecho/janus-gateway/blob/HEAD/CHANGELOG.md#v100---2022-03-03) [Compare Source](meetecho/janus-gateway@v0.12.0...v1.0.0) - Refactored Janus to support multistream PeerConnections \[[PR-2211](meetecho/janus-gateway#2211)] - Moved all source files under new 'src' folder to unclutter the repo \[[PR-2885](meetecho/janus-gateway#2885)] - Fixed definition of trylock wrapper when using pthreads \[[Issue-2894](meetecho/janus-gateway#2894)] - Fixed broken RTP when no extensions are negotiated - Added checks when inserting RTP extensions to avoid buffer overflows - Added missing support for disabled rid simulcast substreams in SDP \[[PR-2888](meetecho/janus-gateway#2888)] - Fixed TWCC feedback when simulcast SSRCs are missing (thanks [@​OxleyS](https://github.com/OxleyS)!) \[[PR-2908](meetecho/janus-gateway#2908)] - Added support for playout-delay RTP extension \[[PR-2895](meetecho/janus-gateway#2895)] - Fixed partially broken H.264 support when using Firefox in VideoRoom - Fixed new VideoRoom rtp_forward API ignoring some properties - Fixed deadlock and segfault when stopping Streaming mountpoint recordings \[[Issue-2902](meetecho/janus-gateway#2902)] - Fixed RTSP support in Streaming plugin for cameras that expect path-only DESCRIBE requests (thanks [@​jp-bennett](https://github.com/jp-bennett)!) \[[PR-2909](meetecho/janus-gateway#2909)] - Fixed RTP being relayed incorrectly in Lua and Duktape plugins - Added Duktape as optional dependency, instead of embedding the engine code \[[PR-2886](meetecho/janus-gateway#2886)] - Fixed crash at startup when not able to connect to RabbitMQ server - Improved fuzzing and checks on RTP extensions - Removed distinction between simulcast and simulcast2 in janus.js \[[PR-2887](meetecho/janus-gateway#2887)] - Other smaller fixes and improvements (thanks to all who contributed pull requests and reported issues!) ### [`v0.12.0`](meetecho/janus-gateway@v0.11.8...v0.12.0) [Compare Source](meetecho/janus-gateway@v0.11.8...v0.12.0) ### [`v0.11.8`](https://github.com/meetecho/janus-gateway/blob/HEAD/CHANGELOG.md#v0118---2022-02-11) [Compare Source](meetecho/janus-gateway@v0.11.7...v0.11.8) - Added initial (and limited) integration of RED audio \[[PR-2685](meetecho/janus-gateway#2685)] - Added support for Two-Byte header RTP extensions (RFC8285) and, partially, for the new Depencency Descriptor RTP extension (needed for AV1-SVC) \[[PR-2741](meetecho/janus-gateway#2741)] - Fixed rare race conditions between sending a packet and closing a connection \[[PR-2869](meetecho/janus-gateway#2869)] - Fix last stats before closing PeerConnection not being sent to handlers (thanks [@​zodiak83](https://github.com/zodiak83)!) \[[PR-2874](meetecho/janus-gateway#2874)] - Changed automatic allocation on static loops from round robin to least used \[[PR-2878](meetecho/janus-gateway#2878)] - Added new API to bulk start/stop MJR-based recordings in AudioBridge \[[PR-2862](meetecho/janus-gateway#2862)] - Fixed broken duration in spatial AudioBridge recordings - Fixed broken G.711 RTP forwarding in AudioBridge (thanks [@​AlexYaremchuk](https://github.com/AlexYaremchuk)!) \[[PR-2875](meetecho/janus-gateway#2875)] - Fixed broken recordings in NoSIP plugin - Fixed warnings when postprocessing Opus recordings with DTX packets - Other smaller fixes and improvements (thanks to all who contributed pull requests and reported issues!) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Reviewed-on: https://git.walbeck.it/walbeck-it/docker-janus-gateway/pulls/65 Co-authored-by: renovate-bot <[email protected]> Co-committed-by: renovate-bot <[email protected]>
This PR broke the previous Previous filenames ended like this:
After the PR they end like this:
This can break applications if they expect that the filenames will end in a certain way. Related changes in the code: https://github.com/meetecho/janus-gateway/pull/2211/files#diff-d96a677f8b8c31f15d44bf3a1d83934e5a6b6bdfab05bd70fd7be6119fb26740R7010-R7012 |
True, but with all the changes people had to be aware of to use version |
Thanks to our friends at Zextras (thanks guys!), we finally found the time and resources to revive the old multistream effort we started in #1459!
If you've followed its evolution, you'll remember that we actually started working on it a couple of years ago: unfortunately, due to lack of feedback, testing, and more in general us being way too busy with other things, that branch eventually became severely out of sync, and ended up being full of conflicts that were basically unresolvable. For that reason, we tagged that branch as #deprecated#, and stated we'd get back to it sooner or later, to re-apply the same changes starting from the latest Janus instead.
This is exactly what happened here. We went through all the changes we did at the time, rolled up our sleeves, and slowly figured out how they could be re-integrated in the new code base. Actually, this new effort is actually a bit leaner: in fact, the original patch contained a lot of changes that were not really relevant (renaming structures, defines, code style fixes, etc.), that could actually be considered mostly noise in the grand schema of things. As such, I decided to ignore all those changes instead, and just focus on what really needed changing to get all this working, which should make looking at the changes in the code a bit easier (not easy, but definitely easier).
For what concerns plugin APIs and, most importantly,
janus.js
APIs, the changes are exactly the same as the ones done in old #1459 (apart of course from new things that were added in the meanwhile, and were updated to be used here). While I plan to write a new summary soon, for the time being you can refer to the long description I made on the original PR, as most, if not all, of the concepts explained there apply here too.Please notice that I won't let this effort die like #1459 did. I encourage you to test this and provide feedback, because this WILL be merged soon, and will be our
1.0.0
version. Considering the disruptive nature of this branch (which is only partly backwards compatible, especially in a few plugins), we plan to create a separate branch for the existing0.10.x
Janus, rather than simply create a tag: in fact, a tag cannot be updated (it's a snapshot), while a separate branch can still receive fixes and optionally enhancements. Please beware, though, that once multistream is merged we'll focus our development efforts on that: we'll still push and accept fixes for bugs on whatever branch0.10.x
will be on, but we won't work on new features there. This should give you one additional motivation in exploring this branch as soon as possible, and ensure that it will work as expected for you.I made a few tests and all plugins seem to be working as expected. I did notice a few leaks here and there, possibly caused by missing reference counters somewhere, that I plan to address in the next few days. That said, please test and provide feedback!