From bcd9f961addbf0780cb08aab45c9305ba5be7006 Mon Sep 17 00:00:00 2001 From: Peter Thatcher Date: Thu, 20 Jan 2022 11:43:58 -0700 Subject: [PATCH] Allow screenshare video frames to be more stale --- ts/components/GroupCallRemoteParticipant.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ts/components/GroupCallRemoteParticipant.tsx b/ts/components/GroupCallRemoteParticipant.tsx index f39bc39f4606..1ab5bbf070af 100644 --- a/ts/components/GroupCallRemoteParticipant.tsx +++ b/ts/components/GroupCallRemoteParticipant.tsx @@ -24,6 +24,7 @@ import { useIntersectionObserver } from '../hooks/useIntersectionObserver'; import { MAX_FRAME_SIZE } from '../calling/constants'; const MAX_TIME_TO_SHOW_STALE_VIDEO_FRAMES = 5000; +const MAX_TIME_TO_SHOW_STALE_SCREENSHARE_FRAMES = 60000; type BasePropsType = { getFrameBuffer: () => Buffer; @@ -71,6 +72,7 @@ export const GroupCallRemoteParticipant: React.FC = React.memo( isMe, profileName, sharedGroupNames, + sharingScreen, title, videoAspectRatio, } = props.remoteParticipant; @@ -114,10 +116,11 @@ export const GroupCallRemoteParticipant: React.FC = React.memo( ); const renderVideoFrame = useCallback(() => { - if ( - Date.now() - lastReceivedVideoAt.current > - MAX_TIME_TO_SHOW_STALE_VIDEO_FRAMES - ) { + const frameAge = Date.now() - lastReceivedVideoAt.current; + const maxFrameAge = sharingScreen + ? MAX_TIME_TO_SHOW_STALE_SCREENSHARE_FRAMES + : MAX_TIME_TO_SHOW_STALE_VIDEO_FRAMES; + if (frameAge > maxFrameAge) { setHasReceivedVideoRecently(false); } @@ -168,7 +171,7 @@ export const GroupCallRemoteParticipant: React.FC = React.memo( setHasReceivedVideoRecently(true); setIsWide(frameWidth > frameHeight); - }, [getFrameBuffer, videoFrameSource]); + }, [getFrameBuffer, videoFrameSource, sharingScreen]); useEffect(() => { if (!hasRemoteVideo) {