Skip to content

Commit

Permalink
Merge branch 'main' into feature/msg-sess-reconnect-main
Browse files Browse the repository at this point in the history
  • Loading branch information
dpwspoon authored Apr 25, 2022
2 parents d9d28f4 + f6c16ee commit f112381
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 30 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- `MessagingSession` reconnects with refreshed endpoint and credentials if needed. EndpointUrl on `MessagingSessionConfiguration` is deprecated as it is resolved by calling `getMessagingSessionEndpoint` internally.
- Fix a bug that `remote-inbound-rtp` `RTCStatsReport` and `remote-outbound-rtp` `RTCStatsReport` of "video" `kind` are accidentally filtered.

## [3.0.0] - 2022-03-30

Expand Down
43 changes: 22 additions & 21 deletions demos/browser/app/meetingV2/meetingV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export class DemoMeetingApp
audioVideo: AudioVideoFacade | null = null;
deviceController: DefaultDeviceController | undefined = undefined;
canStartLocalVideo: boolean = true;
defaultBrowserBehaviour: DefaultBrowserBehavior = new DefaultBrowserBehavior();
defaultBrowserBehavior: DefaultBrowserBehavior = new DefaultBrowserBehavior();
videoTileCollection: VideoTileCollection | undefined = undefined;
videoPreferenceManager: VideoPreferenceManager | undefined = undefined;

Expand Down Expand Up @@ -319,11 +319,11 @@ export class DemoMeetingApp
markdown = require('markdown-it')({ linkify: true });
lastMessageSender: string | null = null;
lastReceivedMessageTimestamp = 0;
lastReceivedPackets = 0;
lastPacketsSent = 0;
meetingSessionPOSTLogger: POSTLogger;
meetingEventPOSTLogger: POSTLogger;

hasChromiumWebRTC: boolean = this.defaultBrowserBehaviour.hasChromiumWebRTC();
hasChromiumWebRTC: boolean = this.defaultBrowserBehavior.hasChromiumWebRTC();

voiceFocusTransformer: VoiceFocusDeviceTransformer | undefined;
voiceFocusDevice: VoiceFocusTransformDevice | undefined;
Expand Down Expand Up @@ -542,11 +542,11 @@ export class DemoMeetingApp
}

initEventListeners(): void {
if (!this.defaultBrowserBehaviour.hasChromiumWebRTC()) {
if (!this.defaultBrowserBehavior.hasChromiumWebRTC()) {
(document.getElementById('simulcast') as HTMLInputElement).disabled = true;
}

if (!this.defaultBrowserBehaviour.supportDownlinkBandwidthEstimation()) {
if (!this.defaultBrowserBehavior.supportDownlinkBandwidthEstimation()) {
(document.getElementById('priority-downlink-policy') as HTMLInputElement).disabled = true;
}

Expand Down Expand Up @@ -1388,15 +1388,17 @@ export class DemoMeetingApp
});
}

logPPS(clientMetricReport: ClientMetricReport) {
logAudioStreamPPS(clientMetricReport: ClientMetricReport) {
const { currentTimestampMs, previousTimestampMs } = clientMetricReport;
const deltaTime = currentTimestampMs - previousTimestampMs;
const rtcStatsReport = clientMetricReport.getRTCStatsReport();

rtcStatsReport.forEach(report => {
if (report.type === 'outbound-rtp') {
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
// Skip initial metric.
if (report.packetsSent === 0 && previousTimestampMs === 0) return;
const deltaTime = currentTimestampMs - previousTimestampMs;
const deltaPackets = report.packetsSent - this.lastReceivedPackets;

const deltaPackets = report.packetsSent - this.lastPacketsSent;
const pps = (1000 * deltaPackets) / deltaTime;

let overage = 0;
Expand All @@ -1406,8 +1408,7 @@ export class DemoMeetingApp
overage = 0;
console.debug('PPS:', pps);
}
this.lastReceivedPackets = report.packetsSent;
return;
this.lastPacketsSent = report.packetsSent;
}
});
}
Expand Down Expand Up @@ -1647,7 +1648,7 @@ export class DemoMeetingApp
}

metricsDidReceive(clientMetricReport: ClientMetricReport): void {
this.logPPS(clientMetricReport);
this.logAudioStreamPPS(clientMetricReport);
const metricReport = clientMetricReport.getObservableMetrics();
this.videoMetricReport = clientMetricReport.getObservableVideoMetrics();
this.displayEstimatedUplinkBandwidth(metricReport.availableOutgoingBitrate);
Expand Down Expand Up @@ -1975,7 +1976,7 @@ export class DemoMeetingApp
);
const isSelfAttendee =
new DefaultModality(attendeeId).base() === this.meetingSession.configuration.credentials.attendeeId
|| new DefaultModality(attendeeId).base() === this.primaryMeetingSessionCredentials?.attendeeId
|| new DefaultModality(attendeeId).base() === this.primaryMeetingSessionCredentials?.attendeeId
if (!present) {
delete this.roster[attendeeId];
this.updateRoster();
Expand Down Expand Up @@ -2418,7 +2419,7 @@ export class DemoMeetingApp
// Also note that Firefox has its own device picker, which may be useful
// for the first device selection. Subsequent device selections could use
// a custom UX with a specific device id.
if (!this.defaultBrowserBehaviour.doesNotSupportMediaDeviceLabels()) {
if (!this.defaultBrowserBehavior.doesNotSupportMediaDeviceLabels()) {
this.audioVideo.setDeviceLabelTrigger(
async (): Promise<MediaStream> => {
if (this.isRecorder() || this.isBroadcaster() || this.isViewOnly) {
Expand Down Expand Up @@ -2697,7 +2698,7 @@ export class DemoMeetingApp
}

private areVideoFiltersSupported(): boolean {
return this.defaultBrowserBehaviour.supportsCanvasCapturedStreamPlayback();
return this.defaultBrowserBehavior.supportsCanvasCapturedStreamPlayback();
}

private isVoiceFocusActive(): boolean {
Expand Down Expand Up @@ -2807,7 +2808,7 @@ export class DemoMeetingApp
}

async populateAudioOutputList(): Promise<void> {
const supportsChoosing = this.defaultBrowserBehaviour.supportsSetSinkId();
const supportsChoosing = this.defaultBrowserBehavior.supportsSetSinkId();
const genericName = 'Speaker';
const additionalDevices: string[] = [];
const devices = supportsChoosing ? await this.audioVideo.listAudioOutputDevices() : [];
Expand Down Expand Up @@ -2835,7 +2836,7 @@ export class DemoMeetingApp
private async chooseAudioOutput(device: string): Promise<void> {
// Set it for the content share stream if we can.
const videoElem = document.getElementById('content-share-video') as HTMLVideoElement;
if (this.defaultBrowserBehaviour.supportsSetSinkId()) {
if (this.defaultBrowserBehavior.supportsSetSinkId()) {
// @ts-ignore
videoElem.setSinkId(device);
}
Expand Down Expand Up @@ -2954,7 +2955,7 @@ export class DemoMeetingApp
}

async openAudioOutputFromSelection(): Promise<void> {
if (this.defaultBrowserBehaviour.supportsSetSinkId()) {
if (this.defaultBrowserBehavior.supportsSetSinkId()) {
try {
const audioOutput = document.getElementById('audio-output') as HTMLSelectElement;
await this.chooseAudioOutput(audioOutput.value);
Expand Down Expand Up @@ -3349,7 +3350,7 @@ export class DemoMeetingApp
private async playToStream(videoFile: HTMLVideoElement): Promise<MediaStream> {
await videoFile.play();

if (this.defaultBrowserBehaviour.hasFirefoxWebRTC()) {
if (this.defaultBrowserBehavior.hasFirefoxWebRTC()) {
// @ts-ignore
return videoFile.mozCaptureStream();
}
Expand Down Expand Up @@ -3611,7 +3612,7 @@ export class DemoMeetingApp
}

private enableLocalVideoButton(enabled: boolean, warningMessage: string = ''): void {
this.toggleButton('button-camera', enabled? 'off' : 'disabled');
this.toggleButton('button-camera', enabled ? 'off' : 'disabled');

if (warningMessage) {
const toastContainer = document.getElementById('toast-container');
Expand Down Expand Up @@ -3644,7 +3645,7 @@ export class DemoMeetingApp

videoSendDidBecomeUnavailable(): void {
this.log('sending video is not available');
this.enableLocalVideoButton(false,'Cannot enable local video due to call being at capacity');
this.enableLocalVideoButton(false, 'Cannot enable local video due to call being at capacity');
}

contentShareDidStart(): void {
Expand Down
8 changes: 4 additions & 4 deletions docs/classes/statscollector.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ <h3>filter<wbr>Raw<wbr>Metric<wbr>Reports</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/statscollector/StatsCollector.ts#L448">src/statscollector/StatsCollector.ts:448</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/statscollector/StatsCollector.ts#L447">src/statscollector/StatsCollector.ts:447</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -186,7 +186,7 @@ <h3>is<wbr>Valid<wbr>Raw<wbr>Metric<wbr>Report</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/statscollector/StatsCollector.ts#L441">src/statscollector/StatsCollector.ts:441</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/statscollector/StatsCollector.ts#L440">src/statscollector/StatsCollector.ts:440</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -214,7 +214,7 @@ <h3>is<wbr>Valid<wbr>Ssrc</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/statscollector/StatsCollector.ts#L426">src/statscollector/StatsCollector.ts:426</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/statscollector/StatsCollector.ts#L425">src/statscollector/StatsCollector.ts:425</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -242,7 +242,7 @@ <h3>is<wbr>Valid<wbr>Standard<wbr>Raw<wbr>Metric</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/statscollector/StatsCollector.ts#L413">src/statscollector/StatsCollector.ts:413</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/statscollector/StatsCollector.ts#L412">src/statscollector/StatsCollector.ts:412</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down
9 changes: 4 additions & 5 deletions src/statscollector/StatsCollector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,10 @@ export default class StatsCollector {
* Returns the Direction for a RawMetricReport.
*/
private getDirectionType(rawMetricReport: RawMetricReport): Direction {
return rawMetricReport.id.toLowerCase().indexOf('send') !== -1 ||
rawMetricReport.id.toLowerCase().indexOf('outbound') !== -1 ||
rawMetricReport.type === 'outbound-rtp'
? Direction.UPSTREAM
: Direction.DOWNSTREAM;
const { type } = rawMetricReport;
return type === 'inbound-rtp' || type === 'remote-outbound-rtp'
? Direction.DOWNSTREAM
: Direction.UPSTREAM;
}

/**
Expand Down

0 comments on commit f112381

Please sign in to comment.