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

Add support for receiving offers in Streaming plugin #3199

Merged
merged 2 commits into from Apr 26, 2023

Conversation

lminiero
Copy link
Member

@lminiero lminiero commented Apr 11, 2023

In the Streaming plugin, it's always the plugin that generates an SDP offer, and the subscriber that provides an answer: this is something we decided to do on purpose since, when creating a mountpoint, we know the constraints and the available media already, and so it made much more sense to prepare an offer ourselves with those constraints in mind, rather than waiting for an offer and then try to match it. VideoRoom subscribers work the same way for exactly the same reason.

That said, the Streaming plugin is what we also use in our WHEP server prototype, and unfortunately, while previous versions of the specification supported this mode, the latest version of the draft now forces WHEP servers to receive an offer from viewers instead, and generate an answer accordingly. I don't like this approach at all, but if we want Janus to be used as a WHEP server, we must unfortunately support this ugly mode as well.

This PR is a first attempt at doing exactly that. It allows a subscriber to provide an SDP offer when sending a watch request, at which the Streaming plugin will respond with an SDP answer that matches the mountpoint configuration. To make things simpler, in this new offer-mode the plugin ignores any of the properties we typically support when handling a watch request: this means you can't, for instance, narrow down the list of streams you're interested in. The plugin will simply try to match incoming m-lines with available m-lines in the mountpoint, going in order: so, if the subscriber sent an offer with a single audio m-line and a single video m-line, but the mountpoint has multiple audio and/or video m-lines, the matching will proceed in order, so you'll get what you get (more than often the first m-lines in the mountpoint, assuming codecs match). I don't plan to change this behaviour in the short term.

Notice that the Streaming plugin demo in the repo has not been updated, and so will not support this mode: if you want to test this functionality with that demo, you'll have to modify it yourself. This new mode was specifically conceived and added for WHEP servers, which means I'll add a way to test this in our simple-whep-server instead. I'll copy a link to the related PR here when it's available.

@lminiero lminiero added the multistream Related to Janus 1.x label Apr 11, 2023
@lminiero
Copy link
Member Author

You can find linked above the PR in the WHEP server repo to test this feature. If you care about WHIP/WHEP, please do test and provide feedback. It does seem to work in the simple tests I made.

@lminiero
Copy link
Member Author

Merging. I'll try and backport this to 0.x too.

@lminiero lminiero merged commit c0948f2 into master Apr 26, 2023
8 checks passed
@lminiero lminiero deleted the streaming-useroffer branch April 26, 2023 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multistream Related to Janus 1.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant