From 55a5c512369f404762c1794db997785b76fa0a58 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Wed, 7 Sep 2022 08:52:55 -0700 Subject: [PATCH] Provide speakerHeight to ringrtc --- ts/components/CallManager.tsx | 3 ++- ts/components/CallScreen.tsx | 5 ++++- ts/components/CallingPip.tsx | 5 ++++- ts/components/CallingPipRemoteVideo.tsx | 11 ++++++++--- ts/components/GroupCallRemoteParticipants.tsx | 7 +++++-- ts/services/calling.ts | 5 +++-- ts/state/ducks/calling.ts | 4 +++- 7 files changed, 29 insertions(+), 11 deletions(-) diff --git a/ts/components/CallManager.tsx b/ts/components/CallManager.tsx index 0fb37012a..0efa526ff 100644 --- a/ts/components/CallManager.tsx +++ b/ts/components/CallManager.tsx @@ -178,10 +178,11 @@ const ActiveCallManager: React.FC = ({ ); const setGroupCallVideoRequestForConversation = useCallback( - (resolutions: Array) => { + (resolutions: Array, speakerHeight: number) => { setGroupCallVideoRequest({ conversationId: conversation.id, resolutions, + speakerHeight, }); }, [setGroupCallVideoRequest, conversation.id] diff --git a/ts/components/CallScreen.tsx b/ts/components/CallScreen.tsx index b924be5fd..5074d55ec 100644 --- a/ts/components/CallScreen.tsx +++ b/ts/components/CallScreen.tsx @@ -56,7 +56,10 @@ export type PropsType = { joinedAt?: number; me: ConversationType; openSystemPreferencesAction: () => unknown; - setGroupCallVideoRequest: (_: Array) => void; + setGroupCallVideoRequest: ( + _: Array, + speakerHeight: number + ) => void; setLocalAudio: (_: SetLocalAudioType) => void; setLocalVideo: (_: SetLocalVideoType) => void; setLocalPreview: (_: SetLocalPreviewType) => void; diff --git a/ts/components/CallingPip.tsx b/ts/components/CallingPip.tsx index 2a844daec..5112f3062 100644 --- a/ts/components/CallingPip.tsx +++ b/ts/components/CallingPip.tsx @@ -54,7 +54,10 @@ export type PropsType = { hangUpActiveCall: (reason: string) => void; hasLocalVideo: boolean; i18n: LocalizerType; - setGroupCallVideoRequest: (_: Array) => void; + setGroupCallVideoRequest: ( + _: Array, + speakerHeight: number + ) => void; setLocalPreview: (_: SetLocalPreviewType) => void; setRendererCanvas: (_: SetRendererCanvasType) => void; switchToPresentationView: () => void; diff --git a/ts/components/CallingPipRemoteVideo.tsx b/ts/components/CallingPipRemoteVideo.tsx index 784f539ba..a010eb4be 100644 --- a/ts/components/CallingPipRemoteVideo.tsx +++ b/ts/components/CallingPipRemoteVideo.tsx @@ -76,7 +76,10 @@ export type PropsType = { activeCall: ActiveCallType; getGroupCallVideoFrameSource: (demuxId: number) => VideoFrameSource; i18n: LocalizerType; - setGroupCallVideoRequest: (_: Array) => void; + setGroupCallVideoRequest: ( + _: Array, + speakerHeight: number + ) => void; setRendererCanvas: (_: SetRendererCanvasType) => void; }; @@ -124,11 +127,13 @@ export const CallingPipRemoteVideo = ({ }; } return nonRenderedRemoteParticipant(participant); - }) + }), + PIP_VIDEO_HEIGHT_PX ); } else { setGroupCallVideoRequest( - activeCall.remoteParticipants.map(nonRenderedRemoteParticipant) + activeCall.remoteParticipants.map(nonRenderedRemoteParticipant), + 0 ); } }, [ diff --git a/ts/components/GroupCallRemoteParticipants.tsx b/ts/components/GroupCallRemoteParticipants.tsx index 906f83be7..cc81407cb 100644 --- a/ts/components/GroupCallRemoteParticipants.tsx +++ b/ts/components/GroupCallRemoteParticipants.tsx @@ -48,7 +48,10 @@ type PropsType = { i18n: LocalizerType; isInSpeakerView: boolean; remoteParticipants: ReadonlyArray; - setGroupCallVideoRequest: (_: Array) => void; + setGroupCallVideoRequest: ( + _: Array, + speakerHeight: number + ) => void; remoteAudioLevels: Map; }; @@ -377,7 +380,7 @@ export const GroupCallRemoteParticipants: React.FC = ({ break; } - setGroupCallVideoRequest(videoRequest); + setGroupCallVideoRequest(videoRequest, gridParticipantHeight); }, [ devicePixelRatio, gridParticipantHeight, diff --git a/ts/services/calling.ts b/ts/services/calling.ts index acdecd5d1..f782292ef 100644 --- a/ts/services/calling.ts +++ b/ts/services/calling.ts @@ -830,9 +830,10 @@ export class CallingClass { public setGroupCallVideoRequest( conversationId: string, - resolutions: Array + resolutions: Array, + speakerHeight: number ): void { - this.getGroupCall(conversationId)?.requestVideo(resolutions, 0); + this.getGroupCall(conversationId)?.requestVideo(resolutions, speakerHeight); } public groupMembersChanged(conversationId: string): void { diff --git a/ts/state/ducks/calling.ts b/ts/state/ducks/calling.ts index d9c006547..847d1402c 100644 --- a/ts/state/ducks/calling.ts +++ b/ts/state/ducks/calling.ts @@ -227,6 +227,7 @@ export type SetLocalVideoType = { export type SetGroupCallVideoRequestType = { conversationId: string; resolutions: Array; + speakerHeight: number; }; export type StartCallingLobbyType = { @@ -1146,7 +1147,8 @@ function setGroupCallVideoRequest( // The `framerate` property in RingRTC has to be set, even if it's set to // `undefined`. framerate: undefined, - })) + })), + payload.speakerHeight ); }; }