Consider own join time for group call missing media key check

Co-authored-by: Jamie Kyle <113370520+jamiebuilds-signal@users.noreply.github.com>
This commit is contained in:
ayumi-signal 2024-11-01 14:12:49 -07:00 committed by GitHub
parent f9b2261783
commit ec9041937f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 82 additions and 15 deletions

View file

@ -44,6 +44,7 @@ type BasePropsType = {
isActiveSpeakerInSpeakerView: boolean;
isCallReconnecting: boolean;
isInOverflow?: boolean;
joinedAt: number | null;
onClickRaisedHand?: () => void;
onVisibilityChanged?: (demuxId: number, isVisible: boolean) => unknown;
remoteParticipant: GroupCallRemoteParticipantType;
@ -82,6 +83,7 @@ export const GroupCallRemoteParticipant: React.FC<PropsType> = React.memo(
isActiveSpeakerInSpeakerView,
isCallReconnecting,
isInOverflow,
joinedAt,
} = props;
const {
@ -150,10 +152,17 @@ export const GroupCallRemoteParticipant: React.FC<PropsType> = React.memo(
const wantsToShowVideo = hasRemoteVideo && !isBlocked && isVisible;
const hasVideoToShow = wantsToShowVideo && hasReceivedVideoRecently;
// Use the later of participant join time (addedTime) vs your join time (joinedAt)
const timeForMissingMediaKeysCheck =
addedTime && joinedAt && addedTime > joinedAt ? addedTime : joinedAt;
const showMissingMediaKeys = Boolean(
!mediaKeysReceived &&
addedTime &&
isOlderThan(addedTime, DELAY_TO_SHOW_MISSING_MEDIA_KEYS)
timeForMissingMediaKeysCheck &&
isOlderThan(
timeForMissingMediaKeysCheck,
DELAY_TO_SHOW_MISSING_MEDIA_KEYS
)
);
const videoFrameSource = useMemo(