Respect changing PPI during screen share

This commit is contained in:
Evan Hahn 2022-01-06 16:00:11 -06:00 committed by GitHub
parent e98b281644
commit 5eee11e89c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,6 +17,7 @@ import type {
import { useGetCallingFrameBuffer } from '../calling/useGetCallingFrameBuffer'; import { useGetCallingFrameBuffer } from '../calling/useGetCallingFrameBuffer';
import type { LocalizerType } from '../types/Util'; import type { LocalizerType } from '../types/Util';
import { usePageVisibility } from '../hooks/usePageVisibility'; import { usePageVisibility } from '../hooks/usePageVisibility';
import { useDevicePixelRatio } from '../hooks/useDevicePixelRatio';
import { nonRenderedRemoteParticipant } from '../util/ringrtc/nonRenderedRemoteParticipant'; import { nonRenderedRemoteParticipant } from '../util/ringrtc/nonRenderedRemoteParticipant';
import { missingCaseError } from '../util/missingCaseError'; import { missingCaseError } from '../util/missingCaseError';
import { SECOND } from '../util/durations'; import { SECOND } from '../util/durations';
@ -94,6 +95,8 @@ export const GroupCallRemoteParticipants: React.FC<PropsType> = ({
height: 0, height: 0,
}); });
const devicePixelRatio = useDevicePixelRatio();
const getFrameBuffer = useGetCallingFrameBuffer(); const getFrameBuffer = useGetCallingFrameBuffer();
const { invisibleDemuxIds, onParticipantVisibilityChanged } = const { invisibleDemuxIds, onParticipantVisibilityChanged } =
@ -298,9 +301,8 @@ export const GroupCallRemoteParticipants: React.FC<PropsType> = ({
...gridParticipants.map(participant => { ...gridParticipants.map(participant => {
let scalar: number; let scalar: number;
if (participant.sharingScreen) { if (participant.sharingScreen) {
// We want best-resolution video if someone is sharing their screen. This // We want best-resolution video if someone is sharing their screen.
// code is extra-defensive against strange devicePixelRatios. scalar = Math.max(devicePixelRatio, 1);
scalar = Math.max(window.devicePixelRatio || 1, 1);
} else if (participant.hasRemoteVideo) { } else if (participant.hasRemoteVideo) {
scalar = VIDEO_REQUEST_SCALAR; scalar = VIDEO_REQUEST_SCALAR;
} else { } else {
@ -357,13 +359,14 @@ export const GroupCallRemoteParticipants: React.FC<PropsType> = ({
setGroupCallVideoRequest(videoRequest); setGroupCallVideoRequest(videoRequest);
}, [ }, [
devicePixelRatio,
gridParticipantHeight, gridParticipantHeight,
videoRequestMode, gridParticipants,
invisibleDemuxIds, invisibleDemuxIds,
overflowedParticipants, overflowedParticipants,
remoteParticipants, remoteParticipants,
setGroupCallVideoRequest, setGroupCallVideoRequest,
gridParticipants, videoRequestMode,
]); ]);
return ( return (