Module 429430

1,438 characters · in no known chunk
Dependencies
Required by (1)
Lazily required by (0)none
Requires (3)
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";n.d(t,{A:()=>o});var i=n(941426),r=n(459838),s=n(731854);let a=new i.Vy("ConnectionEventFramerateReducer");class o{connection;sinkWants;framerateReductionTimeout;constructor(e,t){this.connection=e,this.sinkWants=t,a.enableNativeLogger(!0),e.on(r.yq.Speaking,this.handleSpeaking),e.on(r.yq.Mute,this.handleSelfMute),this.initialize()}initialize(){this.userSpeakingChange(!0)}handleSpeaking=(e,t)=>{e===this.connection.userId&&this.userSpeakingChange(t===s.ME.NONE)};handleSelfMute=e=>{this.connection.hasDesktopSource()||(this.destroyFramerateScaleFactorTimers(),this.sinkWants.isMuted=e,this.updateRemoteWantsFramerate())};userSpeakingChange(e){if(!this.connection.hasDesktopSource()){if(this.destroyFramerateScaleFactorTimers(),!e){this.sinkWants.isMuted&&(this.sinkWants.isMuted=!1,this.updateRemoteWantsFramerate());return}this.framerateReductionTimeout=setTimeout(()=>{this.connection.destroyed||(a.info(`BaseConnection.userSpeakingChange: Reduced framerate after ${s.qm} ms.`),this.framerateReductionTimeout=void 0,this.sinkWants.isMuted=!0,this.updateRemoteWantsFramerate())},s.qm)}}destroyFramerateScaleFactorTimers(){"number"==typeof this.framerateReductionTimeout&&(clearTimeout(this.framerateReductionTimeout),this.framerateReductionTimeout=void 0)}updateRemoteWantsFramerate(){this.connection.updateVideoQuality(["remoteSinkWantsMaxFramerate"])}destroy(){this.destroyFramerateScaleFactorTimers()}}}