Update to RingRTC v2.5.1

Co-authored-by: Vladimir Skuratovich <vlad@signal.org>
This commit is contained in:
Jim Gustafson 2020-08-27 12:21:10 -07:00 committed by Josh Perez
parent e9cf5ba67c
commit 90bf0f4eea
5 changed files with 32 additions and 35 deletions

View file

@ -128,7 +128,7 @@
"redux-ts-utils": "3.2.2", "redux-ts-utils": "3.2.2",
"reselect": "4.0.0", "reselect": "4.0.0",
"rimraf": "2.6.2", "rimraf": "2.6.2",
"ringrtc": "https://github.com/signalapp/signal-ringrtc-node.git#0cd60f529d8f17734fe19e7195c9fd3c3f4271db", "ringrtc": "https://github.com/signalapp/signal-ringrtc-node.git#9e295f8d6f4652cc77538f3e2e88f6348344d367",
"sanitize-filename": "1.6.3", "sanitize-filename": "1.6.3",
"sanitize.css": "11.0.0", "sanitize.css": "11.0.0",
"semver": "5.4.1", "semver": "5.4.1",

View file

@ -14,7 +14,8 @@ const i18n = setupI18n('en', enMessages);
const audioDevice = { const audioDevice = {
name: '', name: '',
index: 0, index: 0,
same_name_index: 0, uniqueId: '',
i18nKey: undefined,
}; };
const createProps = ({ const createProps = ({
@ -45,19 +46,20 @@ stories.add('Default', () => {
stories.add('Some Devices', () => { stories.add('Some Devices', () => {
const availableSpeakers = [ const availableSpeakers = [
{ {
name: 'Default - Internal Microphone', name: 'Default',
index: 0, index: 0,
same_name_index: 0, uniqueId: 'Default',
i18nKey: 'default_communication_device',
}, },
{ {
name: "Natalie's Airpods (Bluetooth)", name: "Natalie's Airpods (Bluetooth)",
index: 1, index: 1,
same_name_index: 1, uniqueId: 'aa',
}, },
{ {
name: 'UE Boom (Bluetooth)', name: 'UE Boom (Bluetooth)',
index: 2, index: 2,
same_name_index: 2, uniqueId: 'bb',
}, },
]; ];
const selectedSpeaker = availableSpeakers[0]; const selectedSpeaker = availableSpeakers[0];
@ -73,33 +75,35 @@ stories.add('Some Devices', () => {
stories.add('All Devices', () => { stories.add('All Devices', () => {
const availableSpeakers = [ const availableSpeakers = [
{ {
name: 'Default - Internal Speakers', name: 'Default',
index: 0, index: 0,
same_name_index: 0, uniqueId: 'Default',
i18nKey: 'default_communication_device',
}, },
{ {
name: "Natalie's Airpods (Bluetooth)", name: "Natalie's Airpods (Bluetooth)",
index: 1, index: 1,
same_name_index: 1, uniqueId: 'aa',
}, },
{ {
name: 'UE Boom (Bluetooth)', name: 'UE Boom (Bluetooth)',
index: 2, index: 2,
same_name_index: 2, uniqueId: 'bb',
}, },
]; ];
const selectedSpeaker = availableSpeakers[0]; const selectedSpeaker = availableSpeakers[0];
const availableMicrophones = [ const availableMicrophones = [
{ {
name: 'Default - Internal Microphone', name: 'Default',
index: 0, index: 0,
same_name_index: 0, uniqueId: 'Default',
i18nKey: 'default_communication_device',
}, },
{ {
name: "Natalie's Airpods (Bluetooth)", name: "Natalie's Airpods (Bluetooth)",
index: 1, index: 1,
same_name_index: 1, uniqueId: 'aa',
}, },
]; ];
const selectedMicrophone = availableMicrophones[0]; const selectedMicrophone = availableMicrophones[0];

View file

@ -207,10 +207,8 @@ export class CallingClass {
for (let i = 0; i < a.availableMicrophones.length; i++) { for (let i = 0; i < a.availableMicrophones.length; i++) {
if ( if (
a.availableMicrophones[i].name !== b.availableMicrophones[i].name || a.availableMicrophones[i].name !== b.availableMicrophones[i].name ||
a.availableMicrophones[i].unique_id !== a.availableMicrophones[i].uniqueId !==
b.availableMicrophones[i].unique_id || b.availableMicrophones[i].uniqueId
a.availableMicrophones[i].same_name_index !==
b.availableMicrophones[i].same_name_index
) { ) {
return false; return false;
} }
@ -218,9 +216,7 @@ export class CallingClass {
for (let i = 0; i < a.availableSpeakers.length; i++) { for (let i = 0; i < a.availableSpeakers.length; i++) {
if ( if (
a.availableSpeakers[i].name !== b.availableSpeakers[i].name || a.availableSpeakers[i].name !== b.availableSpeakers[i].name ||
a.availableSpeakers[i].unique_id !== b.availableSpeakers[i].unique_id || a.availableSpeakers[i].uniqueId !== b.availableSpeakers[i].uniqueId
a.availableSpeakers[i].same_name_index !==
b.availableSpeakers[i].same_name_index
) { ) {
return false; return false;
} }
@ -327,21 +323,18 @@ export class CallingClass {
// No preference stored // No preference stored
return undefined; return undefined;
} }
// Match by UUID first, if available // Match by uniqueId first, if available
if (preferred.unique_id) { if (preferred.uniqueId) {
const matchIndex = available.findIndex( const matchIndex = available.findIndex(
d => d.unique_id === preferred.unique_id d => d.uniqueId === preferred.uniqueId
); );
if (matchIndex !== -1) { if (matchIndex !== -1) {
return matchIndex; return matchIndex;
} }
} }
// Match by name second, and if there are multiple such names - by instance index. // Match by name second
const matchingNames = available.filter(d => d.name === preferred.name); const matchingNames = available.filter(d => d.name === preferred.name);
if (matchingNames.length > preferred.same_name_index) {
return matchingNames[preferred.same_name_index].index;
}
if (matchingNames.length > 0) { if (matchingNames.length > 0) {
return matchingNames[0].index; return matchingNames[0].index;
} }

View file

@ -1,13 +1,13 @@
// Must be kept in sync with RingRTC.AudioDevice // Must be kept in sync with RingRTC.AudioDevice
export interface AudioDevice { export interface AudioDevice {
// Name, present on every platform. // Device name.
name: string; name: string;
// Index of this device, starting from 0. // Index of this device, starting from 0.
index: number; index: number;
// Index of this device out of all devices sharing the same name. // A unique and somewhat stable identifier of this device.
same_name_index: number; uniqueId: string;
// If present, a unique and stable identifier of this device. Only available on WIndows. // If present, the identifier of a localized string to substitute for the device name.
unique_id?: string; i18nKey?: string;
} }
// This must be kept in sync with RingRTC.CallState. // This must be kept in sync with RingRTC.CallState.

View file

@ -13568,9 +13568,9 @@ rimraf@~2.4.0:
dependencies: dependencies:
glob "^6.0.1" glob "^6.0.1"
"ringrtc@https://github.com/signalapp/signal-ringrtc-node.git#0cd60f529d8f17734fe19e7195c9fd3c3f4271db": "ringrtc@https://github.com/signalapp/signal-ringrtc-node.git#9e295f8d6f4652cc77538f3e2e88f6348344d367":
version "2.5.0" version "2.5.1"
resolved "https://github.com/signalapp/signal-ringrtc-node.git#0cd60f529d8f17734fe19e7195c9fd3c3f4271db" resolved "https://github.com/signalapp/signal-ringrtc-node.git#9e295f8d6f4652cc77538f3e2e88f6348344d367"
ripemd160@^2.0.0, ripemd160@^2.0.1: ripemd160@^2.0.0, ripemd160@^2.0.1:
version "2.0.1" version "2.0.1"