@@ -100,6 +100,8 @@ import {
100100 REQUESTED_VIDEO_WIDTH ,
101101 REQUESTED_VIDEO_HEIGHT ,
102102 REQUESTED_VIDEO_FRAMERATE ,
103+ REQUESTED_GROUP_VIDEO_WIDTH ,
104+ REQUESTED_GROUP_VIDEO_HEIGHT ,
103105 REQUESTED_SCREEN_SHARE_WIDTH ,
104106 REQUESTED_SCREEN_SHARE_HEIGHT ,
105107 REQUESTED_SCREEN_SHARE_FRAMERATE ,
@@ -408,6 +410,18 @@ function getLogId(
408410 return `${ source } (${ idForLogging } ${ additionalText } )` ;
409411}
410412
413+ const DIRECT_CALL_OPTIONS : GumVideoCaptureOptions = {
414+ maxWidth : REQUESTED_VIDEO_WIDTH ,
415+ maxHeight : REQUESTED_VIDEO_HEIGHT ,
416+ maxFramerate : REQUESTED_VIDEO_FRAMERATE ,
417+ } ;
418+
419+ const GROUP_CALL_OPTIONS : GumVideoCaptureOptions = {
420+ maxWidth : REQUESTED_GROUP_VIDEO_WIDTH ,
421+ maxHeight : REQUESTED_GROUP_VIDEO_HEIGHT ,
422+ maxFramerate : REQUESTED_VIDEO_FRAMERATE ,
423+ } ;
424+
411425export class CallingClass {
412426 readonly #videoCapturer: GumVideoCapturer ;
413427
@@ -436,11 +450,7 @@ export class CallingClass {
436450 #sendProfileKeysForAdhocCallCache: Set < AciString > ;
437451
438452 constructor ( ) {
439- this . #videoCapturer = new GumVideoCapturer ( {
440- maxWidth : REQUESTED_VIDEO_WIDTH ,
441- maxHeight : REQUESTED_VIDEO_HEIGHT ,
442- maxFramerate : REQUESTED_VIDEO_FRAMERATE ,
443- } ) ;
453+ this . #videoCapturer = new GumVideoCapturer ( DIRECT_CALL_OPTIONS ) ;
444454 this . videoRenderer = new CanvasVideoRenderer ( ) ;
445455
446456 this . #callsLookup = { } ;
@@ -619,7 +629,7 @@ export class CallingClass {
619629 await this . #startDeviceReselectionTimer( ) ;
620630
621631 const enableLocalCameraIfNecessary = hasLocalVideo
622- ? ( ) => drop ( this . enableLocalCamera ( ) )
632+ ? ( ) => drop ( this . enableLocalCamera ( callMode ) )
623633 : noop ;
624634
625635 switch ( callMode ) {
@@ -970,7 +980,7 @@ export class CallingClass {
970980 groupCall . setOutgoingVideoMuted ( ! hasLocalVideo ) ;
971981
972982 if ( hasLocalVideo ) {
973- drop ( this . enableLocalCamera ( ) ) ;
983+ drop ( this . enableLocalCamera ( CallMode . Group ) ) ;
974984 }
975985
976986 return {
@@ -1394,7 +1404,7 @@ export class CallingClass {
13941404
13951405 groupCall . setOutgoingAudioMuted ( ! hasLocalAudio ) ;
13961406 groupCall . setOutgoingVideoMuted ( ! hasLocalVideo ) ;
1397- drop ( this . enableCaptureAndSend ( groupCall , null , logId ) ) ;
1407+ drop ( this . enableCaptureAndSend ( groupCall , undefined , logId ) ) ;
13981408
13991409 if ( shouldRing ) {
14001410 groupCall . ringAll ( ) ;
@@ -1469,7 +1479,7 @@ export class CallingClass {
14691479 } else if ( localDeviceState . videoMuted ) {
14701480 this . disableLocalVideo ( ) ;
14711481 } else {
1472- drop ( this . enableCaptureAndSend ( groupCall , null , logId ) ) ;
1482+ drop ( this . enableCaptureAndSend ( groupCall , undefined , logId ) ) ;
14731483 }
14741484
14751485 // Call enters the Joined state, once per call.
@@ -2613,24 +2623,24 @@ export class CallingClass {
26132623 RingRTC . setAudioOutput ( device . index ) ;
26142624 }
26152625
2616- async enableLocalCamera ( ) : Promise < void > {
2626+ async enableLocalCamera ( mode : CallMode ) : Promise < void > {
26172627 await window . reduxActions . globalModals . ensureSystemMediaPermissions (
26182628 'camera' ,
26192629 'call'
26202630 ) ;
2621- await this . #videoCapturer. enableCapture ( ) ;
2631+
2632+ await this . #videoCapturer. enableCapture (
2633+ mode === CallMode . Direct ? undefined : GROUP_CALL_OPTIONS
2634+ ) ;
26222635 }
26232636
26242637 async enableCaptureAndSend (
26252638 call : GroupCall | Call ,
2626- options ?: GumVideoCaptureOptions | null ,
2627- logId ?: string
2639+ options = call instanceof GroupCall ? GROUP_CALL_OPTIONS : undefined ,
2640+ logId = 'enableCaptureAndSend'
26282641 ) : Promise < void > {
26292642 try {
2630- await this . #videoCapturer. enableCaptureAndSend (
2631- call ,
2632- options ?? undefined
2633- ) ;
2643+ await this . #videoCapturer. enableCaptureAndSend ( call , options ) ;
26342644 } catch ( err ) {
26352645 log . error (
26362646 `${
0 commit comments