214 lines
7.4 KiB
TypeScript
214 lines
7.4 KiB
TypeScript
// Metro module 6026 (f6027).
|
|
import ApplicationStreamingSettingsStore from "../../stores/ApplicationStreamingSettingsStore";
|
|
import ApplicationStreamingStore from "../../stores/ApplicationStreamingStore";
|
|
import StreamRTCConnectionStore from "../../stores/StreamRTCConnectionStore";
|
|
import ClipsStore from "./ClipsStore";
|
|
import { ClipSignalTypes } from "./ClipsTypes";
|
|
import { getClipsRuntime } from "./ClipsV3RuntimeExperiment";
|
|
import { encodeStreamKey } from "../go_live/utils/StreamKeyUtils";
|
|
import { parseEncoder, Encoders } from "../../lib/VideoQualityStats";
|
|
const getClipBaseProperties = function getClipBaseProperties(a0) {
|
|
let clip_type;
|
|
const decision = a0.decision;
|
|
const r6 = decision == null ? void 0 : decision.signal?.type;
|
|
L9: {
|
|
const MANUAL = ClipSignalTypes.MANUAL;
|
|
clip_type = "manual";
|
|
if (MANUAL !== r6) {
|
|
const DISTRIBUTED = ClipSignalTypes.DISTRIBUTED;
|
|
clip_type = "distributed";
|
|
if (DISTRIBUTED !== r6) {
|
|
if (ClipSignalTypes.LAUGHTER !== r6 && ClipSignalTypes.SHOUTING !== r6) {
|
|
const GAME_EVENT = ClipSignalTypes.GAME_EVENT;
|
|
clip_type = "unknown";
|
|
if (GAME_EVENT !== r6) {
|
|
break L9;
|
|
}
|
|
}
|
|
clip_type = "auto_ml";
|
|
}
|
|
}
|
|
}
|
|
return {
|
|
clip_type,
|
|
num_clip_participants: a0.users.length,
|
|
clip_session_id: a0.gameSessionId,
|
|
is_candidate: a0.isCandidate
|
|
};
|
|
};
|
|
export function getClipType({ decision }) {
|
|
const r4 = decision == null ? void 0 : decision.signal?.type;
|
|
if (ClipSignalTypes.MANUAL === r4) {
|
|
return "manual";
|
|
}
|
|
if (ClipSignalTypes.DISTRIBUTED === r4) {
|
|
return "distributed";
|
|
}
|
|
if (ClipSignalTypes.LAUGHTER !== r4 && ClipSignalTypes.SHOUTING !== r4 && ClipSignalTypes.GAME_EVENT !== r4) {
|
|
return "unknown";
|
|
}
|
|
return "auto_ml";
|
|
}
|
|
export { getClipBaseProperties };
|
|
export function getClipContextProperties(a0) {
|
|
return {
|
|
clip_runtime: getClipsRuntime(a0),
|
|
current_clip_session_id: ClipsStore.getCurrentClipsSession()?.id
|
|
};
|
|
}
|
|
export function getClipSignalTypes(a0) {
|
|
const r0 = [];
|
|
for (const item of a0.timeline) {
|
|
const type = item.signal.type;
|
|
if (ClipSignalTypes.MANUAL === type) {
|
|
r0.push("manual");
|
|
} else if (ClipSignalTypes.DISTRIBUTED === type) {
|
|
r0.push("distributed");
|
|
} else if (ClipSignalTypes.LAUGHTER === type) {
|
|
r0.push("laughter");
|
|
} else if (ClipSignalTypes.SHOUTING === type) {
|
|
r0.push("shouting");
|
|
} else if (ClipSignalTypes.GAME_EVENT === type) {
|
|
r0.push(`game_event:${item.signal.eventType}`);
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
export function getPreSaveClipAnalytics(a0) {
|
|
const currentUserActiveStream = ApplicationStreamingStore.getCurrentUserActiveStream();
|
|
const r6 = currentUserActiveStream != null ? StreamRTCConnectionStore.getRTCConnection(encodeStreamKey(currentUserActiveStream)) : null;
|
|
const r21 = {
|
|
...getClipBaseProperties(a0),
|
|
...{
|
|
clip_runtime: getClipsRuntime("getPreSaveClipAnalytics"),
|
|
current_clip_session_id: ClipsStore.getCurrentClipsSession()?.id
|
|
},
|
|
rtc_connection_id: r6 == null ? void 0 : r6.getRTCConnectionId(),
|
|
media_session_id: r6 == null ? void 0 : r6.getMediaSessionId(),
|
|
parent_media_session_id: r6?.parentMediaSessionId,
|
|
guild_id: a0.guildId,
|
|
channel_id: a0.channelId,
|
|
application_id: a0.applicationId,
|
|
application_name: a0.applicationName,
|
|
clip_uuid: a0.id,
|
|
clip_event_timeline_size: a0.timeline.length
|
|
};
|
|
return r21;
|
|
}
|
|
export function getPostSaveClipAnalytics(a0, a1) {
|
|
const map = new Map();
|
|
const framesEncodedByEncoder = a1.framesEncodedByEncoder;
|
|
for (const key in framesEncodedByEncoder) {
|
|
const r14 = a1.framesEncodedByEncoder[key];
|
|
const r26 = parseEncoder(key);
|
|
let r28 = map.get(r26);
|
|
if (r28 == null) {
|
|
r28 = 0;
|
|
}
|
|
map.set(r26, r28 + r14);
|
|
}
|
|
let frames_encoded_nvidia_cuda = map.get(Encoders.NVIDIA_CUDA);
|
|
if (frames_encoded_nvidia_cuda == null) {
|
|
frames_encoded_nvidia_cuda = 0;
|
|
}
|
|
let frames_encoded_nvidia_direct3d = map.get(Encoders.NVIDIA_DIRECT_3D);
|
|
if (frames_encoded_nvidia_direct3d == null) {
|
|
frames_encoded_nvidia_direct3d = 0;
|
|
}
|
|
let frames_encoded_openh264 = map.get(Encoders.OPENH264);
|
|
if (frames_encoded_openh264 == null) {
|
|
frames_encoded_openh264 = 0;
|
|
}
|
|
let frames_encoded_videotoolbox = map.get(Encoders.VIDEOTOOLBOX);
|
|
if (frames_encoded_videotoolbox == null) {
|
|
frames_encoded_videotoolbox = 0;
|
|
}
|
|
let frames_encoded_amd_direct3d = map.get(Encoders.AMD_DIRECT_3D);
|
|
if (frames_encoded_amd_direct3d == null) {
|
|
frames_encoded_amd_direct3d = 0;
|
|
}
|
|
let frames_encoded_amd_vaapi = map.get(Encoders.AMD_VAAPI);
|
|
if (frames_encoded_amd_vaapi == null) {
|
|
frames_encoded_amd_vaapi = 0;
|
|
}
|
|
let frames_encoded_intel = map.get(Encoders.INTEL);
|
|
if (frames_encoded_intel == null) {
|
|
frames_encoded_intel = 0;
|
|
}
|
|
let frames_encoded_intel_direct3d = map.get(Encoders.INTEL_DIRECT_3D);
|
|
if (frames_encoded_intel_direct3d == null) {
|
|
frames_encoded_intel_direct3d = 0;
|
|
}
|
|
let frames_encoded_wmf_direct3d_intel = map.get(Encoders.WMF_DIRECT_3D_INTEL);
|
|
if (frames_encoded_wmf_direct3d_intel == null) {
|
|
frames_encoded_wmf_direct3d_intel = 0;
|
|
}
|
|
let frames_encoded_wmf_direct3d_nvidia = map.get(Encoders.WMF_DIRECT_3D_NVIDIA);
|
|
if (frames_encoded_wmf_direct3d_nvidia == null) {
|
|
frames_encoded_wmf_direct3d_nvidia = 0;
|
|
}
|
|
let frames_encoded_wmf_direct3d_amd = map.get(Encoders.WMF_DIRECT_3D_AMD);
|
|
if (frames_encoded_wmf_direct3d_amd == null) {
|
|
frames_encoded_wmf_direct3d_amd = 0;
|
|
}
|
|
let r107 = map.get(Encoders.WMF_DIRECT_3D);
|
|
if (r107 == null) {
|
|
r107 = 0;
|
|
}
|
|
let r113 = map.get(Encoders.WMF_DIRECT_3D_INTEL);
|
|
if (r113 == null) {
|
|
r113 = 0;
|
|
}
|
|
const r114 = r107 + r113;
|
|
let r120 = map.get(Encoders.WMF_DIRECT_3D_NVIDIA);
|
|
if (r120 == null) {
|
|
r120 = 0;
|
|
}
|
|
const r121 = r114 + r120;
|
|
let r127 = map.get(Encoders.WMF_DIRECT_3D_AMD);
|
|
if (r127 == null) {
|
|
r127 = 0;
|
|
}
|
|
let frames_encoded_uncategorized = map.get(Encoders.UNCATEGORIZED);
|
|
if (frames_encoded_uncategorized == null) {
|
|
frames_encoded_uncategorized = 0;
|
|
}
|
|
let frames_encoded_unknown = map.get(Encoders.UNKNOWN);
|
|
if (frames_encoded_unknown == null) {
|
|
frames_encoded_unknown = 0;
|
|
}
|
|
return {
|
|
...a0,
|
|
frames_encoded_nvidia_cuda,
|
|
frames_encoded_nvidia_direct3d,
|
|
frames_encoded_openh264,
|
|
frames_encoded_videotoolbox,
|
|
frames_encoded_amd_direct3d,
|
|
frames_encoded_amd_vaapi,
|
|
frames_encoded_intel,
|
|
frames_encoded_intel_direct3d,
|
|
frames_encoded_wmf_direct3d_intel,
|
|
frames_encoded_wmf_direct3d_nvidia,
|
|
frames_encoded_wmf_direct3d_amd,
|
|
frames_encoded_wmf_direct3d: r121 + r127,
|
|
frames_encoded_uncategorized,
|
|
frames_encoded_unknown,
|
|
frames_submitted: a1.framesSubmitted,
|
|
frames_submitted_during_clip: a1.framesSubmittedDuringClip,
|
|
frames_encoded: a1.framesEncoded,
|
|
frames_encoded_during_clip: a1.framesEncodedDuringClip,
|
|
frames_dropped: a1.framesDropped,
|
|
frames_dropped_during_clip: a1.framesDroppedDuringClip,
|
|
clip_duration_setting: ClipsStore.getSettings().clipsLength,
|
|
clip_duration: a1.clipDuration,
|
|
clip_resolution_width: a1.clipResolutionWidth,
|
|
clip_resolution_height: a1.clipResolutionHeight,
|
|
min_fps: a1.minFps,
|
|
max_fps: a1.maxFps,
|
|
submitted_fps: a1.submittedFps,
|
|
target_fps: ApplicationStreamingSettingsStore.getState().fps,
|
|
audio_track_count: a1.audioTrackCount,
|
|
saved_at: a1.savedAt
|
|
};
|
|
}
|