Module 907926

2,012 characters · in no known chunk
Dependencies
Required by (1)
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";n.d(t,{A:()=>N});var r=n(118356),i=n(205693),s=n(827343),a=n(439372),o=n(624694),l=n(929921),u=n(616356),c=n(71393),d=n(430452),_=n(162605),f=n(287809),p=n(927813),h=n(258585),m=n(652896),E=n(476697),g=n(753070);let A=10,I=20,T=10,S=new r.Vy("AutoQualityStreamingManager"),y=0;class v extends a.A{actions={MEDIA_ENGINE_CONNECTION_STATS:this.handleStats,POST_CONNECTION_OPEN:this.handlePostConnectionOpen};handleStats(){if((y+=1)%T!=0)return;let e=u.A.getCurrentUserActiveStream();if(null==e)return;let t=_.A.getRTCConnection((0,m._z)(e)),n=d.Ay.getGoLiveSource();if(null==t||null==n||!t.hasActiveRemoteWants())return;let r=l.A.getState();if(r.preset!==g.jQ.PRESET_AUTO)return;if(u.A.getStreamerActiveStreamMetadata()?.id!=null)return void S.info("Skipping auto quality checker for game stream.");let a=o.A.getAccumulatedPerformanceStats(t.getMediaEngineConnectionId(),e.ownerId,"long"),h=(t.analyticsContext.getDuration()??30)>=30*p.A.Millis.SECOND?30:15;if(null==a||a.numDatapoints<h)return;let v=f.default.getCurrentUser(),N=c.A.getGuild(e.guildId),[C,R]=(0,E.A)(g.jQ.PRESET_DOCUMENTS,v,N?.premiumTier)??[g.on.RESOLUTION_SOURCE,g.kn.FPS_5],[O,b]=(0,E.A)(g.jQ.PRESET_VIDEO,v,N?.premiumTier)??[g.on.RESOLUTION_720,g.kn.FPS_30],D=null;if(a.entropy<A&&(r.resolution!==C||r.fps!==R)?(S.info("Low entropy average, switching to screenshare preset."),D={qualityOptions:{preset:g.jQ.PRESET_AUTO,resolution:C,frameRate:R},context:i.x.STREAM}):a.entropy>I&&(r.resolution!==O||r.fps!==b)&&(S.info("High entropy average, switching to video preset."),D={qualityOptions:{preset:g.jQ.PRESET_AUTO,resolution:O,frameRate:b},context:i.x.STREAM}),null!=D){if(null!=n.desktopSource)D.desktopSettings={sourceId:n.desktopSource.id,sound:r.soundshareEnabled};else{if(null==n.cameraSource)return;D.cameraSettings={videoDeviceGuid:n.cameraSource.videoDeviceGuid,audioDeviceGuid:n.cameraSource.audioDeviceGuid}}t.autoQualityChange(),s.A.setGoLiveSource(D)}}handlePostConnectionOpen(){(0,h.pn)()}}let N=new v}