Allow screenshare video frames to be more stale

This commit is contained in:
Peter Thatcher 2022-01-20 11:43:58 -07:00 committed by GitHub
parent 1a313b88f8
commit bcd9f961ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,7 @@ import { useIntersectionObserver } from '../hooks/useIntersectionObserver';
import { MAX_FRAME_SIZE } from '../calling/constants'; import { MAX_FRAME_SIZE } from '../calling/constants';
const MAX_TIME_TO_SHOW_STALE_VIDEO_FRAMES = 5000; const MAX_TIME_TO_SHOW_STALE_VIDEO_FRAMES = 5000;
const MAX_TIME_TO_SHOW_STALE_SCREENSHARE_FRAMES = 60000;
type BasePropsType = { type BasePropsType = {
getFrameBuffer: () => Buffer; getFrameBuffer: () => Buffer;
@ -71,6 +72,7 @@ export const GroupCallRemoteParticipant: React.FC<PropsType> = React.memo(
isMe, isMe,
profileName, profileName,
sharedGroupNames, sharedGroupNames,
sharingScreen,
title, title,
videoAspectRatio, videoAspectRatio,
} = props.remoteParticipant; } = props.remoteParticipant;
@ -114,10 +116,11 @@ export const GroupCallRemoteParticipant: React.FC<PropsType> = React.memo(
); );
const renderVideoFrame = useCallback(() => { const renderVideoFrame = useCallback(() => {
if ( const frameAge = Date.now() - lastReceivedVideoAt.current;
Date.now() - lastReceivedVideoAt.current > const maxFrameAge = sharingScreen
MAX_TIME_TO_SHOW_STALE_VIDEO_FRAMES ? MAX_TIME_TO_SHOW_STALE_SCREENSHARE_FRAMES
) { : MAX_TIME_TO_SHOW_STALE_VIDEO_FRAMES;
if (frameAge > maxFrameAge) {
setHasReceivedVideoRecently(false); setHasReceivedVideoRecently(false);
} }
@ -168,7 +171,7 @@ export const GroupCallRemoteParticipant: React.FC<PropsType> = React.memo(
setHasReceivedVideoRecently(true); setHasReceivedVideoRecently(true);
setIsWide(frameWidth > frameHeight); setIsWide(frameWidth > frameHeight);
}, [getFrameBuffer, videoFrameSource]); }, [getFrameBuffer, videoFrameSource, sharingScreen]);
useEffect(() => { useEffect(() => {
if (!hasRemoteVideo) { if (!hasRemoteVideo) {