Skip to content

Commit

Permalink
ref(TPC): isSimulcastOn -> isSpatialScalabilityOn.
Browse files Browse the repository at this point in the history
It makes more sense to call it spatial scalability than simulcast now that full SVC support is available.
  • Loading branch information
jallamsetty1 committed Oct 7, 2023
1 parent ad6e1af commit 72e0736
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 24 deletions.
4 changes: 2 additions & 2 deletions modules/RTC/MockClasses.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ export class MockPeerConnection {
}

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

Expand Down
12 changes: 6 additions & 6 deletions modules/RTC/TPCUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class TPCUtils {
const codec = this.pc.getConfiguredVideoCodec();
const encodings = this._getVideoStreamEncodings(localTrack.getVideoType(), codec);

if (this.pc.isSimulcastOn() && localTrack.isVideoTrack()) {
if (this.pc.isSpatialScalabilityOn() && localTrack.isVideoTrack()) {
return encodings;
}

Expand Down Expand Up @@ -463,7 +463,7 @@ export class TPCUtils {
.map(encoding => height / encoding.scaleResolutionDownBy)
.map((frameHeight, idx) => {
// Single video stream.
if (!this.pc.isSimulcastOn() || this._isRunningInFullSvcMode(codec)) {
if (!this.pc.isSpatialScalabilityOn() || this._isRunningInFullSvcMode(codec)) {
const { active } = this._calculateActiveEncodingParams(localVideoTrack, codec, newHeight);

return idx === 0 ? active : false;
Expand Down Expand Up @@ -514,7 +514,7 @@ export class TPCUtils {
let bitrate = encoding.maxBitrate;

// Single video stream.
if (!this.pc.isSimulcastOn() || this._isRunningInFullSvcMode(codec)) {
if (!this.pc.isSpatialScalabilityOn() || this._isRunningInFullSvcMode(codec)) {
const { maxBitrate } = this._calculateActiveEncodingParams(localVideoTrack, codec, newHeight);

return idx === 0 ? maxBitrate : 0;
Expand Down Expand Up @@ -545,7 +545,7 @@ export class TPCUtils {
* @returns {Array<VideoEncoderScalabilityMode> | undefined}
*/
calculateEncodingsScalabilityMode(localVideoTrack, codec, maxHeight) {
if (!this.pc.isSimulcastOn() || !this.codecSettings[codec].scalabilityModeEnabled) {
if (!this.pc.isSpatialScalabilityOn() || !this.codecSettings[codec].scalabilityModeEnabled) {
return;
}

Expand Down Expand Up @@ -581,7 +581,7 @@ export class TPCUtils {
* @returns {number|undefined}
*/
calculateEncodingsScaleFactor(localVideoTrack, codec, maxHeight) {
if (this.pc.isSimulcastOn() && this.isRunningInSimulcastMode(codec)) {
if (this.pc.isSpatialScalabilityOn() && this.isRunningInSimulcastMode(codec)) {
return;
}

Expand Down Expand Up @@ -643,7 +643,7 @@ export class TPCUtils {
localVideoTrack.getVideoType(),
this.pc.getConfiguredVideoCodec());
const scaleResolutionDownBy
= this.pc.isSimulcastOn()
= this.pc.isSpatialScalabilityOn()
? encodingConfig[encoding].scaleResolutionDownBy
: parameters.encodings[encoding].scaleResolutionDownBy;

Expand Down
27 changes: 14 additions & 13 deletions modules/RTC/TraceablePeerConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,11 +571,11 @@ TraceablePeerConnection.prototype._getReceiversByEndpointIds = function(endpoint
};

/**
* Tells whether or not this TPC instance is using Simulcast.
* @return {boolean} <tt>true</tt> if simulcast is enabled and active or
* Tells whether or not this TPC instance has spatial scalability enabled.
* @return {boolean} <tt>true</tt> if spatial scalability is enabled and active or
* <tt>false</tt> if it's turned off.
*/
TraceablePeerConnection.prototype.isSimulcastOn = function() {
TraceablePeerConnection.prototype.isSpatialScalabilityOn = function() {
return !this.options.disableSimulcast;
};

Expand Down Expand Up @@ -694,7 +694,7 @@ TraceablePeerConnection.prototype.getAudioLevels = function(speakerList = []) {
TraceablePeerConnection.prototype.doesTrueSimulcast = function() {
const currentCodec = this.getConfiguredVideoCodec();

return this.isSimulcastOn() && this.tpcUtils.isRunningInSimulcastMode(currentCodec);
return this.isSpatialScalabilityOn() && this.tpcUtils.isRunningInSimulcastMode(currentCodec);
};

/**
Expand All @@ -710,7 +710,7 @@ TraceablePeerConnection.prototype.getLocalVideoSSRCs = function(localTrack) {
return ssrcs;
}

const ssrcGroup = this.isSimulcastOn() ? 'SIM' : 'FID';
const ssrcGroup = this.isSpatialScalabilityOn() ? 'SIM' : 'FID';

return this.localSSRCs.get(localTrack.rtcId)?.groups?.find(group => group.semantics === ssrcGroup)?.ssrcs || ssrcs;
};
Expand Down Expand Up @@ -1960,7 +1960,7 @@ TraceablePeerConnection.prototype.isVideoCodecDisabled = function(codec) {
TraceablePeerConnection.prototype.setDesktopSharingFrameRate = function(maxFps) {
const lowFps = maxFps <= SS_DEFAULT_FRAME_RATE;

this._capScreenshareBitrate = this.isSimulcastOn() && lowFps;
this._capScreenshareBitrate = this.isSpatialScalabilityOn() && lowFps;
};

/**
Expand Down Expand Up @@ -2599,15 +2599,15 @@ TraceablePeerConnection.prototype.setRemoteDescription = function(description) {
remoteDescription = this.interop.toUnifiedPlan(remoteDescription, currentDescription);
this.trace('setRemoteDescription::postTransform (Unified)', dumpSDP(remoteDescription));
}
if (this.isSimulcastOn()) {
if (this.isSpatialScalabilityOn()) {
remoteDescription = this.tpcUtils.insertUnifiedPlanSimulcastReceive(remoteDescription);
this.trace('setRemoteDescription::postTransform (sim receive)', dumpSDP(remoteDescription));
}
remoteDescription = this.tpcUtils.ensureCorrectOrderOfSsrcs(remoteDescription);
this.trace('setRemoteDescription::postTransform (correct ssrc order)', dumpSDP(remoteDescription));
} else {
if (this.isSimulcastOn()) {
// Implode the simulcast ssrcs so that the remote sdp has only the first ssrc in the SIM group.
if (this.isSpatialScalabilityOn()) {
// Implode the 3 different ssrcs so that the remote sdp has only the first ssrc in the SIM group.
remoteDescription = this.simulcast.mungeRemoteDescription(
remoteDescription,
true /* add x-google-conference flag */);
Expand Down Expand Up @@ -2962,8 +2962,9 @@ TraceablePeerConnection.prototype._createOfferOrAnswer = function(

const localVideoTrack = this.getLocalVideoTracks()[0];

// Configure simulcast for camera tracks and for desktop tracks that need simulcast.
if (this.isSimulcastOn() && browser.usesSdpMungingForSimulcast()
// Munge local description to add 3 SSRCs for camera tracks and for desktop tracks when spatial scalability
// for video streams is enabled.
if (this.isSpatialScalabilityOn() && browser.usesSdpMungingForSimulcast()
&& (localVideoTrack?.getVideoType() === VideoType.CAMERA
|| this._usesUnifiedPlan)) {
// eslint-disable-next-line no-param-reassign
Expand Down Expand Up @@ -3166,8 +3167,8 @@ TraceablePeerConnection.prototype.generateNewStreamSSRCInfo = function(track) {
logger.error(`${this} Overwriting local SSRCs for track id=${rtcId}`);
}

// Configure simulcast for camera tracks and desktop tracks that need simulcast.
if (this.isSimulcastOn()
// Configure SIM groups for camera tracks and desktop tracks that need simulcast.
if (this.isSpatialScalabilityOn()
&& (track.getVideoType() === VideoType.CAMERA || !this.isSharingLowFpsScreen())) {
ssrcInfo = {
ssrcs: [],
Expand Down
2 changes: 1 addition & 1 deletion modules/connectivity/ConnectionQuality.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export default class ConnectionQuality {
const activeTPC = this._conference.getActivePeerConnection();

if (activeTPC) {
const isSimulcastOn = activeTPC.isSimulcastOn();
const isSimulcastOn = activeTPC.isSpatialScalabilityOn();
const videoQualitySettings = activeTPC.getTargetVideoBitrates();

// Add the codec info as well.
Expand Down
2 changes: 1 addition & 1 deletion modules/sdp/LocalSdpMunger.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default class LocalSdpMunger {

// Inject removed SSRCs
const requiredSSRCs
= this.tpc.isSimulcastOn()
= this.tpc.isSpatialScalabilityOn()
? this.tpc.simulcast.ssrcCache
: [ this.tpc.sdpConsistency.cachedPrimarySsrc ];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class TraceablePeerConnection {
onnegotiationneeded: unknown; // TODO:
ondatachannel: unknown; // TODO:
getConnectionState: () => string;
isSimulcastOn: () => boolean;
isSpatialScalabilityOn: () => boolean;
getAudioLevels: ( speakerList?: Array<unknown> ) => Map<string, number>; // TODO:
getLocalTracks: ( mediaType: MediaType ) => JitsiLocalTrack[];
getLocalVideoTrack: () => JitsiLocalTrack | undefined;
Expand Down

0 comments on commit 72e0736

Please sign in to comment.