Import `AudioDevice` and `VideoFrameSource` directly from RingRTC

This commit is contained in:
Evan Hahn 2021-09-28 11:37:03 -05:00 committed by GitHub
parent ed222fee9a
commit e32503eed4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 21 additions and 42 deletions

View File

@ -3,6 +3,7 @@
import React, { useCallback, useEffect } from 'react'; import React, { useCallback, useEffect } from 'react';
import { noop } from 'lodash'; import { noop } from 'lodash';
import type { VideoFrameSource } from 'ringrtc';
import { CallNeedPermissionScreen } from './CallNeedPermissionScreen'; import { CallNeedPermissionScreen } from './CallNeedPermissionScreen';
import { CallScreen } from './CallScreen'; import { CallScreen } from './CallScreen';
import { CallingLobby } from './CallingLobby'; import { CallingLobby } from './CallingLobby';
@ -23,7 +24,6 @@ import {
GroupCallJoinState, GroupCallJoinState,
GroupCallVideoRequest, GroupCallVideoRequest,
PresentedSource, PresentedSource,
VideoFrameSource,
} from '../types/Calling'; } from '../types/Calling';
import { ConversationType } from '../state/ducks/conversations'; import { ConversationType } from '../state/ducks/conversations';
import { import {

View File

@ -10,6 +10,7 @@ import React, {
} from 'react'; } from 'react';
import { noop } from 'lodash'; import { noop } from 'lodash';
import classNames from 'classnames'; import classNames from 'classnames';
import type { VideoFrameSource } from 'ringrtc';
import { import {
HangUpType, HangUpType,
SetLocalAudioType, SetLocalAudioType,
@ -30,7 +31,6 @@ import {
GroupCallJoinState, GroupCallJoinState,
GroupCallVideoRequest, GroupCallVideoRequest,
PresentedSource, PresentedSource,
VideoFrameSource,
} from '../types/Calling'; } from '../types/Calling';
import { AvatarColors, AvatarColorType } from '../types/Colors'; import { AvatarColors, AvatarColorType } from '../types/Colors';
import type { ConversationType } from '../state/ducks/conversations'; import type { ConversationType } from '../state/ducks/conversations';

View File

@ -1,12 +1,12 @@
// Copyright 2020 Signal Messenger, LLC // Copyright 2020-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import * as React from 'react'; import * as React from 'react';
import type { AudioDevice } from 'ringrtc';
import { Modal } from './Modal'; import { Modal } from './Modal';
import { LocalizerType } from '../types/Util'; import { LocalizerType } from '../types/Util';
import { import {
AudioDevice,
CallingDeviceType, CallingDeviceType,
ChangeIODevicePayloadType, ChangeIODevicePayloadType,
MediaDeviceSettings, MediaDeviceSettings,

View File

@ -3,13 +3,10 @@
import React from 'react'; import React from 'react';
import { minBy, debounce, noop } from 'lodash'; import { minBy, debounce, noop } from 'lodash';
import type { VideoFrameSource } from 'ringrtc';
import { CallingPipRemoteVideo } from './CallingPipRemoteVideo'; import { CallingPipRemoteVideo } from './CallingPipRemoteVideo';
import { LocalizerType } from '../types/Util'; import { LocalizerType } from '../types/Util';
import { import type { ActiveCallType, GroupCallVideoRequest } from '../types/Calling';
ActiveCallType,
GroupCallVideoRequest,
VideoFrameSource,
} from '../types/Calling';
import { import {
HangUpType, HangUpType,
SetLocalPreviewType, SetLocalPreviewType,

View File

@ -3,6 +3,7 @@
import React, { useMemo, useEffect } from 'react'; import React, { useMemo, useEffect } from 'react';
import { maxBy } from 'lodash'; import { maxBy } from 'lodash';
import type { VideoFrameSource } from 'ringrtc';
import { Avatar } from './Avatar'; import { Avatar } from './Avatar';
import { CallBackgroundBlur } from './CallBackgroundBlur'; import { CallBackgroundBlur } from './CallBackgroundBlur';
import { DirectCallRemoteParticipant } from './DirectCallRemoteParticipant'; import { DirectCallRemoteParticipant } from './DirectCallRemoteParticipant';
@ -13,7 +14,6 @@ import {
CallMode, CallMode,
GroupCallRemoteParticipantType, GroupCallRemoteParticipantType,
GroupCallVideoRequest, GroupCallVideoRequest,
VideoFrameSource,
} from '../types/Calling'; } from '../types/Calling';
import { AvatarColors } from '../types/Colors'; import { AvatarColors } from '../types/Colors';
import { SetRendererCanvasType } from '../state/ducks/calling'; import { SetRendererCanvasType } from '../state/ducks/calling';

View File

@ -3,11 +3,9 @@
import React, { useRef, useState, useEffect, FC, ReactElement } from 'react'; import React, { useRef, useState, useEffect, FC, ReactElement } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import type { VideoFrameSource } from 'ringrtc';
import { LocalizerType } from '../types/Util'; import { LocalizerType } from '../types/Util';
import { import type { GroupCallRemoteParticipantType } from '../types/Calling';
GroupCallRemoteParticipantType,
VideoFrameSource,
} from '../types/Calling';
import { GroupCallRemoteParticipant } from './GroupCallRemoteParticipant'; import { GroupCallRemoteParticipant } from './GroupCallRemoteParticipant';
const OVERFLOW_SCROLLED_TO_EDGE_THRESHOLD = 20; const OVERFLOW_SCROLLED_TO_EDGE_THRESHOLD = 20;

View File

@ -11,10 +11,8 @@ import React, {
} from 'react'; } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { noop } from 'lodash'; import { noop } from 'lodash';
import { import type { VideoFrameSource } from 'ringrtc';
GroupCallRemoteParticipantType, import type { GroupCallRemoteParticipantType } from '../types/Calling';
VideoFrameSource,
} from '../types/Calling';
import { LocalizerType } from '../types/Util'; import { LocalizerType } from '../types/Util';
import { AvatarColors } from '../types/Colors'; import { AvatarColors } from '../types/Colors';
import { CallBackgroundBlur } from './CallBackgroundBlur'; import { CallBackgroundBlur } from './CallBackgroundBlur';

View File

@ -4,6 +4,7 @@
import React, { useState, useMemo, useEffect } from 'react'; import React, { useState, useMemo, useEffect } from 'react';
import Measure from 'react-measure'; import Measure from 'react-measure';
import { takeWhile, chunk, maxBy, flatten } from 'lodash'; import { takeWhile, chunk, maxBy, flatten } from 'lodash';
import type { VideoFrameSource } from 'ringrtc';
import { GroupCallRemoteParticipant } from './GroupCallRemoteParticipant'; import { GroupCallRemoteParticipant } from './GroupCallRemoteParticipant';
import { import {
GroupCallOverflowArea, GroupCallOverflowArea,
@ -12,7 +13,6 @@ import {
import { import {
GroupCallRemoteParticipantType, GroupCallRemoteParticipantType,
GroupCallVideoRequest, GroupCallVideoRequest,
VideoFrameSource,
} from '../types/Calling'; } from '../types/Calling';
import { useGetCallingFrameBuffer } from '../calling/useGetCallingFrameBuffer'; import { useGetCallingFrameBuffer } from '../calling/useGetCallingFrameBuffer';
import { LocalizerType } from '../types/Util'; import { LocalizerType } from '../types/Util';

View File

@ -4,8 +4,9 @@
import React, { ReactNode, useEffect, useState, useCallback } from 'react'; import React, { ReactNode, useEffect, useState, useCallback } from 'react';
import { noop } from 'lodash'; import { noop } from 'lodash';
import classNames from 'classnames'; import classNames from 'classnames';
import type { AudioDevice } from 'ringrtc';
import { AudioDevice, MediaDeviceSettings } from '../types/Calling'; import type { MediaDeviceSettings } from '../types/Calling';
import { import {
ZoomFactorType, ZoomFactorType,
ThemeSettingType, ThemeSettingType,

View File

@ -5,6 +5,7 @@
import { desktopCapturer, ipcRenderer } from 'electron'; import { desktopCapturer, ipcRenderer } from 'electron';
import { import {
AudioDevice,
Call, Call,
CallEndedReason, CallEndedReason,
CallId, CallId,
@ -43,7 +44,6 @@ import { getConversationCallMode } from '../state/ducks/conversations';
import { isConversationTooBigToRing } from '../conversations/isConversationTooBigToRing'; import { isConversationTooBigToRing } from '../conversations/isConversationTooBigToRing';
import { isMe } from '../util/whatTypeOfConversation'; import { isMe } from '../util/whatTypeOfConversation';
import { import {
AudioDevice,
AvailableIODevicesType, AvailableIODevicesType,
CallMode, CallMode,
GroupCallConnectionState, GroupCallConnectionState,

View File

@ -1,6 +1,7 @@
// Copyright 2021 Signal Messenger, LLC // Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import { VideoFrameSource } from '../../types/Calling';
import type { VideoFrameSource } from 'ringrtc';
const COLORS: Array<[number, number, number]> = [ const COLORS: Array<[number, number, number]> = [
[0xff, 0x00, 0x00], [0xff, 0x00, 0x00],

View File

@ -1,7 +1,8 @@
// Copyright 2020-2021 Signal Messenger, LLC // Copyright 2020-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import { ConversationType } from '../state/ducks/conversations'; import type { AudioDevice } from 'ringrtc';
import type { ConversationType } from '../state/ducks/conversations';
// These are strings (1) for the database (2) for Storybook. // These are strings (1) for the database (2) for Storybook.
export enum CallMode { export enum CallMode {
@ -134,23 +135,6 @@ export type GroupCallVideoRequest = {
height: number; height: number;
}; };
// Should match RingRTC's VideoFrameSource
export type VideoFrameSource = {
receiveVideoFrame(buffer: Buffer): [number, number] | undefined;
};
// Must be kept in sync with RingRTC.AudioDevice
export type AudioDevice = {
// Device name.
name: string;
// Index of this device, starting from 0.
index: number;
// A unique and somewhat stable identifier of this device.
uniqueId: string;
// If present, the identifier of a localized string to substitute for the device name.
i18nKey?: string;
};
export enum CallingDeviceType { export enum CallingDeviceType {
CAMERA, CAMERA,
MICROPHONE, MICROPHONE,

View File

@ -1,11 +1,11 @@
// Copyright 2020-2021 Signal Messenger, LLC // Copyright 2020-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import type { AudioDevice } from 'ringrtc';
import type { import type {
CustomColorsItemType, CustomColorsItemType,
DefaultConversationColorType, DefaultConversationColorType,
} from './Colors'; } from './Colors';
import type { AudioDevice } from './Calling';
import type { PhoneNumberDiscoverability } from '../util/phoneNumberDiscoverability'; import type { PhoneNumberDiscoverability } from '../util/phoneNumberDiscoverability';
import type { PhoneNumberSharingMode } from '../util/phoneNumberSharingMode'; import type { PhoneNumberSharingMode } from '../util/phoneNumberSharingMode';
import type { RetryItemType } from '../util/retryPlaceholders'; import type { RetryItemType } from '../util/retryPlaceholders';

View File

@ -2,8 +2,8 @@
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import { webFrame } from 'electron'; import { webFrame } from 'electron';
import type { AudioDevice } from 'ringrtc';
import { AudioDevice } from '../types/Calling';
import { ZoomFactorType } from '../types/Storage.d'; import { ZoomFactorType } from '../types/Storage.d';
import { import {
DEFAULT_CONVERSATION_COLOR, DEFAULT_CONVERSATION_COLOR,