Add native self-hosted instance connection to fluxer_desktop

Trimmed monorepo checkout (fluxer_desktop + packages/voice_engine_v2 +
tools/ci) with a "Connect to a Different Server" menu item and popout
that lets the desktop app switch to any self-hosted Fluxer instance,
plus fixes for well-known discovery on single-domain self-hosted
deployments and a false-positive ERR_ABORTED on same-origin client
redirects during the switch. Defaults to chat.fluxr.chat and uses an
isolated userData directory from the official build.
This commit is contained in:
2026-07-01 18:22:43 -04:00
commit 682afacd30
1763 changed files with 613720 additions and 0 deletions
@@ -0,0 +1,78 @@
[
{
"name": "mirror toggle updates in place",
"input": {
"published": {"deviceId": "camera-1", "width": 1280, "height": 720, "mirror": false},
"desired": null,
"update": {"mirror": true}
},
"expectedAction": "updateEncoding",
"expectedReason": "effectsOrEncodingChanged",
"expectedMirror": true
},
{
"name": "background mode and blur strength update in place",
"input": {
"published": {"deviceId": "camera-1", "width": 1280, "height": 720, "backgroundMode": "none"},
"desired": null,
"update": {"backgroundMode": "blur", "backgroundBlurStrength": 70}
},
"expectedAction": "updateEncoding",
"expectedReason": "effectsOrEncodingChanged",
"expectedBackgroundMode": "blur"
},
{
"name": "resolution and frame rate update in place",
"input": {
"published": {"deviceId": "camera-1", "width": 1280, "height": 720, "frameRate": 30},
"desired": null,
"update": {"width": 1920, "height": 1080, "frameRate": 60}
},
"expectedAction": "updateEncoding",
"expectedReason": "effectsOrEncodingChanged",
"expectedWidth": 1920,
"expectedFrameRate": 60
},
{
"name": "device change republishes",
"input": {
"published": {"deviceId": "camera-1", "width": 1280, "height": 720},
"desired": null,
"update": {"deviceId": "camera-2"}
},
"expectedAction": "republish",
"expectedReason": "deviceChanged"
},
{
"name": "codec change republishes",
"input": {
"published": {"deviceId": "camera-1", "width": 1280, "height": 720, "codec": "vp8"},
"desired": null,
"update": {"codec": "vp9"}
},
"expectedAction": "republish",
"expectedReason": "codecChanged",
"expectedCodec": "vp9"
},
{
"name": "identical options is a no-op",
"input": {
"published": {"deviceId": "camera-1", "width": 1280, "height": 720, "mirror": true},
"desired": null,
"update": {"width": 1280, "height": 720, "mirror": true}
},
"expectedAction": "noop",
"expectedReason": "unchanged"
},
{
"name": "missing published camera rejects",
"input": {
"published": null,
"desired": null,
"update": {"mirror": true}
},
"expectedAction": "reject",
"expectedReason": "missingPublishedCamera",
"expectedErrorCode": "invalidArgument"
}
]
@@ -0,0 +1,14 @@
[
{"raw": "encrypted", "expected": "encrypted"},
{"raw": "ok", "expected": "encrypted"},
{"raw": "decryption_failed", "expected": "decryption_failed"},
{"raw": "decryptionFailed", "expected": "decryption_failed"},
{"raw": "error", "expected": "decryption_failed"},
{"raw": "broken", "expected": "decryption_failed"},
{"raw": "unencrypted", "expected": "unencrypted"},
{"raw": "missing_key", "expected": "unencrypted"},
{"raw": "missingKey", "expected": "unencrypted"},
{"raw": "internal_error", "expected": "unencrypted"},
{"raw": "unexpected", "expected": "unknown"},
{"raw": null, "expected": "unknown"}
]
@@ -0,0 +1,134 @@
[
{
"name": "invalid native addon result is unavailable",
"input": null,
"codec": "h265",
"expectedCapabilities": {
"available": false,
"backend": "none",
"compiled": false,
"runtime": false,
"codecs": [],
"zeroCopy": false,
"nativeInputs": [],
"reason": "query-failed",
"detail": "Native addon returned an invalid result"
},
"expectedNativeNvenc": false
},
{
"name": "zero-copy native NVENC H265 is usable",
"input": {
"available": true,
"backend": "nvenc",
"compiled": true,
"runtime": true,
"codecs": ["h264", "h265"],
"zeroCopy": true,
"nativeInputs": ["dmabuf"]
},
"codec": "h265",
"expectedCapabilities": {
"available": true,
"backend": "nvenc",
"compiled": true,
"runtime": true,
"codecs": ["h264", "h265"],
"zeroCopy": true,
"nativeInputs": ["dmabuf"]
},
"expectedNativeNvenc": true
},
{
"name": "HEVC codec alias enables H265 when zero-copy NVENC is available",
"input": {
"available": true,
"backend": "nvenc",
"compiled": true,
"runtime": true,
"codecs": ["hevc"],
"zeroCopy": true,
"nativeInputs": ["d3d11-texture"]
},
"codec": "h265",
"expectedCapabilities": {
"available": true,
"backend": "nvenc",
"compiled": true,
"runtime": true,
"codecs": ["hevc"],
"zeroCopy": true,
"nativeInputs": ["d3d11-texture"]
},
"expectedNativeNvenc": true
},
{
"name": "native NVENC without zero-copy is not supported",
"input": {
"available": true,
"backend": "nvenc",
"compiled": true,
"runtime": true,
"codecs": ["h264", "h265"],
"zeroCopy": false,
"nativeInputs": ["dmabuf"]
},
"codec": "h265",
"expectedCapabilities": {
"available": true,
"backend": "nvenc",
"compiled": true,
"runtime": true,
"codecs": ["h264", "h265"],
"zeroCopy": false,
"nativeInputs": ["dmabuf"]
},
"expectedNativeNvenc": false
},
{
"name": "native NVENC without native zero-copy input handles is not supported",
"input": {
"available": true,
"backend": "nvenc",
"compiled": true,
"runtime": true,
"codecs": ["h264", "h265"],
"zeroCopy": true,
"nativeInputs": []
},
"codec": "h264",
"expectedCapabilities": {
"available": true,
"backend": "nvenc",
"compiled": true,
"runtime": true,
"codecs": ["h264", "h265"],
"zeroCopy": true,
"nativeInputs": []
},
"expectedNativeNvenc": false
},
{
"name": "non-NVENC backends are not selected by NVENC policy",
"input": {
"available": true,
"backend": "videotoolbox",
"compiled": true,
"runtime": true,
"codecs": ["h264", "h265"],
"zeroCopy": true,
"nativeInputs": ["cvPixelBuffer"]
},
"codec": "h265",
"expectedCapabilities": {
"available": true,
"backend": "videotoolbox",
"compiled": true,
"runtime": true,
"codecs": ["h264", "h265"],
"zeroCopy": true,
"nativeInputs": ["cvPixelBuffer"]
},
"expectedNativeNvenc": false
}
]
@@ -0,0 +1,56 @@
[
{
"name": "camera unpublish suppressed during reconnect when video restore is pending",
"input": {"source": "camera", "enabled": false, "reconnecting": true, "restoreVideo": true, "restoreStream": false},
"expected": true
},
{
"name": "screen share unpublish suppressed during reconnect when stream restore is pending",
"input": {
"source": "screen_share",
"enabled": false,
"reconnecting": true,
"restoreVideo": false,
"restoreStream": true
},
"expected": true
},
{
"name": "publish events are not suppressed",
"input": {
"source": "screen_share",
"enabled": true,
"reconnecting": true,
"restoreVideo": false,
"restoreStream": true
},
"expected": false
},
{
"name": "inactive reconnect is not suppressed",
"input": {
"source": "screen_share",
"enabled": false,
"reconnecting": false,
"restoreVideo": false,
"restoreStream": true
},
"expected": false
},
{
"name": "camera without video restore is not suppressed",
"input": {"source": "camera", "enabled": false, "reconnecting": true, "restoreVideo": false, "restoreStream": true},
"expected": false
},
{
"name": "microphone is not suppressed",
"input": {
"source": "microphone",
"enabled": false,
"reconnecting": true,
"restoreVideo": true,
"restoreStream": true
},
"expected": false
}
]
@@ -0,0 +1,175 @@
[
{
"name": "successful operation",
"result": {"ok": true},
"requestedEnabled": true,
"expected": "none"
},
{
"name": "disabled microphone not connected",
"result": {
"ok": false,
"error": {
"code": "not-connected",
"message": "Native voice engine is not connected"
}
},
"requestedEnabled": false,
"expected": "none"
},
{
"name": "unsupported microphone capture",
"result": {
"ok": false,
"error": {
"code": "unsupported-capability",
"capability": "microphoneCapture",
"message": "Native voice engine addon does not support device microphone capture"
}
},
"requestedEnabled": true,
"expected": "crash"
},
{
"name": "invalid args",
"result": {
"ok": false,
"error": {
"code": "invalid-args",
"message": "Invalid voice-engine publish-microphone args"
}
},
"requestedEnabled": true,
"expected": "crash"
},
{
"name": "modern not connected",
"result": {
"ok": false,
"error": {
"code": "not-connected",
"capability": "microphoneCapture",
"message": "Native voice engine is not connected"
}
},
"requestedEnabled": true,
"expected": "defer"
},
{
"name": "legacy not connected",
"result": {
"ok": false,
"error": {
"code": "native-error",
"capability": "microphoneCapture",
"message": "not connected"
}
},
"requestedEnabled": true,
"expected": "defer"
},
{
"name": "device unavailable",
"result": {
"ok": false,
"error": {
"code": "native-error",
"capability": "microphoneCapture",
"message": "device unavailable"
}
},
"requestedEnabled": true,
"expected": "mute"
},
{
"name": "timeout failure defers without muting",
"result": {
"ok": false,
"error": {
"code": "timeout",
"message": "Voice engine v2 microphone enable timed out"
}
},
"requestedEnabled": true,
"expected": "defer"
},
{
"name": "cancelled failure defers without muting",
"result": {
"ok": false,
"error": {
"code": "cancelled",
"message": "Voice engine v2 microphone enable cancelled"
}
},
"requestedEnabled": true,
"expected": "defer"
},
{
"name": "livekit transport failure defers without muting",
"result": {
"ok": false,
"error": {
"code": "liveKitError",
"message": "could not establish pc connection"
}
},
"requestedEnabled": true,
"expected": "defer"
},
{
"name": "opaque failure during reconnect defers without muting",
"result": {
"ok": false,
"error": {
"code": "native-error",
"capability": "microphoneCapture",
"message": "engine resume in progress"
}
},
"requestedEnabled": true,
"context": {"reconnecting": true},
"expected": "defer"
},
{
"name": "opaque failure while stable still mutes",
"result": {
"ok": false,
"error": {
"code": "native-error",
"capability": "microphoneCapture",
"message": "engine resume in progress"
}
},
"requestedEnabled": true,
"context": {"reconnecting": false},
"expected": "mute"
},
{
"name": "invalid args during reconnect still crashes",
"result": {
"ok": false,
"error": {
"code": "invalid-args",
"message": "Invalid voice-engine publish-microphone args"
}
},
"requestedEnabled": true,
"context": {"reconnecting": true},
"expected": "crash"
},
{
"name": "disable failure during reconnect stays none",
"result": {
"ok": false,
"error": {
"code": "native-error",
"capability": "microphoneCapture",
"message": "engine resume in progress"
}
},
"requestedEnabled": false,
"context": {"reconnecting": true},
"expected": "none"
}
]
@@ -0,0 +1,98 @@
[
{
"name": "retry while accepted connection is still connecting before gateway echo",
"input": {
"connectionId": "connection-a",
"guildId": "guild-a",
"channelId": "channel-a",
"voiceState": null,
"connectionState": {
"connectionId": "connection-a",
"guildId": "guild-a",
"channelId": "channel-a",
"connecting": true,
"connected": false,
"reconnecting": false
}
},
"expected": true
},
{
"name": "retry when gateway voice state confirms channel",
"input": {
"connectionId": "connection-a",
"guildId": "guild-a",
"channelId": "channel-a",
"voiceState": {
"guild_id": "guild-a",
"channel_id": "channel-a"
},
"connectionState": {
"connectionId": "stale-connection",
"guildId": "guild-a",
"channelId": "channel-a",
"connecting": false,
"connected": false,
"reconnecting": false
}
},
"expected": true
},
{
"name": "reject stale local connection",
"input": {
"connectionId": "connection-a",
"guildId": "guild-a",
"channelId": "channel-a",
"voiceState": null,
"connectionState": {
"connectionId": "connection-b",
"guildId": "guild-a",
"channelId": "channel-a",
"connecting": true,
"connected": false,
"reconnecting": false
}
},
"expected": false
},
{
"name": "reject inactive accepted connection",
"input": {
"connectionId": "connection-a",
"guildId": "guild-a",
"channelId": "channel-a",
"voiceState": null,
"connectionState": {
"connectionId": "connection-a",
"guildId": "guild-a",
"channelId": "channel-a",
"connecting": false,
"connected": false,
"reconnecting": false
}
},
"expected": false
},
{
"name": "treat null guild ids as equivalent private voice scope",
"input": {
"connectionId": "connection-a",
"guildId": null,
"channelId": "dm-channel-a",
"voiceState": {
"guild_id": null,
"channel_id": "dm-channel-a"
},
"connectionState": {
"connectionId": "connection-b",
"guildId": null,
"channelId": "dm-channel-a",
"connecting": false,
"connected": false,
"reconnecting": false
}
},
"expected": true
}
]
@@ -0,0 +1,37 @@
[
{
"name": "local mute wins",
"input": {"userVolumePercent": 200, "outputVolumePercent": 100, "locallyMuted": true},
"expected": 0
},
{
"name": "unity gain",
"input": {"userVolumePercent": 100, "outputVolumePercent": 100, "locallyMuted": false},
"expected": 1
},
{
"name": "max user volume reaches ceiling",
"input": {"userVolumePercent": 200, "outputVolumePercent": 100, "locallyMuted": false},
"expected": 2
},
{
"name": "quiet participant below unity",
"input": {"userVolumePercent": 50, "outputVolumePercent": 100, "locallyMuted": false},
"expectedRange": {"minExclusive": 0, "maxExclusive": 1}
},
{
"name": "zero composed volume",
"input": {"userVolumePercent": 0, "outputVolumePercent": 100, "locallyMuted": false},
"expected": 0
},
{
"name": "non finite values fall back to unity inputs",
"input": {"userVolumePercent": null, "outputVolumePercent": null, "locallyMuted": false},
"expected": 1
},
{
"name": "oversized values clamp to native range",
"input": {"userVolumePercent": 999, "outputVolumePercent": 999, "locallyMuted": false},
"expectedRange": {"minInclusive": 0, "maxInclusive": 2}
}
]
@@ -0,0 +1,112 @@
[
{
"name": "dimensions and bitrate update in place",
"input": {
"published": {
"captureId": "capture-1",
"width": 1920,
"height": 1080,
"codec": "h264",
"maxFramerate": 60,
"maxBitrateBps": 8000000
},
"desired": null,
"update": {
"captureId": "capture-1",
"width": 1280,
"height": 720,
"frameRate": 30,
"maxBitrateBps": 3000000
}
},
"expectedAction": "updateEncoding",
"expectedReason": "dimensionsOrBitrateChanged",
"expectedCodec": "h264"
},
{
"name": "codec change republishes",
"input": {
"published": {
"captureId": "capture-1",
"width": 1920,
"height": 1080,
"codec": "h264"
},
"desired": null,
"update": {
"captureId": "capture-1",
"width": 1920,
"height": 1080,
"codec": "h265"
}
},
"expectedAction": "republish",
"expectedReason": "codecChanged",
"expectedCodec": "h265"
},
{
"name": "hardware encoder change republishes",
"input": {
"published": {
"captureId": "capture-1",
"width": 1920,
"height": 1080,
"codec": "h264",
"hardwareEncoding": false
},
"desired": null,
"update": {
"captureId": "capture-1",
"width": 1920,
"height": 1080,
"hardwareEncoding": true,
"zeroCopyRequired": true
}
},
"expectedAction": "republish",
"expectedReason": "hardwareEncoderChanged",
"expectedHardwareEncoding": true
},
{
"name": "zero-copy requirement change republishes",
"input": {
"published": {
"captureId": "capture-1",
"width": 1920,
"height": 1080,
"codec": "h264",
"zeroCopyRequired": false
},
"desired": null,
"update": {
"captureId": "capture-1",
"width": 1920,
"height": 1080,
"zeroCopyRequired": true
}
},
"expectedAction": "republish",
"expectedReason": "zeroCopyRequirementChanged",
"expectedZeroCopyRequired": true
},
{
"name": "capture mismatch rejects",
"input": {
"published": {
"captureId": "capture-1",
"width": 1920,
"height": 1080,
"codec": "h264"
},
"desired": null,
"update": {
"captureId": "capture-2",
"width": 1920,
"height": 1080
}
},
"expectedAction": "reject",
"expectedReason": "captureMismatch",
"expectedErrorCode": "invalidArgument"
}
]
@@ -0,0 +1,188 @@
[
{
"name": "coerces malformed sparse payload to safe defaults",
"input": {
"rttMs": "bad",
"droppedVideoFrameCallbacks": -2,
"droppedNativeVideoFrames": 3.8,
"outbound": [
null,
{
"trackSid": "",
"source": 42,
"kind": "data",
"bitrateKbps": "bad",
"packetsLost": null,
"width": 1920.9,
"framesDropped": -4.2,
"zeroCopy": false
}
],
"inbound": [
null,
{
"participantSid": "PA_1",
"trackSid": "TR_audio",
"kind": "audio",
"bitrateKbps": 42.5,
"packetsLost": 2,
"jitterMs": "bad",
"audioLevel": 0.5
}
],
"send": null
},
"expected": {
"rttMs": null,
"droppedVideoFrameCallbacks": 0,
"droppedNativeVideoFrames": 3,
"outbound": [
{
"trackSid": "",
"source": "",
"kind": "audio",
"bitrateKbps": 0,
"packetsLost": 0,
"width": 1920,
"framesDropped": 0
}
],
"inbound": [
{
"participantSid": "PA_1",
"trackSid": "TR_audio",
"kind": "audio",
"bitrateKbps": 42.5,
"packetsLost": 2,
"audioLevel": 0.5
}
],
"send": null
}
},
{
"name": "preserves native video diagnostics and clamps send stats",
"input": {
"rttMs": 27,
"droppedVideoFrameCallbacks": 2,
"outbound": [
{
"trackSid": "TR_screen",
"source": "screen",
"kind": "video",
"codec": "video/H265",
"bitrateKbps": 2500.25,
"packetsLost": 1,
"fps": 59.5,
"audioLevel": 0.1,
"width": 2176,
"height": 1200,
"sourceWidth": 2176,
"sourceHeight": 1200,
"targetBitrateKbps": 50000,
"configuredFps": 60,
"targetFps": 60,
"effectiveFps": 58.7,
"framesProduced": 120.8,
"framesAccepted": 119.4,
"framesDropped": 1.9,
"framesCoalesced": 0,
"framesCaptured": 118.2,
"captureFailures": 0,
"maxQueueAgeMs": 12.5,
"maxPushLatencyMs": 8.25,
"adaptiveSendTier": "full",
"adaptiveSendReason": "disabled",
"zeroCopy": true
}
],
"inbound": [],
"send": {
"outgoingVideoQueueDepth": 4,
"outgoingVideoQueueCapacity": 8,
"outgoingVideoMaxQueueDepth": 6,
"outgoingVideoFramesProduced": 120,
"outgoingVideoFramesAccepted": 119,
"outgoingVideoFramesDropped": 1,
"outgoingVideoFramesCoalesced": 0,
"outgoingVideoFramesCaptured": 118,
"outgoingVideoCaptureFailures": -1,
"outgoingVideoEffectiveFps": 58.7,
"outgoingVideoTargetFps": 60,
"outgoingVideoPacingTargetFps": 60,
"outgoingVideoMaxQueueAgeMs": 12.5,
"outgoingVideoMaxPushLatencyMs": 8.25,
"outgoingVideoPacingMode": "source",
"outgoingVideoBusActive": true,
"outgoingAudioBufferTargetMs": 20,
"outgoingAudioBufferMaxMs": 80,
"outgoingAudioUnderruns": 0,
"outgoingAudioRebuffers": 1,
"outgoingAudioMaxFrameGapMs": 24,
"adaptiveSendTier": "full",
"adaptiveSendReason": "disabled"
}
},
"expected": {
"rttMs": 27,
"droppedVideoFrameCallbacks": 2,
"outbound": [
{
"trackSid": "TR_screen",
"source": "screen",
"kind": "video",
"codec": "video/H265",
"bitrateKbps": 2500.25,
"packetsLost": 1,
"fps": 59.5,
"audioLevel": 0.1,
"width": 2176,
"height": 1200,
"sourceWidth": 2176,
"sourceHeight": 1200,
"targetBitrateKbps": 50000,
"configuredFps": 60,
"targetFps": 60,
"effectiveFps": 58.7,
"framesProduced": 120,
"framesAccepted": 119,
"framesDropped": 1,
"framesCoalesced": 0,
"framesCaptured": 118,
"captureFailures": 0,
"maxQueueAgeMs": 12.5,
"maxPushLatencyMs": 8.25,
"adaptiveSendTier": "full",
"adaptiveSendReason": "disabled",
"zeroCopy": true
}
],
"inbound": [],
"send": {
"outgoingVideoQueueDepth": 4,
"outgoingVideoQueueCapacity": 8,
"outgoingVideoMaxQueueDepth": 6,
"outgoingVideoFramesProduced": 120,
"outgoingVideoFramesAccepted": 119,
"outgoingVideoFramesDropped": 1,
"outgoingVideoFramesCoalesced": 0,
"outgoingVideoFramesCaptured": 118,
"outgoingVideoCaptureFailures": 0,
"outgoingVideoEffectiveFps": 58.7,
"outgoingVideoTargetFps": 60,
"outgoingVideoPacingTargetFps": 60,
"outgoingVideoMaxQueueAgeMs": 12.5,
"outgoingVideoMaxPushLatencyMs": 8.25,
"outgoingVideoPacingMode": "source",
"outgoingVideoBusActive": true,
"outgoingAudioBufferTargetMs": 20,
"outgoingAudioBufferMaxMs": 80,
"outgoingAudioUnderruns": 0,
"outgoingAudioRebuffers": 1,
"outgoingAudioMaxFrameGapMs": 24,
"adaptiveSendTier": "full",
"adaptiveSendReason": "disabled"
}
}
}
]
@@ -0,0 +1,382 @@
[
{
"name": "splits outbound camera and screen-share video by source",
"input": {
"rttMs": null,
"outbound": [
{
"trackSid": "cam",
"source": "camera",
"kind": "video",
"bitrateKbps": 500,
"packetsLost": 0,
"packetsSent": 500,
"fps": 30
},
{
"trackSid": "ss",
"source": "screen_share",
"kind": "video",
"bitrateKbps": 3000,
"packetsLost": 1,
"packetsSent": 100,
"fps": 60
}
],
"inbound": []
},
"expectedSummary": {
"network": {
"audioSendBitrateKbps": 0,
"audioRecvBitrateKbps": 0,
"videoSendBitrateKbps": 3500,
"videoRecvBitrateKbps": 0,
"audioPacketLossPercent": 0,
"videoPacketLossPercent": 1,
"jitterMs": 0,
"rttMs": null
},
"localVideo": {"trackIdentifier": "cam", "framesPerSecond": 30},
"localScreenShare": {"trackIdentifier": "ss", "framesPerSecond": 60}
}
},
{
"name": "normalizes screenshare alias without underscore",
"input": {
"rttMs": null,
"outbound": [{"trackSid": "ss", "source": "screenshare", "kind": "video", "bitrateKbps": 1000, "packetsLost": 0}],
"inbound": []
},
"expectedSummary": {
"network": {
"audioSendBitrateKbps": 0,
"audioRecvBitrateKbps": 0,
"videoSendBitrateKbps": 1000,
"videoRecvBitrateKbps": 0,
"audioPacketLossPercent": 0,
"videoPacketLossPercent": 0,
"jitterMs": 0,
"rttMs": null
},
"localVideo": null,
"localScreenShare": {"trackIdentifier": "ss"}
}
},
{
"name": "preserves native screen-share codec dimensions fps and diagnostics",
"input": {
"rttMs": 1,
"outbound": [
{
"trackSid": "TR_screen",
"source": "screenshare",
"kind": "video",
"codec": "video/H265",
"bitrateKbps": 2500,
"packetsLost": 0,
"fps": 14,
"width": 1280,
"height": 720,
"sourceWidth": 2176,
"sourceHeight": 1200,
"targetBitrateKbps": 50000,
"configuredFps": 60,
"targetFps": 60,
"effectiveFps": 58.7,
"framesProduced": 120,
"framesAccepted": 119,
"framesDropped": 1,
"framesCoalesced": 0,
"framesCaptured": 118,
"captureFailures": 0,
"maxQueueAgeMs": 12.5,
"maxPushLatencyMs": 8.25,
"adaptiveSendTier": "full",
"adaptiveSendReason": "disabled"
}
],
"inbound": []
},
"expectedSummary": {
"network": {
"audioSendBitrateKbps": 0,
"audioRecvBitrateKbps": 0,
"videoSendBitrateKbps": 2500,
"videoRecvBitrateKbps": 0,
"audioPacketLossPercent": 0,
"videoPacketLossPercent": 0,
"jitterMs": 0,
"rttMs": 1
},
"localScreenShare": {
"trackIdentifier": "TR_screen",
"codec": "video/H265",
"framesPerSecond": 58.7,
"configuredFramesPerSecond": 60,
"targetFramesPerSecond": 60,
"effectiveFramesPerSecond": 58.7,
"frameWidth": 1280,
"frameHeight": 720,
"sourceFrameWidth": 2176,
"sourceFrameHeight": 1200,
"targetBitrateKbps": 50000,
"framesProduced": 120,
"framesAccepted": 119,
"framesDropped": 1,
"framesCaptured": 118,
"maxQueueAgeMs": 12.5,
"maxPushLatencyMs": 8.25,
"adaptiveSendTier": "full",
"adaptiveSendReason": "disabled"
}
}
},
{
"name": "coalesces duplicate native outbound rows for one screen-share publication",
"input": {
"rttMs": null,
"outbound": [
{
"trackSid": "TR_screen",
"source": "screen_share",
"kind": "video",
"codec": "video/H265",
"bitrateKbps": 269.9,
"packetsLost": 0,
"fps": 3,
"effectiveFps": 53.9,
"configuredFps": 60,
"targetFps": 60,
"width": 2176,
"height": 1200,
"sourceWidth": 2176,
"sourceHeight": 1200,
"targetBitrateKbps": 50000,
"framesProduced": 1904,
"framesAccepted": 1904,
"framesDropped": 64,
"framesCoalesced": 64,
"framesCaptured": 1839,
"captureFailures": 0,
"maxQueueAgeMs": 18,
"maxPushLatencyMs": 18,
"adaptiveSendTier": "full",
"adaptiveSendReason": "adaptiveDisabled"
},
{
"trackSid": "TR_screen",
"source": "screenshare",
"kind": "video",
"codec": "video/H265",
"bitrateKbps": 4614.1,
"packetsLost": 0,
"fps": 30
}
],
"inbound": []
},
"expectedSummary": {
"network": {
"audioSendBitrateKbps": 0,
"audioRecvBitrateKbps": 0,
"videoSendBitrateKbps": 4884,
"videoRecvBitrateKbps": 0,
"audioPacketLossPercent": 0,
"videoPacketLossPercent": 0,
"jitterMs": 0,
"rttMs": null
},
"localScreenShare": {
"trackIdentifier": "TR_screen",
"codec": "video/H265",
"bitrateKbps": 4884,
"framesPerSecond": 53.9,
"configuredFramesPerSecond": 60,
"targetFramesPerSecond": 60,
"frameWidth": 2176,
"frameHeight": 1200,
"targetBitrateKbps": 50000,
"adaptiveSendTier": "full",
"adaptiveSendReason": "adaptiveDisabled"
}
}
},
{
"name": "splits screen-share audio from microphone audio",
"input": {
"rttMs": null,
"outbound": [
{"trackSid": "mic", "source": "microphone", "kind": "audio", "bitrateKbps": 48, "packetsLost": 0},
{"trackSid": "ss-audio", "source": "screen_share_audio", "kind": "audio", "bitrateKbps": 96, "packetsLost": 0}
],
"inbound": []
},
"expectedSummary": {
"network": {
"audioSendBitrateKbps": 144,
"audioRecvBitrateKbps": 0,
"videoSendBitrateKbps": 0,
"videoRecvBitrateKbps": 0,
"audioPacketLossPercent": 0,
"videoPacketLossPercent": 0,
"jitterMs": 0,
"rttMs": null
},
"localAudio": {"trackIdentifier": "mic"},
"localScreenShareAudio": {"trackIdentifier": "ss-audio"}
}
},
{
"name": "rolls up inbound audio video jitter rtt and callback drops",
"input": {
"rttMs": 25,
"droppedVideoFrameCallbacks": 3,
"outbound": [],
"inbound": [
{
"participantSid": "PA_1",
"trackSid": "a",
"kind": "audio",
"bitrateKbps": 32,
"packetsLost": 2,
"packetsReceived": 98,
"jitterMs": 8
},
{
"participantSid": "PA_1",
"trackSid": "v",
"kind": "video",
"bitrateKbps": 900,
"packetsLost": 0,
"packetsReceived": 1500
}
]
},
"expectedSummary": {
"network": {
"audioSendBitrateKbps": 0,
"audioRecvBitrateKbps": 32,
"videoSendBitrateKbps": 0,
"videoRecvBitrateKbps": 900,
"audioPacketLossPercent": 2,
"videoPacketLossPercent": 0,
"jitterMs": 8,
"rttMs": 25
},
"remoteAudio": {"trackIdentifier": "a"},
"remoteVideo": {"trackIdentifier": "v"},
"remoteScreenShare": null
}
},
{
"name": "uses worst case audio packet loss across send and receive",
"input": {
"rttMs": null,
"outbound": [
{
"trackSid": "a",
"source": "microphone",
"kind": "audio",
"bitrateKbps": 30,
"packetsLost": 5,
"packetsSent": 100
}
],
"inbound": [
{
"participantSid": "PA_1",
"trackSid": "b",
"kind": "audio",
"bitrateKbps": 30,
"packetsLost": 12,
"packetsReceived": 88
}
]
},
"expectedSummary": {
"network": {
"audioSendBitrateKbps": 30,
"audioRecvBitrateKbps": 30,
"videoSendBitrateKbps": 0,
"videoRecvBitrateKbps": 0,
"audioPacketLossPercent": 12,
"videoPacketLossPercent": 0,
"jitterMs": 0,
"rttMs": null
}
}
},
{
"name": "reports inbound video loss as a windowed percentage not a raw packet count",
"input": {
"rttMs": 1,
"outbound": [],
"inbound": [
{
"participantSid": "PA_1",
"trackSid": "v",
"kind": "video",
"bitrateKbps": 147,
"packetsLost": 13,
"packetsReceived": 4000
}
]
},
"expectedSummary": {
"network": {
"audioPacketLossPercent": 0,
"videoPacketLossPercent": 0.3,
"rttMs": 1
},
"remoteVideo": {"trackIdentifier": "v"}
}
},
{
"name": "handles empty stats as zero network and null tracks",
"input": {
"rttMs": null,
"outbound": [],
"inbound": []
},
"expectedSummary": {
"network": {
"audioSendBitrateKbps": 0,
"audioRecvBitrateKbps": 0,
"videoSendBitrateKbps": 0,
"videoRecvBitrateKbps": 0,
"audioPacketLossPercent": 0,
"videoPacketLossPercent": 0,
"jitterMs": 0,
"rttMs": null
},
"localAudio": null,
"localVideo": null,
"remoteAudio": null,
"remoteVideo": null
}
},
{
"name": "prefers first non-zero bitrate track when several candidates exist",
"input": {
"rttMs": null,
"outbound": [
{"trackSid": "silent", "source": "microphone", "kind": "audio", "bitrateKbps": 0, "packetsLost": 0},
{"trackSid": "live", "source": "microphone", "kind": "audio", "bitrateKbps": 40, "packetsLost": 0}
],
"inbound": []
},
"expectedSummary": {
"network": {
"audioSendBitrateKbps": 40,
"audioRecvBitrateKbps": 0,
"videoSendBitrateKbps": 0,
"videoRecvBitrateKbps": 0,
"audioPacketLossPercent": 0,
"videoPacketLossPercent": 0,
"jitterMs": 0,
"rttMs": null
},
"localAudio": {"trackIdentifier": "live"}
}
}
]
@@ -0,0 +1,123 @@
[
{
"name": "classifies all explicit local and remote publication ids",
"input": {
"tracks": [
{"direction": "send", "kind": "video", "trackIdentifier": "local-camera", "bitrateKbps": 500},
{"direction": "send", "kind": "audio", "trackIdentifier": "local-mic", "bitrateKbps": 48},
{"direction": "send", "kind": "video", "trackIdentifier": "local-screen", "bitrateKbps": 1200},
{"direction": "send", "kind": "audio", "trackIdentifier": "local-screen-audio", "bitrateKbps": 96},
{"direction": "recv", "kind": "audio", "trackIdentifier": "remote-mic", "bitrateKbps": 64},
{"direction": "recv", "kind": "video", "trackIdentifier": "remote-camera", "bitrateKbps": 900},
{"direction": "recv", "kind": "video", "trackIdentifier": "remote-screen", "bitrateKbps": 1800},
{"direction": "recv", "kind": "audio", "trackIdentifier": "remote-screen-audio", "bitrateKbps": 128}
],
"publications": {
"localCameraTrackId": "local-camera",
"localMicrophoneTrackId": "local-mic",
"localScreenShareTrackId": "local-screen",
"localScreenShareAudioTrackId": "local-screen-audio",
"remoteMicrophoneTrackIds": ["remote-mic"],
"remoteScreenShareTrackIds": ["remote-screen"],
"remoteScreenShareAudioTrackIds": ["remote-screen-audio"]
}
},
"expected": {
"localVideoTrackIndex": 0,
"localAudioTrackIndex": 1,
"localScreenShareTrackIndex": 2,
"localScreenShareAudioTrackIndex": 3,
"remoteVideoTrackIndex": 5,
"remoteAudioTrackIndex": 4,
"remoteScreenShareTrackIndex": 6,
"remoteScreenShareAudioTrackIndex": 7
}
},
{
"name": "falls back to rid screen-share and non-rid camera when local ids are missing",
"input": {
"tracks": [
{"direction": "send", "kind": "video", "trackIdentifier": "camera-fallback", "bitrateKbps": 700},
{"direction": "send", "kind": "video", "rid": "h", "trackIdentifier": "screen-fallback", "bitrateKbps": 1600},
{"direction": "send", "kind": "audio", "trackIdentifier": "local-mic", "bitrateKbps": 48}
],
"publications": {
"localCameraTrackId": null,
"localMicrophoneTrackId": null,
"localScreenShareTrackId": null,
"localScreenShareAudioTrackId": null,
"remoteMicrophoneTrackIds": [],
"remoteScreenShareTrackIds": [],
"remoteScreenShareAudioTrackIds": []
}
},
"expected": {
"localVideoTrackIndex": 0,
"localAudioTrackIndex": 2,
"localScreenShareTrackIndex": 1,
"localScreenShareAudioTrackIndex": null,
"remoteVideoTrackIndex": null,
"remoteAudioTrackIndex": null,
"remoteScreenShareTrackIndex": null,
"remoteScreenShareAudioTrackIndex": null
}
},
{
"name": "does not classify remote screen-share audio as remote microphone",
"input": {
"tracks": [
{"direction": "recv", "kind": "audio", "trackIdentifier": "remote-screen-audio", "bitrateKbps": 4},
{"direction": "recv", "kind": "video", "trackIdentifier": "remote-screen", "bitrateKbps": 1800}
],
"publications": {
"localCameraTrackId": null,
"localMicrophoneTrackId": null,
"localScreenShareTrackId": null,
"localScreenShareAudioTrackId": null,
"remoteMicrophoneTrackIds": [],
"remoteScreenShareTrackIds": ["remote-screen"],
"remoteScreenShareAudioTrackIds": ["remote-screen-audio"]
}
},
"expected": {
"localVideoTrackIndex": null,
"localAudioTrackIndex": null,
"localScreenShareTrackIndex": null,
"localScreenShareAudioTrackIndex": null,
"remoteVideoTrackIndex": null,
"remoteAudioTrackIndex": null,
"remoteScreenShareTrackIndex": 1,
"remoteScreenShareAudioTrackIndex": 0
}
},
{
"name": "chooses active remote screen-share and camera candidates over silent rows",
"input": {
"tracks": [
{"direction": "recv", "kind": "video", "trackIdentifier": "remote-camera-silent", "bitrateKbps": 0},
{"direction": "recv", "kind": "video", "trackIdentifier": "remote-camera-live", "bitrateKbps": 900},
{"direction": "recv", "kind": "video", "trackIdentifier": "remote-screen-silent", "bitrateKbps": 0},
{"direction": "recv", "kind": "video", "trackIdentifier": "remote-screen-live", "bitrateKbps": 1600}
],
"publications": {
"localCameraTrackId": null,
"localMicrophoneTrackId": null,
"localScreenShareTrackId": null,
"localScreenShareAudioTrackId": null,
"remoteMicrophoneTrackIds": [],
"remoteScreenShareTrackIds": ["remote-screen-silent", "remote-screen-live"],
"remoteScreenShareAudioTrackIds": []
}
},
"expected": {
"localVideoTrackIndex": null,
"localAudioTrackIndex": null,
"localScreenShareTrackIndex": null,
"localScreenShareAudioTrackIndex": null,
"remoteVideoTrackIndex": 1,
"remoteAudioTrackIndex": null,
"remoteScreenShareTrackIndex": 3,
"remoteScreenShareAudioTrackIndex": null
}
}
]