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

Make server side network adaptation the default when creating VideoPriorityBasedPolicy #2889

Merged
merged 4 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Avoid subscribes when simulcast is enabled but not currently sending, or when using server side network adaptation.
- Made server side network adaptation the default when creating `VideoPriorityBasedPolicy`.

### Fixed

Expand Down
16 changes: 4 additions & 12 deletions demos/browser/app/meetingV2/meetingV2.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ <h5 class="modal-title" id="additional-options-modal-label">Additional Options</
<input type="checkbox" id="svc" class="form-check-input">
<label for="svc" class="form-check-label">Enable SVC for Chrome</label>
</div>
<div class="form-check" style="text-align: left;">
<input type="checkbox" id="priority-downlink-policy" class="form-check-input">
<label for="priority-downlink-policy" class="form-check-label">Enable remote video quality adaptation</label>
</div>
<label id="pagination-title" for="pagination-page-size" style="padding-top:5px">Paginate displayed video tiles</label>
<select id="pagination-page-size" class="form-select" style="width:100%;">
<option value="1">1</option>
Expand All @@ -220,18 +224,6 @@ <h5 class="modal-title" id="additional-options-modal-label">Additional Options</
<option value="16">16</option>
<option value="25" selected>25</option>
</select>
<div class="form-check" style="text-align: left;">
<input type="checkbox" id="priority-downlink-policy" class="form-check-input">
<label for="priority-downlink-policy" class="form-check-label">Use Priority-Based Downlink
Policy</label>
</div>
<label id="server-side-network-adaption-title" for="server-side-network-adaption" style="display: none; padding-top:5px">Server Side Network Adaption</label>
<select id="server-side-network-adaption" class="form-select" style="width:100%; display: none;">
<option value="default">Default</option>
<option value="none">None (Deprecated)</option>
<option value="enable-bandwidth-probing">Enable Bandwidth Probing (Deprecated)</option>
<option value="enable-bandwidth-probing-and-video-adaption" selected>Enable Bandwidth Probing and Video Quality Adaption</option>
</select>
<div class="form-check" style="text-align: left;">
<input type="checkbox" checked id="preconnect" class="form-check-input">
<label for="preconnect" class="form-check-label">Open signaling connection early</label>
Expand Down
35 changes: 1 addition & 34 deletions demos/browser/app/meetingV2/meetingV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import {
NoOpVideoFrameProcessor,
VideoFxConfig,
RemovableAnalyserNode,
ServerSideNetworkAdaption,
SimulcastLayers,
Transcript,
TranscriptEvent,
Expand All @@ -63,7 +62,6 @@ import {
VideoFrameProcessor,
VideoInputDevice,
VideoPriorityBasedPolicy,
VideoPriorityBasedPolicyConfig,
VideoQualitySettings,
VoiceFocusDeviceTransformer,
VoiceFocusModelComplexity,
Expand Down Expand Up @@ -347,7 +345,6 @@ export class DemoMeetingApp
enableSimulcast = false;
enableSVC = false;
usePriorityBasedDownlinkPolicy = false;
videoPriorityBasedPolicyConfig = new VideoPriorityBasedPolicyConfig;
enablePin = false;
echoReductionCapability = false;
usingStereoMusicAudioProfile = false;
Expand Down Expand Up @@ -664,21 +661,6 @@ export class DemoMeetingApp

document.getElementById('priority-downlink-policy').addEventListener('change', e => {
this.usePriorityBasedDownlinkPolicy = (document.getElementById('priority-downlink-policy') as HTMLInputElement).checked;

const serverSideNetworkAdaption = document.getElementById(
'server-side-network-adaption'
) as HTMLSelectElement;
const serverSideNetworkAdaptionTitle = document.getElementById(
'server-side-network-adaption-title'
) as HTMLElement;

if (this.usePriorityBasedDownlinkPolicy) {
serverSideNetworkAdaption.style.display = 'block';
serverSideNetworkAdaptionTitle.style.display = 'block';
} else {
serverSideNetworkAdaption.style.display = 'none';
serverSideNetworkAdaptionTitle.style.display = 'none';
}
});

const echoReductionCheckbox = (document.getElementById('echo-reduction-checkbox') as HTMLInputElement);
Expand Down Expand Up @@ -1859,22 +1841,7 @@ export class DemoMeetingApp
configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers = this.enableSimulcast;
configuration.enableSVC = this.enableSVC;
if (this.usePriorityBasedDownlinkPolicy) {
const serverSideNetworkAdaptionDropDown = document.getElementById('server-side-network-adaption') as HTMLSelectElement;
switch (serverSideNetworkAdaptionDropDown.value) {
case 'default':
this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption = ServerSideNetworkAdaption.Default;
break;
case 'none':
this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption = ServerSideNetworkAdaption.None;
break;
case 'enable-bandwidth-probing':
this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption = ServerSideNetworkAdaption.BandwidthProbing;
break;
case 'enable-bandwidth-probing-and-video-adaption':
this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption = ServerSideNetworkAdaption.BandwidthProbingAndRemoteVideoQualityAdaption;
break;
}
this.priorityBasedDownlinkPolicy = new VideoPriorityBasedPolicy(this.meetingLogger, this.videoPriorityBasedPolicyConfig);
this.priorityBasedDownlinkPolicy = new VideoPriorityBasedPolicy(this.meetingLogger);
configuration.videoDownlinkBandwidthPolicy = this.priorityBasedDownlinkPolicy;
this.priorityBasedDownlinkPolicy.addObserver(this);
} else {
Expand Down
4 changes: 3 additions & 1 deletion demos/browser/app/meetingV2/video/PaginationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export default class PaginationManager<Type> {
}

remove(toRemove: Type) {
this.all.splice(this.all.indexOf(toRemove));
if (this.all.includes(toRemove)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some unrelated pagination fixes here

this.all.splice(this.all.indexOf(toRemove));
}
}

removeIf(toRemoveFn: (value: Type) => boolean) {
Expand Down
16 changes: 13 additions & 3 deletions demos/browser/app/meetingV2/video/VideoTileCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ export default class VideoTileCollection implements AudioVideoObserver {
for (const source of videoSources) {
this.pagination.add(source.attendee.attendeeId);
}
const localTileId = this.localTileId()
this.pagination.removeIf((value: string) => {
return !videoSources.some((source: VideoSource) => source.attendee.attendeeId === value)
return !videoSources.some((source: VideoSource) => source.attendee.attendeeId === value) && (localTileId && this.tileIdToAttendeeId[localTileId] !== value);
});

// Update the preference manager explicitly as it needs to add default preferences
Expand Down Expand Up @@ -210,9 +211,19 @@ export default class VideoTileCollection implements AudioVideoObserver {

if (tileState.boundVideoStream) {
demoVideoTile.show(tileState.isContent);

if (tileState.localTile) {
this.pagination.add(tileState.boundAttendeeId);
this.updatePaginatedVisibleTiles();
}
} else {
// Hide non-active tiles that aren't just paused
demoVideoTile.hide();

if (tileState.localTile) {
this.pagination.remove(tileState.boundAttendeeId);
this.updatePaginatedVisibleTiles();
}
}
this.updateLayout();
this.layoutFeaturedTile();
Expand Down Expand Up @@ -444,8 +455,7 @@ export default class VideoTileCollection implements AudioVideoObserver {
for (let [index, videoTile] of this.tileIndexToDemoVideoTile.entries()) {
if (attendeesToShow.includes(videoTile.attendeeId)) {
videoTile.show(false);
} else if (index !== VideoTileCollection.LocalVideoTileIndex
&& this.tileIndexToTileId[index] !== this.findContentTileId()) { // Always show local tile and content
} else if (this.tileIndexToTileId[index] !== this.findContentTileId()) { // Always show content
videoTile.hide();
}
}
Expand Down
Loading
Loading