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

Initial support for AV1-SVC Dependency Descriptor #2741

Merged
merged 14 commits into from
Jan 25, 2022
Merged

Initial support for AV1-SVC Dependency Descriptor #2741

merged 14 commits into from
Jan 25, 2022

Conversation

lminiero
Copy link
Member

@lminiero lminiero commented Jul 22, 2021

As the title says, this is an initial effort to start tinkering with AV1-SVC. Specifically, this patch adds support for the new Dependency Descriptor RTP extension, which is needed to get SVC working. We don't do anything with the extension right now, we just negotiate it and copy it as a buffer so that it's available to plugins (and plugins can pass it along when relaying packets).

It's a draft for a few different reasons. The most important one is that I can't really test it, right now: any time I launch Chrome with the flag to negotiate the DD extension, if I enable SVC the extension seems to be broken (always too small), and so when relayed it causes broken video. I suspect it's an issue with the implementation of the extension in Chrome for Linux, but I can't know for sure until you people give it a try. The other reason is that I'm still working on the parser for the (awful) format of the extension: thanks to the incredibly kind @Murillo, I have access to a .pcap with extensions like they should be, and so I'm not at a good point parsing the content, but I'll need a working browser to test this in the "wild", e.g., to decide when to drop layers and when to pass them along.

If you want to test what's in there right now, you'll first of all need to launch Chrome with a custom flag to enable the DD extension:

--force-fieldtrials=WebRTC-DependencyDescriptorAdvertised/Enabled/

and then enable the "Experimental web platform features" flag to add AV1 scalability modes:

chrome://flags/#enable-experimental-web-platform-features

To make sure AV1-SVC is enabled in your browser, check the capabilities using the JavaScript console:

RTCRtpSender.getCapabilities('video');

This should list several scalabilityModes for "video/AV1X" in the codecs list, and "https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension" should be listed in the headerExtensions instead.

Once you're sure your browser should be ok, you can launch the EchoTest by passing a couple of query string parameters to force AV1 and a specific scalability mode, e.g.:

http://localhost:8000/echotest.html?vcodec=av1&svc=L3T3

If everything works, you should see the remote video as well: there's no buttons to choose layers yet since, as I anticipated, we currently do nothing with the extension if not pass it along. In my case, remote video doesn't work as the extension is always too small (e.g., ~8 bytes), while it should be much larger when it contains all the template definitions (~95 bytes in the example Sergio sent me). If it works for you, an unencrypted .pcap file or an .mjr file for the session would be quite appreciated, as it would allow me to try and replicate a real-time scenario while I figure out what's wrong in my browser.

@lminiero
Copy link
Member Author

PS: the same query string parameters work for the VideoRoom demo as well (assuming you created a room with AV1 support), even though I don't see much point in testing that yet, considering SVC is not really used at this stage.

@lminiero
Copy link
Member Author

PPS: I configured the legacy demo Janus instance to use this branch, so if you have an AV1-SVC compliant browser you can also test it online without installing this branch:

https://janus-legacy.conf.meetecho.com/echotest.html?vcodec=av1&svc=L3T3

@lminiero
Copy link
Member Author

Note: I just edited the PR description to clarify you need to enable the enable-experimental-web-platform-features flag in Chrome too, or scalability modes for AV1 won't be available.

@danjenkins
Copy link
Contributor

Unfortunately I don't get any video when Scalability Modes is enabled

Chrome Canary 94.0.4584.0 MacOS Intel

@lminiero
Copy link
Member Author

Found out the problem is in Janus, since we're rejecting the a=extmap-allow-mixed attribute, which is needed for the DD RTP extension (which uses two-bytes extensions since they can be larger than 16 bytes). Just negotiating the attribute isn't enough, since our RTP extension parser and builder currently only supports one-byte extensions. I'll work on that and update the PR accordingly.

@lminiero
Copy link
Member Author

This new commit implements support for two-byte header extensions, and does make video work for me finally. This means we now have a good foundation for building some SVC logic as the next step (sooner or later 😉 )

@danjenkins
Copy link
Contributor

I can confirm I also get working video at the above url with Scalable Video and the field trial enabled

@lminiero lminiero added the WIP label Oct 4, 2021
@lminiero
Copy link
Member Author

Just as I've done with #2685, I've decided to limit the scope of this PR, in order to simplify and streamline its main purpose, and leave the rest of the work to future effort. Specifically, since this PR was on hold for quite some time because of issues in the SVC selection process (i.e., how to effectively only forward some layers and not all of them), I removed the test logic I had in the EchoTest, where I only left the ability to negotiate the new Dependency Descriptor extension: together with the ability to capture and encode an SVC stream in the demo, this should provide a useful playground for future testing. I also removed the DD support I had added to the VideoRoom, as it would be useless at the moment (we don't use the SVC features in the SFU).

That said, the PR as it is is still very important, not only because it adds support for negotiating, parsing and forwarding the new DD extension, but also because in order to do that we had to implement support for Two-Byte header RTP extensions, which was missing in Janus and we now have (and will likely be useful for other things in the future).

Once we have cycles for that, we'll get back to actually use the SVC information we can now parse: last time I checked, the main issue was that, after a specific layer is selected, the whole DD must be rewritten (it cannot be forwarded as it is, since the active streams must be updated), which will be a huge pain due to the awful format of the DD itself.

@lminiero lminiero marked this pull request as ready for review January 25, 2022 15:13
@lminiero lminiero removed the WIP label Jan 25, 2022
@lminiero lminiero merged commit 4ce10e9 into master Jan 25, 2022
@lminiero lminiero deleted the av1-svc branch January 25, 2022 15:15
mwalbeck pushed a commit to mwalbeck/docker-janus-gateway that referenced this pull request Mar 16, 2022
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 [@&#8203;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 [@&#8203;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 [@&#8203;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 [@&#8203;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 <bot@walbeck.it>
Co-committed-by: renovate-bot <bot@walbeck.it>
@SetoKaiba
Copy link

image
I see no scalabilityModes with Chrome 113.0.5668.0 dev. Any idea?

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

Successfully merging this pull request may close these issues.

None yet

3 participants