-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 SVC and Simulcast support for AV1 and VP9. #2350
Add SVC and Simulcast support for AV1 and VP9. #2350
Conversation
b65fc87
to
a4d8fed
Compare
Depends on jitsi/jitsi-videobridge#1998 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments!
modules/RTC/TPCUtils.js
Outdated
if (videoQualitySettings) { | ||
for (const codec of VIDEO_CODECS) { | ||
const bitrateSettings = videoQualitySettings[codec]?.maxBitratesVideo | ||
?? videoQualitySettings[codec.toUpperCase()]?.maxBitratesVideo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we have the codecs in upper case in the constant to avoid having to uppercase here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to make sure that the code is case insensitive for the codec value in config.js. If we have them in upper case in the constant, then we need to check if the codec value is in lower case in config.js.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in the same line you are indexing it both ways. It looks super weird.
aae4fb0
to
36cfbcd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some more comments, PTAL!
modules/RTC/TPCUtils.js
Outdated
if (videoQualitySettings) { | ||
for (const codec of VIDEO_CODECS) { | ||
const bitrateSettings = videoQualitySettings[codec]?.maxBitratesVideo | ||
?? videoQualitySettings[codec.toUpperCase()]?.maxBitratesVideo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in the same line you are indexing it both ways. It looks super weird.
Multi-encoding simulcast for H.264 is supported now because of the AV1 DD support added on the bridge side.
Expect the videoQuality settings in the new format, deprecated configs are still supported. videoQuality: { AV1: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1000000, ssHigh: 1500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useL3T3: true //(defaults to L3T3_KEY) }, }, H264: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP8: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP9: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1200000, ssHigh: 2500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useL3T3: true //(defaults to L3T3_KEY) }, } }
Both Simulcast and SVC modes are sipported for AV1 and VP9. The default mode for both of them is SVC and is enabled by default unless it is explicitly disabled from config.js. videoQuality: { av1: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1000000, ssHigh: 2500000 }, scalabilityModeEnabled: true, useSimulcast: false, useL3T3: true }, h264: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 }, scalabilityModeEnabled: true }, vp8: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 }, scalabilityModeEnabled: false }, vp9: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1200000, ssHigh: 2500000 }, scalabilityModeEnabled: true, useSimulcast: false, useL3T3: true } }
Add more unit tests.
72b525a
to
eea4b9e
Compare
516b643
to
24ca340
Compare
Also read the deprecated max bitrates correctly, add unit tests to test it.
It makes more sense to call it spatial scalability than simulcast now that full SVC support is available.
2303526
to
c95d187
Compare
*/ | ||
calculateEncodingsScaleFactor(localVideoTrack, codec, maxHeight) { | ||
if (this.pc.isSpatialScalabilityOn() && this.isRunningInSimulcastMode(codec)) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not return 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scale factor needs to be reconfigured (for layer suspension) only for the full SVC case. For simulcast case, they remain constant.
return height / activeEncoding.scaleResolutionDownBy; | ||
} | ||
|
||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not make this 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this method returns null for cases when the send resolution cannot be determined. I think it makes sense to return null here.
* AV1 Dependency Descriptor header extensions is offered by Jicofo. H.264 simulcast is also possible when these | ||
* header extensions are negotiated. | ||
*/ | ||
this._supportsAv1HeaderExts = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't renaming this to supportsDDHeaderExt
make more sense?
|
||
const parsedSdp = transform.parse(description.sdp); | ||
const mLines = parsedSdp.media.filter(m => m.type === MediaType.VIDEO); | ||
const extUri = 'https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe extract this to the top since it's a module level constant.
|
||
if (this._supportsAv1HeaderExts && shouldNegotiateHeaderExts && headerIndex < 0) { | ||
mLine.ext.push({ | ||
value: 11, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 11?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
11 is the header ext id used by Jicofo/bridge for the DD RTP header extension. I have declared it as a variable now.
@@ -403,23 +401,25 @@ export default class JingleSessionPC extends JingleSession { | |||
pcOptions.capScreenshareBitrate = false; | |||
pcOptions.codecSettings = options.codecSettings; | |||
pcOptions.enableInsertableStreams = options.enableInsertableStreams; | |||
pcOptions.videoQuality = options.videoQuality; | |||
|
|||
if (options.videoQuality) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This converts all the videoQuality key values to lowercase so that the code is case insensitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work! Left some nmon-blocking comments, which can be handled in subsequent PRs since I suppose we might need to tweak things a bit.
Also, is mobile ok with this change?
Actually, thats a good idea. I will merge this and open a follow-up PR. I don't see many changes though. Yes, no issues with mobile. |
Let's go then! 🙌 |
Add SVC and Simulcast support for AV1 and VP9. The default mode is the full SVC mode for VP9. It works as expected with the current version of JVB. AV1 in the client is only supported when the bridge negotiates the Dependency Descriptor extension headers which are needed for reading the layer information for AV1 and H.264 video frames. * feat: Enable H.264 simulcast support. Multi-encoding simulcast for H.264 is supported now because of the DD header ext support added on the bridge side. * fix(video-quality): Add default bitrates for all codecs. Expect the videoQuality settings in the new format, deprecated configs are still supported. videoQuality: { AV1: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1000000, ssHigh: 1500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useKSVC: true //(defaults to L3T3_KEY) }, }, H264: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP8: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP9: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1200000, ssHigh: 2500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useKSVC: true //(defaults to L3T3_KEY) }, } } * Disable encodings when requested height for screenshare is 0. * feat: add unit tests for scalability modes. * ref: Move all encoding configuration calculation to TPCUtils. * Add more unit tests for VP9 K-SVC mode. * Make codec name in settings case insensitive. Also read the deprecated max bitrates correctly, add unit tests to test it. * ref(TPC): isSimulcastOn -> isSpatialScalabilityOn. It makes more sense to call it spatial scalability than simulcast now that full SVC support is available. * fix: Negotiate AV1 DD header exts only for AV1 and H.264. * fix: Rename setting useL3T3Mode->useKSVC and adjust the defaults.
Add SVC and Simulcast support for AV1 and VP9. The default mode is the full SVC mode for VP9. It works as expected with the current version of JVB. AV1 in the client is only supported when the bridge negotiates the Dependency Descriptor extension headers which are needed for reading the layer information for AV1 and H.264 video frames. * feat: Enable H.264 simulcast support. Multi-encoding simulcast for H.264 is supported now because of the DD header ext support added on the bridge side. * fix(video-quality): Add default bitrates for all codecs. Expect the videoQuality settings in the new format, deprecated configs are still supported. videoQuality: { AV1: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1000000, ssHigh: 1500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useKSVC: true //(defaults to L3T3_KEY) }, }, H264: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP8: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP9: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1200000, ssHigh: 2500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useKSVC: true //(defaults to L3T3_KEY) }, } } * Disable encodings when requested height for screenshare is 0. * feat: add unit tests for scalability modes. * ref: Move all encoding configuration calculation to TPCUtils. * Add more unit tests for VP9 K-SVC mode. * Make codec name in settings case insensitive. Also read the deprecated max bitrates correctly, add unit tests to test it. * ref(TPC): isSimulcastOn -> isSpatialScalabilityOn. It makes more sense to call it spatial scalability than simulcast now that full SVC support is available. * fix: Negotiate AV1 DD header exts only for AV1 and H.264. * fix: Rename setting useL3T3Mode->useKSVC and adjust the defaults.
Add SVC and Simulcast support for AV1 and VP9. The default mode is the full SVC mode for VP9. It works as expected with the current version of JVB. AV1 in the client is only supported when the bridge negotiates the Dependency Descriptor extension headers which are needed for reading the layer information for AV1 and H.264 video frames. * feat: Enable H.264 simulcast support. Multi-encoding simulcast for H.264 is supported now because of the DD header ext support added on the bridge side. * fix(video-quality): Add default bitrates for all codecs. Expect the videoQuality settings in the new format, deprecated configs are still supported. videoQuality: { AV1: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1000000, ssHigh: 1500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useKSVC: true //(defaults to L3T3_KEY) }, }, H264: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP8: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP9: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1200000, ssHigh: 2500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useKSVC: true //(defaults to L3T3_KEY) }, } } * Disable encodings when requested height for screenshare is 0. * feat: add unit tests for scalability modes. * ref: Move all encoding configuration calculation to TPCUtils. * Add more unit tests for VP9 K-SVC mode. * Make codec name in settings case insensitive. Also read the deprecated max bitrates correctly, add unit tests to test it. * ref(TPC): isSimulcastOn -> isSpatialScalabilityOn. It makes more sense to call it spatial scalability than simulcast now that full SVC support is available. * fix: Negotiate AV1 DD header exts only for AV1 and H.264. * fix: Rename setting useL3T3Mode->useKSVC and adjust the defaults.
Add SVC and Simulcast support for AV1 and VP9. The default mode is the full SVC mode for VP9. It works as expected with the current version of JVB. AV1 in the client is only supported when the bridge negotiates the Dependency Descriptor extension headers which are needed for reading the layer information for AV1 and H.264 video frames. * feat: Enable H.264 simulcast support. Multi-encoding simulcast for H.264 is supported now because of the DD header ext support added on the bridge side. * fix(video-quality): Add default bitrates for all codecs. Expect the videoQuality settings in the new format, deprecated configs are still supported. videoQuality: { AV1: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1000000, ssHigh: 1500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useKSVC: true //(defaults to L3T3_KEY) }, }, H264: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP8: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP9: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1200000, ssHigh: 2500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useKSVC: true //(defaults to L3T3_KEY) }, } } * Disable encodings when requested height for screenshare is 0. * feat: add unit tests for scalability modes. * ref: Move all encoding configuration calculation to TPCUtils. * Add more unit tests for VP9 K-SVC mode. * Make codec name in settings case insensitive. Also read the deprecated max bitrates correctly, add unit tests to test it. * ref(TPC): isSimulcastOn -> isSpatialScalabilityOn. It makes more sense to call it spatial scalability than simulcast now that full SVC support is available. * fix: Negotiate AV1 DD header exts only for AV1 and H.264. * fix: Rename setting useL3T3Mode->useKSVC and adjust the defaults.
Add SVC and Simulcast support for AV1 and VP9. The default mode is the full SVC mode for VP9. It works as expected with the current version of JVB. AV1 in the client is only supported when the bridge negotiates the Dependency Descriptor extension headers which are needed for reading the layer information for AV1 and H.264 video frames. * feat: Enable H.264 simulcast support. Multi-encoding simulcast for H.264 is supported now because of the DD header ext support added on the bridge side. * fix(video-quality): Add default bitrates for all codecs. Expect the videoQuality settings in the new format, deprecated configs are still supported. videoQuality: { AV1: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1000000, ssHigh: 1500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useKSVC: true //(defaults to L3T3_KEY) }, }, H264: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP8: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP9: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1200000, ssHigh: 2500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useKSVC: true //(defaults to L3T3_KEY) }, } } * Disable encodings when requested height for screenshare is 0. * feat: add unit tests for scalability modes. * ref: Move all encoding configuration calculation to TPCUtils. * Add more unit tests for VP9 K-SVC mode. * Make codec name in settings case insensitive. Also read the deprecated max bitrates correctly, add unit tests to test it. * ref(TPC): isSimulcastOn -> isSpatialScalabilityOn. It makes more sense to call it spatial scalability than simulcast now that full SVC support is available. * fix: Negotiate AV1 DD header exts only for AV1 and H.264. * fix: Rename setting useL3T3Mode->useKSVC and adjust the defaults.
Add SVC and Simulcast support for AV1 and VP9. The default mode is the full SVC mode for VP9. It works as expected with the current version of JVB. AV1 in the client is only supported when the bridge negotiates the Dependency Descriptor extension headers which are needed for reading the layer information for AV1 and H.264 video frames. * feat: Enable H.264 simulcast support. Multi-encoding simulcast for H.264 is supported now because of the DD header ext support added on the bridge side. * fix(video-quality): Add default bitrates for all codecs. Expect the videoQuality settings in the new format, deprecated configs are still supported. videoQuality: { AV1: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1000000, ssHigh: 1500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useKSVC: true //(defaults to L3T3_KEY) }, }, H264: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP8: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP9: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1200000, ssHigh: 2500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useKSVC: true //(defaults to L3T3_KEY) }, } } * Disable encodings when requested height for screenshare is 0. * feat: add unit tests for scalability modes. * ref: Move all encoding configuration calculation to TPCUtils. * Add more unit tests for VP9 K-SVC mode. * Make codec name in settings case insensitive. Also read the deprecated max bitrates correctly, add unit tests to test it. * ref(TPC): isSimulcastOn -> isSpatialScalabilityOn. It makes more sense to call it spatial scalability than simulcast now that full SVC support is available. * fix: Negotiate AV1 DD header exts only for AV1 and H.264. * fix: Rename setting useL3T3Mode->useKSVC and adjust the defaults.
Add SVC and Simulcast support for AV1 and VP9. The default mode is the full SVC mode for VP9. It works as expected with the current version of JVB. AV1 in the client is only supported when the bridge negotiates the Dependency Descriptor extension headers which are needed for reading the layer information for AV1 and H.264 video frames. * feat: Enable H.264 simulcast support. Multi-encoding simulcast for H.264 is supported now because of the DD header ext support added on the bridge side. * fix(video-quality): Add default bitrates for all codecs. Expect the videoQuality settings in the new format, deprecated configs are still supported. videoQuality: { AV1: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1000000, ssHigh: 1500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useKSVC: true //(defaults to L3T3_KEY) }, }, H264: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP8: { maxBitratesVideo: { low: 200000, standard: 500000, high: 1500000, ssHigh: 2500000 } }, VP9: { maxBitratesVideo: { low: 100000, standard: 300000, high: 1200000, ssHigh: 2500000 }, useScalabilityModeAPI: { enabled: true, useSimulcast: true, //(defaults to SVC), useKSVC: true //(defaults to L3T3_KEY) }, } } * Disable encodings when requested height for screenshare is 0. * feat: add unit tests for scalability modes. * ref: Move all encoding configuration calculation to TPCUtils. * Add more unit tests for VP9 K-SVC mode. * Make codec name in settings case insensitive. Also read the deprecated max bitrates correctly, add unit tests to test it. * ref(TPC): isSimulcastOn -> isSpatialScalabilityOn. It makes more sense to call it spatial scalability than simulcast now that full SVC support is available. * fix: Negotiate AV1 DD header exts only for AV1 and H.264. * fix: Rename setting useL3T3Mode->useKSVC and adjust the defaults.
Both Simulcast and SVC modes are supported for AV1 and VP9. The default mode for both of them is SVC and is enabled by default unless it is explicitly disabled from config.js.