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
3 changes: 2 additions & 1 deletion demos/browser/app/meetingV2/meetingV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,8 @@ export class DemoMeetingApp
this.videoTileCollection = new VideoTileCollection(this.audioVideo,
this.meetingLogger,
new RemoteVideoManager(this.meetingLogger, this.usePriorityBasedDownlinkPolicy ? this.priorityBasedDownlinkPolicy : this.allHighestDownlinkPolicy),
paginationPageSize)
paginationPageSize,
this.meetingSession.configuration.credentials.attendeeId)
this.audioVideo.addObserver(this.videoTileCollection);

this.contentShare = new ContentShareManager(this.meetingLogger, this.audioVideo, this.usingStereoMusicAudioProfile);
Expand Down
14 changes: 8 additions & 6 deletions demos/browser/app/meetingV2/video/PaginationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default class PaginationManager<Type> {
private currentPageStart: number = 0;

private all = new Array<Type>();

constructor(private pageSize: number) {}

currentPage(): Array<Type> {
Expand All @@ -21,7 +21,7 @@ export default class PaginationManager<Type> {

remove(toRemove: Type) {
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));
this.all.splice(this.all.indexOf(toRemove), 1);
}
}

Expand All @@ -30,15 +30,15 @@ export default class PaginationManager<Type> {
if (index === -1) {
return;
}
this.all.splice(index,1);
this.all.splice(index, 1);
}

hasNextPage(): boolean {
return this.currentPageStart + this.pageSize < this.all.length;
}

nextPage(): void {
if (!this.hasNextPage) {
if (!this.hasNextPage()) {
return;
}
this.currentPageStart += this.pageSize;
Expand All @@ -49,6 +49,8 @@ export default class PaginationManager<Type> {
}

previousPage(): void {
this.currentPageStart -= this.pageSize;
if (this.hasPreviousPage()) {
this.currentPageStart -= this.pageSize;
}
}
}
}
24 changes: 13 additions & 11 deletions demos/browser/app/meetingV2/video/VideoTileCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ export default class VideoTileCollection implements AudioVideoObserver {
constructor(private videoTileController: VideoTileControllerFacade,
private logger: Logger,
private remoteVideoManager: RemoteVideoManager,
private pageSize: number) {
private pageSize: number,
private localAttendeeId: string) {
this.setupVideoTiles();

if (!this.remoteVideoManager.supportsRemoteVideoPreferences()) {
Expand Down Expand Up @@ -162,7 +163,7 @@ export default class VideoTileCollection implements AudioVideoObserver {
}

videoTileDidUpdate(tileState: VideoTileState): void {
console.log(`video tile updated: ${JSON.stringify(tileState, null, ' ')}`);
this.logger.info(`video tile updated: ${JSON.stringify(tileState, null, ' ')}`);
if (!tileState.boundAttendeeId) {
return;
}
Expand Down Expand Up @@ -209,22 +210,20 @@ export default class VideoTileCollection implements AudioVideoObserver {
}
demoVideoTile.attendeeId = tileState.boundAttendeeId;

// We need to add local video or content to pagination from tile updates
const shouldUpdatePagination = tileState.localTile || (tileState.isContent && tileState.boundAttendeeId.startsWith(this.localAttendeeId));
if (tileState.boundVideoStream) {
demoVideoTile.show(tileState.isContent);

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

if (tileState.localTile) {
if (shouldUpdatePagination) {
this.pagination.remove(tileState.boundAttendeeId);
this.updatePaginatedVisibleTiles();
}
}
this.updatePaginatedVisibleTiles();
this.updateLayout();
this.layoutFeaturedTile();
}
Expand Down Expand Up @@ -374,6 +373,9 @@ export default class VideoTileCollection implements AudioVideoObserver {
for (const tile of this.videoTileController.getAllVideoTiles()) {
const state = tile.state();
if (state.isContent) {
if (state.boundAttendeeId.startsWith(this.localAttendeeId) && !this.pagination.currentPage().includes(state.boundAttendeeId)) {
return null;
}
return state.tileId;
}
}
Expand Down Expand Up @@ -452,10 +454,10 @@ export default class VideoTileCollection implements AudioVideoObserver {
// We need to manually control visibility of paused tiles anyways so we just do
// everything here, even though the preference manager adding/removing will
// result in tile callbacks as well.
for (let [index, videoTile] of this.tileIndexToDemoVideoTile.entries()) {
for (let videoTile of this.tileIndexToDemoVideoTile.values()) {
if (attendeesToShow.includes(videoTile.attendeeId)) {
videoTile.show(false);
} else if (this.tileIndexToTileId[index] !== this.findContentTileId()) { // Always show content
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This breaks because of the local content that automatically makes a tile. It doesn't really need to make UX decisions like this (not like UX eng ever assisted with demo) so simpler is better IMO

} else {
videoTile.hide();
}
}
Expand Down
Loading