Group calling: tell RingRTC about our rendered resolutions for perf

This commit is contained in:
Evan Hahn 2020-12-01 19:52:01 -06:00 committed by GitHub
parent b30b83ed57
commit d1866a0e5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 211 additions and 7 deletions

View file

@ -44,3 +44,25 @@ export const useBoundActions = <T extends ActionCreatorsMapObject>(
return bindActionCreators(actions, dispatch);
}, [actions, dispatch]);
};
export const usePageVisibility = (): boolean => {
const [result, setResult] = React.useState(!document.hidden);
React.useEffect(() => {
const onVisibilityChange = () => {
setResult(!document.hidden);
};
document.addEventListener('visibilitychange', onVisibilityChange, false);
return () => {
document.removeEventListener(
'visibilitychange',
onVisibilityChange,
false
);
};
}, []);
return result;
};

View file

@ -14427,7 +14427,7 @@
"rule": "React-useRef",
"path": "ts/components/CallingPip.tsx",
"line": " const localVideoRef = React.useRef(null);",
"lineNumber": 78,
"lineNumber": 80,
"reasonCategory": "usageTrusted",
"updated": "2020-10-26T19:12:24.410Z",
"reasonDetail": "Used to get the local video element for rendering."

View file

@ -0,0 +1,12 @@
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { GroupCallVideoRequest } from '../../types/Calling';
export const nonRenderedRemoteParticipant = ({
demuxId,
}: Readonly<{ demuxId: number }>): GroupCallVideoRequest => ({
demuxId,
width: 0,
height: 0,
});