Skip to content

Commit

Permalink
Add SVC and Simulcast support for AV1 and VP9. (jitsi#2350)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jallamsetty1 authored and subhamcyara committed Jul 19, 2024
1 parent 8683d27 commit 168f4ac
Show file tree
Hide file tree
Showing 12 changed files with 2,684 additions and 208 deletions.
2 changes: 1 addition & 1 deletion modules/RTC/CodecSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import browser from '../browser';
const logger = getLogger(__filename);

// Default video codec preferences on mobile and desktop endpoints.
const DESKTOP_VIDEO_CODEC_ORDER = [ CodecMimeType.VP9, CodecMimeType.VP8, CodecMimeType.H264 ];
const DESKTOP_VIDEO_CODEC_ORDER = [ CodecMimeType.VP9, CodecMimeType.VP8, CodecMimeType.H264, CodecMimeType.AV1 ];
const MOBILE_P2P_VIDEO_CODEC_ORDER = [ CodecMimeType.H264, CodecMimeType.VP8, CodecMimeType.VP9 ];
const MOBILE_VIDEO_CODEC_ORDER = [ CodecMimeType.VP8, CodecMimeType.VP9, CodecMimeType.H264 ];

Expand Down
82 changes: 81 additions & 1 deletion modules/RTC/MockClasses.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,13 @@ export class MockPeerConnection {
*
* @param {string} id RTC id
* @param {boolean} usesUnifiedPlan
* @param {boolean} simulcast
*/
constructor(id, usesUnifiedPlan) {
constructor(id, usesUnifiedPlan, simulcast) {
this.id = id;
this._usesUnifiedPlan = usesUnifiedPlan;
this.peerconnection = new MockRTCPeerConnection();
this._simulcast = simulcast;
}

/**
Expand Down Expand Up @@ -162,6 +164,15 @@ export class MockPeerConnection {
return Array.from(codecs);
}

/**
* {@link TraceablePeerConnection.isSpatialScalabilityOn}.
*
* @returns {boolean}
*/
isSpatialScalabilityOn() {
return this._simulcast;
}

/**
* {@link TraceablePeerConnection.processLocalSdpForTransceiverInfo}.
*
Expand Down Expand Up @@ -271,4 +282,73 @@ export class MockSignalingLayerImpl {
this._remoteSourceState[endpointId] = undefined;
}
}

}

/**
* MockTrack
*/
export class MockTrack {
/**
* A constructor
*/
constructor(height) {
this.height = height;
}

/**
* Returns height.
* @returns {number}
*/
getSettings() {
return {
height: this.height
};
}
}

/**
* MockJitsiLocalTrack
*/
export class MockJitsiLocalTrack {
/**
* A constructor
*/
constructor(height, mediaType, videoType) {
this.track = new MockTrack(height);
this.type = mediaType;
this.videoType = videoType;
}

/**
* Returns the height.
* @returns {number}
*/
getHeight() {
return this.track.height;
}

/**
* Returns track.
* @returns {MockTrack}
*/
getTrack() {
return this.track;
}

/**
* Returns media type.
* @returns {MediaType}
*/
getType() {
return this.type;
}

/**
* Returns video type.
* @returns {VideoType}
*/
getVideoType() {
return this.videoType;
}
}
Loading

0 comments on commit 168f4ac

Please sign in to comment.