// Metro module 12864 (f12865). import TypedEventEmitter from "../../_bundle/TypedEventEmitter"; import Logger from "../debug/Logger"; import { DelayedCall } from "../../_bundle/Timeout"; let c8869_3 = { RequestedSSRCsUpdate: "requested-ssrcs-update", RequestedStreamsUpdate: "requested-streams-update" }; class GoLiveQualityManager extends TypedEventEmitter { constructor() { super(); let c20269_0 = this; this.streamId = null; this.resolutionWidth = 0; this.resolutionHeight = 0; this.zoom = 1; this.audioSSRC = 0; this.incomingVideoEnabled = true; this.delayedUpdate = () => { c20269_0.delayedCall.delay(); }; this.logger = new Logger("GoLiveQualityManager"); this.logger.enableNativeLogger(true); this.delayedCall = new DelayedCall(500, () => { this.update(); }); } setUserID(a0) { this.userId = a0; } getUserID() { return this.userId; } updateAudioAndVideoStreamInfo(a0, a1) { this.audioSSRC = a0; this.videoStream = a1.find((item) => item.active); this.update(); } onIncomingVideoEnabled(a0) { if (this.incomingVideoEnabled !== a0) { this.logger.info("onIncomingVideoEnabled", a0); this.incomingVideoEnabled = a0; this.update(); } } update() { if (this.userId != null && this.videoStream != null) { if (this.incomingVideoEnabled) { this.requestStream(); } else { this.stopStream(); } } } requestStream() { if (this.videoStream != null) { const request2 = this.request; const r3 = {}; r3[this.videoStream.ssrc] = 100; request2.call(this, r3, [this.videoStream.ssrc]); } } stopStream() { if (this.videoStream != null) { const request2 = this.request; const r3 = {}; r3[this.videoStream.ssrc] = 0; request2.call(this, r3, []); } } request(a0, a1) { let c20270_0; if (this.userId !== void 0) { c20270_0 = a0; a1.forEach((item) => { if (c20270_0.pixelCounts == null) { c20270_0.pixelCounts = {}; } if (c20270_0[item] > 0) { const pixelCounts = c20270_0.pixelCounts; const r6 = Math; pixelCounts[item] = r6.floor(this.resolutionWidth * this.resolutionHeight * this.zoom * this.zoom); } }); this.emit(c8869_3.RequestedSSRCsUpdate, this.userId, this.audioSSRC, a1); this.emit(c8869_3.RequestedStreamsUpdate, a0); } } setVideoSize(a0, a1, a2) { if (this.streamId === a0) { if (a1 != null) { this.resolutionWidth = a1.width; this.resolutionHeight = a1.height; } if (a2 != null) { this.zoom = a2; } this.delayedUpdate(); } } setStreamId(a0) { if (this.streamId !== a0) { this.streamId = a0; this.resolutionWidth = 0; this.resolutionHeight = 0; this.zoom = 1; this.delayedUpdate(); } } } export default GoLiveQualityManager; export { c8869_3 as GoLiveQualityManagerEvent };