Skip to content

Commit

Permalink
Provide speakerHeight to ringrtc
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny-signal committed Sep 7, 2022
1 parent 618a772 commit 55a5c51
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 11 deletions.
3 changes: 2 additions & 1 deletion ts/components/CallManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,11 @@ const ActiveCallManager: React.FC<ActiveCallManagerPropsType> = ({
);

const setGroupCallVideoRequestForConversation = useCallback(
(resolutions: Array<GroupCallVideoRequest>) => {
(resolutions: Array<GroupCallVideoRequest>, speakerHeight: number) => {
setGroupCallVideoRequest({
conversationId: conversation.id,
resolutions,
speakerHeight,
});
},
[setGroupCallVideoRequest, conversation.id]
Expand Down
5 changes: 4 additions & 1 deletion ts/components/CallScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ export type PropsType = {
joinedAt?: number;
me: ConversationType;
openSystemPreferencesAction: () => unknown;
setGroupCallVideoRequest: (_: Array<GroupCallVideoRequest>) => void;
setGroupCallVideoRequest: (
_: Array<GroupCallVideoRequest>,
speakerHeight: number
) => void;
setLocalAudio: (_: SetLocalAudioType) => void;
setLocalVideo: (_: SetLocalVideoType) => void;
setLocalPreview: (_: SetLocalPreviewType) => void;
Expand Down
5 changes: 4 additions & 1 deletion ts/components/CallingPip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ export type PropsType = {
hangUpActiveCall: (reason: string) => void;
hasLocalVideo: boolean;
i18n: LocalizerType;
setGroupCallVideoRequest: (_: Array<GroupCallVideoRequest>) => void;
setGroupCallVideoRequest: (
_: Array<GroupCallVideoRequest>,
speakerHeight: number
) => void;
setLocalPreview: (_: SetLocalPreviewType) => void;
setRendererCanvas: (_: SetRendererCanvasType) => void;
switchToPresentationView: () => void;
Expand Down
11 changes: 8 additions & 3 deletions ts/components/CallingPipRemoteVideo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ export type PropsType = {
activeCall: ActiveCallType;
getGroupCallVideoFrameSource: (demuxId: number) => VideoFrameSource;
i18n: LocalizerType;
setGroupCallVideoRequest: (_: Array<GroupCallVideoRequest>) => void;
setGroupCallVideoRequest: (
_: Array<GroupCallVideoRequest>,
speakerHeight: number
) => void;
setRendererCanvas: (_: SetRendererCanvasType) => void;
};

Expand Down Expand Up @@ -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
);
}
}, [
Expand Down
7 changes: 5 additions & 2 deletions ts/components/GroupCallRemoteParticipants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ type PropsType = {
i18n: LocalizerType;
isInSpeakerView: boolean;
remoteParticipants: ReadonlyArray<GroupCallRemoteParticipantType>;
setGroupCallVideoRequest: (_: Array<GroupCallVideoRequest>) => void;
setGroupCallVideoRequest: (
_: Array<GroupCallVideoRequest>,
speakerHeight: number
) => void;
remoteAudioLevels: Map<number, number>;
};

Expand Down Expand Up @@ -377,7 +380,7 @@ export const GroupCallRemoteParticipants: React.FC<PropsType> = ({
break;
}

setGroupCallVideoRequest(videoRequest);
setGroupCallVideoRequest(videoRequest, gridParticipantHeight);
}, [
devicePixelRatio,
gridParticipantHeight,
Expand Down
5 changes: 3 additions & 2 deletions ts/services/calling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -830,9 +830,10 @@ export class CallingClass {

public setGroupCallVideoRequest(
conversationId: string,
resolutions: Array<VideoRequest>
resolutions: Array<VideoRequest>,
speakerHeight: number
): void {
this.getGroupCall(conversationId)?.requestVideo(resolutions, 0);
this.getGroupCall(conversationId)?.requestVideo(resolutions, speakerHeight);
}

public groupMembersChanged(conversationId: string): void {
Expand Down
4 changes: 3 additions & 1 deletion ts/state/ducks/calling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ export type SetLocalVideoType = {
export type SetGroupCallVideoRequestType = {
conversationId: string;
resolutions: Array<GroupCallVideoRequest>;
speakerHeight: number;
};

export type StartCallingLobbyType = {
Expand Down Expand Up @@ -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
);
};
}
Expand Down

0 comments on commit 55a5c51

Please sign in to comment.