[
	{
		"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"
			}
		}
	}
]
