Skip to content

Commit

Permalink
Add support for configuring video send codec (aws#2292)
Browse files Browse the repository at this point in the history
  • Loading branch information
hensmi-amazon authored Jun 29, 2022
1 parent 2e65815 commit e526e89
Show file tree
Hide file tree
Showing 66 changed files with 6,470 additions and 3,489 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Add a new API `enableSimulcastForContentShare` to enable simulcast for content share so that content share could be shown in network constrained clients. The lower quality layer has 300 kbps max bitrate, resolution scale factor of 2, and 5 max framerate.
- Add APIs `setVideoCodecSendPreferences` and `setContentShareVideoCodecPreferences` to allow configuration of codec being used to send. See the [JS SDK guide](https://aws.github.io/amazon-chime-sdk-js/modules/videocodecs.html) for more details.

### Removed

Expand Down
12 changes: 10 additions & 2 deletions demos/browser/app/meetingV2/meetingV2.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,23 @@ <h5 class="modal-title" id="additional-options-modal-label">Additional Options</
</div>
<div class="modal-body">
<fieldset>
<div class="custom-control" style="text-align: left;">
<label for="logLevel">Choose a Log Level:</label>
<div class="form-floating mb-3" style="text-align: left;">
<select name="logLevel" class="form-select" id="logLevelSelect">
<option value="INFO">INFO</option>
<option value="DEBUG">DEBUG</option>
<option value="WARN">WARN</option>
<option value="ERROR">ERROR</option>
<option value="OFF">OFF</option>
</select>
<label for="logLevel" style="text-align: left;">Log Level:</label>
</div>
<div class="form-floating mb-3">
<select name="videoCodec" class="form-select" id="videoCodecSelect">
<option value="default">Meeting Default</option>
<option value="vp8">VP8</option>
<option value="h264ConstrainedBaselineProfile">H.264 Constrained Baseline Profile</option>
</select>
<label for="videoCodec" style="text-align: left;">Preferred Video Send Codec:</label>
</div>
<div class="form-check" style="text-align: left;">
<input type="checkbox" id="webaudio" class="form-check-input">
Expand Down
22 changes: 21 additions & 1 deletion demos/browser/app/meetingV2/meetingV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import {
DefaultEventController,
MeetingSessionCredentials,
POSTLogger,
VideoCodecCapability
} from 'amazon-chime-sdk-js';

import TestSound from './audio/TestSound';
Expand Down Expand Up @@ -300,6 +301,7 @@ export class DemoMeetingApp
// feature flags
enableWebAudio = false;
logLevel = LogLevel.INFO;
videoCodecPreferences: VideoCodecCapability[] | undefined = undefined;
enableSimulcast = false;
usePriorityBasedDownlinkPolicy = false;
videoPriorityBasedPolicyConfig = VideoPriorityBasedPolicyConfig.Default;
Expand Down Expand Up @@ -641,6 +643,20 @@ export class DemoMeetingApp
break;
}

const chosenVideoSendCodec = (document.getElementById('videoCodecSelect') as HTMLSelectElement).value;
switch (chosenVideoSendCodec) {
case 'vp8':
this.videoCodecPreferences = [VideoCodecCapability.vp8()];
break;
case 'h264ConstrainedBaselineProfile':
this.videoCodecPreferences = [VideoCodecCapability.h264ConstrainedBaselineProfile(), VideoCodecCapability.vp8()];
break;
default:
// If left on 'Meeting Default', use the existing behavior when `setVideoCodecSendPreferences` is not called
// which should be equivalent to `this.videoCodecPreferences = [VideoCodecCapability.h264ConstrainedBaselineProfile()]`
break;
}

AsyncScheduler.nextTick(
async (): Promise<void> => {
let chimeMeetingId: string = '';
Expand Down Expand Up @@ -1805,6 +1821,7 @@ export class DemoMeetingApp
configuration.videoDownlinkBandwidthPolicy = this.priorityBasedDownlinkPolicy;
this.priorityBasedDownlinkPolicy.addObserver(this);
}

configuration.applicationMetadata = ApplicationMetadata.create('amazon-chime-sdk-js-demo', '2.0.0');

if ((document.getElementById('pause-last-frame') as HTMLInputElement).checked) {
Expand Down Expand Up @@ -1846,7 +1863,10 @@ export class DemoMeetingApp
this.audioVideo.addObserver(this);
this.meetingSession.eventController.addObserver(this);
this.audioVideo.addContentShareObserver(this);

if (this.videoCodecPreferences !== undefined && this.videoCodecPreferences.length > 0) {
this.audioVideo.setVideoCodecSendPreferences(this.videoCodecPreferences);
this.audioVideo.setContentShareVideoCodecPreferences(this.videoCodecPreferences);
}
this.videoTileCollection = new VideoTileCollection(this.audioVideo,
this.meetingLogger,
this.usePriorityBasedDownlinkPolicy ? new VideoPreferenceManager(this.meetingLogger, this.priorityBasedDownlinkPolicy) : undefined,
Expand Down
Loading

0 comments on commit e526e89

Please sign in to comment.