@volter/twin-livekit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +106 -0
  3. package/dist/src/cli.d.ts +2 -0
  4. package/dist/src/cli.js +23 -0
  5. package/dist/src/egress-service-cli.d.ts +2 -0
  6. package/dist/src/egress-service-cli.js +101 -0
  7. package/dist/src/index.d.ts +14 -0
  8. package/dist/src/index.js +53 -0
  9. package/dist/src/livekit-budget.d.ts +57 -0
  10. package/dist/src/livekit-budget.js +131 -0
  11. package/dist/src/livekit-capabilities.d.ts +3 -0
  12. package/dist/src/livekit-capabilities.js +728 -0
  13. package/dist/src/livekit-conformance.d.ts +8 -0
  14. package/dist/src/livekit-conformance.js +13 -0
  15. package/dist/src/livekit-connector.d.ts +130 -0
  16. package/dist/src/livekit-connector.js +382 -0
  17. package/dist/src/livekit-data.d.ts +86 -0
  18. package/dist/src/livekit-data.js +246 -0
  19. package/dist/src/livekit-perform-harness.d.ts +5 -0
  20. package/dist/src/livekit-perform-harness.js +17 -0
  21. package/dist/src/livekit-server.d.ts +23 -0
  22. package/dist/src/livekit-server.js +45 -0
  23. package/dist/src/livekit-service-cli.d.ts +2 -0
  24. package/dist/src/livekit-service-cli.js +88 -0
  25. package/dist/src/livekit-token.d.ts +68 -0
  26. package/dist/src/livekit-token.js +76 -0
  27. package/dist/src/livekit-twin.d.ts +4 -0
  28. package/dist/src/livekit-twin.js +1161 -0
  29. package/dist/src/livekit-types.d.ts +203 -0
  30. package/dist/src/livekit-types.js +1 -0
  31. package/dist/src/livekit-webhook.d.ts +26 -0
  32. package/dist/src/livekit-webhook.js +79 -0
  33. package/dist/src/redis-service-cli.d.ts +2 -0
  34. package/dist/src/redis-service-cli.js +35 -0
  35. package/dist/test-fixtures/livekit-openapi-operations.SOURCE.md +88 -0
  36. package/dist/test-fixtures/livekit-openapi-operations.json +442 -0
  37. package/dist/test-fixtures/protobufs/cloud_replay.proto +82 -0
  38. package/dist/test-fixtures/protobufs/livekit_agent.proto +185 -0
  39. package/dist/test-fixtures/protobufs/livekit_agent_dispatch.proto +103 -0
  40. package/dist/test-fixtures/protobufs/livekit_agent_simulation.proto +422 -0
  41. package/dist/test-fixtures/protobufs/livekit_agent_worker.proto +29 -0
  42. package/dist/test-fixtures/protobufs/livekit_agentdb.proto +226 -0
  43. package/dist/test-fixtures/protobufs/livekit_analytics.proto +312 -0
  44. package/dist/test-fixtures/protobufs/livekit_cloud_agent.proto +376 -0
  45. package/dist/test-fixtures/protobufs/livekit_connector.proto +41 -0
  46. package/dist/test-fixtures/protobufs/livekit_connector_twilio.proto +65 -0
  47. package/dist/test-fixtures/protobufs/livekit_connector_whatsapp.proto +171 -0
  48. package/dist/test-fixtures/protobufs/livekit_egress.proto +641 -0
  49. package/dist/test-fixtures/protobufs/livekit_ingress.proto +222 -0
  50. package/dist/test-fixtures/protobufs/livekit_internal.proto +228 -0
  51. package/dist/test-fixtures/protobufs/livekit_metrics.proto +103 -0
  52. package/dist/test-fixtures/protobufs/livekit_models.proto +992 -0
  53. package/dist/test-fixtures/protobufs/livekit_phone_number.proto +151 -0
  54. package/dist/test-fixtures/protobufs/livekit_room.proto +312 -0
  55. package/dist/test-fixtures/protobufs/livekit_rtc.proto +673 -0
  56. package/dist/test-fixtures/protobufs/livekit_sip.proto +1000 -0
  57. package/dist/test-fixtures/protobufs/livekit_token_source.proto +49 -0
  58. package/dist/test-fixtures/protobufs/livekit_webhook.proto +62 -0
  59. package/package.json +58 -0
  60. package/src/cli.ts +22 -0
  61. package/src/egress-service-cli.ts +111 -0
  62. package/src/index.ts +103 -0
  63. package/src/livekit-budget.ts +158 -0
  64. package/src/livekit-capabilities.ts +789 -0
  65. package/src/livekit-conformance.ts +15 -0
  66. package/src/livekit-connector.ts +406 -0
  67. package/src/livekit-data.ts +278 -0
  68. package/src/livekit-perform-harness.ts +17 -0
  69. package/src/livekit-server.ts +67 -0
  70. package/src/livekit-service-cli.ts +93 -0
  71. package/src/livekit-token.ts +133 -0
  72. package/src/livekit-twin.ts +1162 -0
  73. package/src/livekit-types.ts +211 -0
  74. package/src/livekit-webhook.ts +91 -0
  75. package/src/redis-service-cli.ts +39 -0
  76. package/test-fixtures/livekit-openapi-operations.SOURCE.md +88 -0
  77. package/test-fixtures/livekit-openapi-operations.json +442 -0
  78. package/test-fixtures/protobufs/cloud_replay.proto +82 -0
  79. package/test-fixtures/protobufs/livekit_agent.proto +185 -0
  80. package/test-fixtures/protobufs/livekit_agent_dispatch.proto +103 -0
  81. package/test-fixtures/protobufs/livekit_agent_simulation.proto +422 -0
  82. package/test-fixtures/protobufs/livekit_agent_worker.proto +29 -0
  83. package/test-fixtures/protobufs/livekit_agentdb.proto +226 -0
  84. package/test-fixtures/protobufs/livekit_analytics.proto +312 -0
  85. package/test-fixtures/protobufs/livekit_cloud_agent.proto +376 -0
  86. package/test-fixtures/protobufs/livekit_connector.proto +41 -0
  87. package/test-fixtures/protobufs/livekit_connector_twilio.proto +65 -0
  88. package/test-fixtures/protobufs/livekit_connector_whatsapp.proto +171 -0
  89. package/test-fixtures/protobufs/livekit_egress.proto +641 -0
  90. package/test-fixtures/protobufs/livekit_ingress.proto +222 -0
  91. package/test-fixtures/protobufs/livekit_internal.proto +228 -0
  92. package/test-fixtures/protobufs/livekit_metrics.proto +103 -0
  93. package/test-fixtures/protobufs/livekit_models.proto +992 -0
  94. package/test-fixtures/protobufs/livekit_phone_number.proto +151 -0
  95. package/test-fixtures/protobufs/livekit_room.proto +312 -0
  96. package/test-fixtures/protobufs/livekit_rtc.proto +673 -0
  97. package/test-fixtures/protobufs/livekit_sip.proto +1000 -0
  98. package/test-fixtures/protobufs/livekit_token_source.proto +49 -0
  99. package/test-fixtures/protobufs/livekit_webhook.proto +62 -0
@@ -0,0 +1,222 @@
1
+ // Copyright 2023 LiveKit, Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ syntax = "proto3";
16
+
17
+ package livekit;
18
+
19
+ import "livekit_models.proto";
20
+ import "logger/options.proto";
21
+
22
+ option go_package = "github.com/livekit/protocol/livekit";
23
+ option csharp_namespace = "LiveKit.Proto";
24
+ option ruby_package = "LiveKit::Proto";
25
+
26
+ service Ingress {
27
+ // Create a new Ingress
28
+ rpc CreateIngress(CreateIngressRequest) returns (IngressInfo);
29
+ // Update an existing Ingress. Ingress can only be updated when it's in ENDPOINT_WAITING state.
30
+ rpc UpdateIngress(UpdateIngressRequest) returns (IngressInfo);
31
+ rpc ListIngress(ListIngressRequest) returns (ListIngressResponse);
32
+ rpc DeleteIngress(DeleteIngressRequest) returns (IngressInfo);
33
+ }
34
+
35
+ message CreateIngressRequest {
36
+ IngressInput input_type = 1;
37
+ // Where to pull media from, only for URL input type
38
+ string url = 9;
39
+ // User provided identifier for the ingress
40
+ string name = 2;
41
+ // room to publish to
42
+ string room_name = 3;
43
+ // publish as participant
44
+ string participant_identity = 4;
45
+ // name of publishing participant (used for display only)
46
+ string participant_name = 5 [(logger.sensitivity) = SENSITIVITY_PII];
47
+ // metadata associated with the publishing participant
48
+ string participant_metadata = 10 [
49
+ (logger.sensitivity) = SENSITIVITY_PII,
50
+ (logger.redact_format) = "<redacted ({{ .Size }} bytes)>"
51
+ ];
52
+ // [depreacted ] whether to pass through the incoming media without transcoding, only compatible with some input types. Use `enable_transcoding` instead.
53
+ bool bypass_transcoding = 8 [deprecated = true];
54
+ // Whether to transcode the ingested media. Only WHIP supports disabling transcoding currently. WHIP will default to transcoding disabled. Replaces `bypass_transcoding.
55
+ optional bool enable_transcoding = 11;
56
+ IngressAudioOptions audio = 6;
57
+ IngressVideoOptions video = 7;
58
+ optional bool enabled = 12; // The default value is true and when set to false, the new connection attempts will be rejected
59
+
60
+ // NEXT_ID: 13
61
+ }
62
+
63
+ enum IngressInput {
64
+ RTMP_INPUT = 0;
65
+ WHIP_INPUT = 1;
66
+ URL_INPUT = 2; // Pull from the provided URL. Only HTTP url are supported, serving either a single media file or a HLS stream
67
+ // FILE_INPUT = 3;
68
+ // SRT_INPUT = 4;
69
+ }
70
+
71
+ message IngressAudioOptions {
72
+ string name = 1;
73
+ TrackSource source = 2;
74
+ oneof encoding_options {
75
+ IngressAudioEncodingPreset preset = 3;
76
+ IngressAudioEncodingOptions options = 4;
77
+ }
78
+ }
79
+
80
+ message IngressVideoOptions {
81
+ string name = 1;
82
+ TrackSource source = 2;
83
+ oneof encoding_options {
84
+ IngressVideoEncodingPreset preset = 3;
85
+ IngressVideoEncodingOptions options = 4;
86
+ }
87
+ }
88
+
89
+ enum IngressAudioEncodingPreset {
90
+ OPUS_STEREO_96KBPS = 0; // OPUS, 2 channels, 96kbps
91
+ OPUS_MONO_64KBS = 1; // OPUS, 1 channel, 64kbps
92
+ }
93
+
94
+ enum IngressVideoEncodingPreset {
95
+ H264_720P_30FPS_3_LAYERS = 0; // 1280x720, 30fps, 1900kbps main layer, 3 layers total
96
+ H264_1080P_30FPS_3_LAYERS = 1; // 1980x1080, 30fps, 3500kbps main layer, 3 layers total
97
+ H264_540P_25FPS_2_LAYERS = 2; // 960x540, 25fps, 1000kbps main layer, 2 layers total
98
+ H264_720P_30FPS_1_LAYER = 3; // 1280x720, 30fps, 1900kbps, no simulcast
99
+ H264_1080P_30FPS_1_LAYER = 4; // 1980x1080, 30fps, 3500kbps, no simulcast
100
+ H264_720P_30FPS_3_LAYERS_HIGH_MOTION = 5; // 1280x720, 30fps, 2500kbps main layer, 3 layers total, higher bitrate for high motion, harder to encode content
101
+ H264_1080P_30FPS_3_LAYERS_HIGH_MOTION = 6; // 1980x1080, 30fps, 4500kbps main layer, 3 layers total, higher bitrate for high motion, harder to encode content
102
+ H264_540P_25FPS_2_LAYERS_HIGH_MOTION = 7; // 960x540, 25fps, 1300kbps main layer, 2 layers total, higher bitrate for high motion, harder to encode content
103
+ H264_720P_30FPS_1_LAYER_HIGH_MOTION = 8; // 1280x720, 30fps, 2500kbps, no simulcast, higher bitrate for high motion, harder to encode content
104
+ H264_1080P_30FPS_1_LAYER_HIGH_MOTION = 9; // 1980x1080, 30fps, 4500kbps, no simulcast, higher bitrate for high motion, harder to encode content
105
+ }
106
+
107
+ message IngressAudioEncodingOptions {
108
+ // desired audio codec to publish to room
109
+ AudioCodec audio_codec = 1;
110
+ uint32 bitrate = 2;
111
+ bool disable_dtx = 3;
112
+ uint32 channels = 4;
113
+ }
114
+
115
+ message IngressVideoEncodingOptions {
116
+ // desired codec to publish to room
117
+ VideoCodec video_codec = 1;
118
+ double frame_rate = 2;
119
+ // simulcast layers to publish, when empty, should usually be set to layers at 1/2 and 1/4 of the dimensions
120
+ repeated VideoLayer layers = 3;
121
+ }
122
+
123
+ message IngressInfo {
124
+ string ingress_id = 1 [(logger.name) = "ingressID"];
125
+ string name = 2;
126
+ string stream_key = 3;
127
+ string url = 4; // URL to point the encoder to for push (RTMP, WHIP), or location to pull media from for pull (URL)
128
+ // for RTMP input, it'll be a rtmp:// URL
129
+ // for FILE input, it'll be a http:// URL
130
+ // for SRT input, it'll be a srt:// URL
131
+ IngressInput input_type = 5;
132
+ bool bypass_transcoding = 13 [deprecated = true];
133
+ optional bool enable_transcoding = 15;
134
+ IngressAudioOptions audio = 6;
135
+ IngressVideoOptions video = 7;
136
+ string room_name = 8;
137
+ string participant_identity = 9;
138
+ string participant_name = 10 [(logger.sensitivity) = SENSITIVITY_PII];
139
+ string participant_metadata = 14 [
140
+ (logger.sensitivity) = SENSITIVITY_PII,
141
+ (logger.redact_format) = "<redacted ({{ .Size }} bytes)>"
142
+ ];
143
+ bool reusable = 11;
144
+ IngressState state = 12; // Description of error/stream non compliance and debug info for publisher otherwise (received bitrate, resolution, bandwidth)
145
+ optional bool enabled = 16; // The default value is true and when set to false, the new connection attempts will be rejected
146
+
147
+ // NEXT_ID: 17
148
+ }
149
+
150
+ message IngressState {
151
+ enum Status {
152
+ ENDPOINT_INACTIVE = 0;
153
+ ENDPOINT_BUFFERING = 1;
154
+ ENDPOINT_PUBLISHING = 2;
155
+ ENDPOINT_ERROR = 3;
156
+ ENDPOINT_COMPLETE = 4;
157
+ }
158
+
159
+ Status status = 1;
160
+ string error = 2; // Error/non compliance description if any
161
+ InputVideoState video = 3;
162
+ InputAudioState audio = 4;
163
+ string room_id = 5 [(logger.name) = "roomID"]; // ID of the current/previous room published to
164
+ int64 started_at = 7;
165
+ int64 ended_at = 8;
166
+ int64 updated_at = 10;
167
+ string resource_id = 9 [(logger.name) = "resourceID"];
168
+ repeated TrackInfo tracks = 6;
169
+
170
+ // next ID: 11
171
+ }
172
+
173
+ message InputVideoState {
174
+ string mime_type = 1;
175
+ uint32 average_bitrate = 2;
176
+ uint32 width = 3;
177
+ uint32 height = 4;
178
+ double framerate = 5;
179
+ }
180
+
181
+ message InputAudioState {
182
+ string mime_type = 1;
183
+ uint32 average_bitrate = 2;
184
+ uint32 channels = 3;
185
+ uint32 sample_rate = 4;
186
+ }
187
+
188
+ message UpdateIngressRequest {
189
+ string ingress_id = 1 [(logger.name) = "ingressID"];
190
+ string name = 2;
191
+ string room_name = 3;
192
+ string participant_identity = 4;
193
+ string participant_name = 5 [(logger.sensitivity) = SENSITIVITY_PII];
194
+ string participant_metadata = 9 [
195
+ (logger.sensitivity) = SENSITIVITY_PII,
196
+ (logger.redact_format) = "<redacted ({{ .Size }} bytes)>"
197
+ ];
198
+ optional bool bypass_transcoding = 8 [deprecated = true];
199
+ optional bool enable_transcoding = 10;
200
+ IngressAudioOptions audio = 6;
201
+ IngressVideoOptions video = 7;
202
+ optional bool enabled = 11; // The default value is true and when set to false, the new connection attempts will be rejected
203
+ // NEXT_ID: 12
204
+ }
205
+
206
+ message ListIngressRequest {
207
+ TokenPagination page_token = 3;
208
+ // when blank, lists all ingress endpoints
209
+ string room_name = 1; // (optional, filter by room name)
210
+ string ingress_id = 2 [(logger.name) = "ingressID"]; // (optional, filter by ingress ID)
211
+ // next field id: 4
212
+ }
213
+
214
+ message ListIngressResponse {
215
+ TokenPagination next_page_token = 2;
216
+ repeated IngressInfo items = 1;
217
+ // next field id: 3
218
+ }
219
+
220
+ message DeleteIngressRequest {
221
+ string ingress_id = 1 [(logger.name) = "ingressID"];
222
+ }
@@ -0,0 +1,228 @@
1
+ // Copyright 2023 LiveKit, Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ syntax = "proto3";
16
+
17
+ package livekit;
18
+
19
+ import "livekit_agent_dispatch.proto";
20
+ import "livekit_egress.proto";
21
+ // internal protos, not exposed to clients
22
+ import "livekit_models.proto";
23
+ import "livekit_room.proto";
24
+ import "livekit_rtc.proto";
25
+ import "logger/options.proto";
26
+
27
+ option csharp_namespace = "LiveKit.Proto";
28
+ option go_package = "github.com/livekit/protocol/livekit";
29
+ option ruby_package = "LiveKit::Proto";
30
+
31
+ enum NodeType {
32
+ SERVER = 0;
33
+ CONTROLLER = 1;
34
+ MEDIA = 2;
35
+ TURN = 4;
36
+ SWEEPER = 5;
37
+ DIRECTOR = 6;
38
+ HOSTED_AGENT = 7;
39
+ SETTINGS = 8;
40
+ }
41
+
42
+ enum NodeState {
43
+ STARTING_UP = 0;
44
+ SERVING = 1;
45
+ SHUTTING_DOWN = 2;
46
+ SUSPENDED = 3;
47
+ }
48
+
49
+ message Node {
50
+ string id = 1;
51
+ string ip = 2;
52
+ uint32 num_cpus = 3;
53
+ NodeStats stats = 4;
54
+ NodeType type = 5;
55
+ NodeState state = 6;
56
+ string region = 7;
57
+ }
58
+
59
+ message NodeStats {
60
+ // when server was started
61
+ int64 started_at = 1;
62
+ // when server last reported its status
63
+ int64 updated_at = 2;
64
+
65
+ // room
66
+ int32 num_rooms = 3;
67
+ int32 num_clients = 4;
68
+ int32 num_tracks_in = 5;
69
+ int32 num_tracks_out = 6;
70
+ int32 num_track_publish_attempts = 36;
71
+ float track_publish_attempts_per_sec = 37 [deprecated = true];
72
+ int32 num_track_publish_success = 38;
73
+ float track_publish_success_per_sec = 39 [deprecated = true];
74
+ int32 num_track_publish_cancels = 51;
75
+ int32 num_track_subscribe_attempts = 40;
76
+ float track_subscribe_attempts_per_sec = 41 [deprecated = true];
77
+ int32 num_track_subscribe_success = 42;
78
+ float track_subscribe_success_per_sec = 43 [deprecated = true];
79
+ int32 num_track_subscribe_cancels = 52;
80
+
81
+ // packet
82
+ uint64 bytes_in = 7;
83
+ uint64 bytes_out = 8;
84
+ uint64 packets_in = 9;
85
+ uint64 packets_out = 10;
86
+ uint64 nack_total = 11;
87
+ float bytes_in_per_sec = 12 [deprecated = true];
88
+ float bytes_out_per_sec = 13 [deprecated = true];
89
+ float packets_in_per_sec = 14;
90
+ float packets_out_per_sec = 15 [deprecated = true];
91
+ float nack_per_sec = 16 [deprecated = true];
92
+
93
+ // system
94
+ uint32 num_cpus = 17;
95
+ float load_avg_last1min = 18;
96
+ float load_avg_last5min = 19;
97
+ float load_avg_last15min = 20;
98
+ float cpu_load = 21;
99
+ float memory_load = 33 [deprecated = true];
100
+ uint64 memory_total = 34;
101
+ uint64 memory_used = 35;
102
+ uint32 sys_packets_out = 28;
103
+ uint32 sys_packets_dropped = 29;
104
+ float sys_packets_out_per_sec = 30 [deprecated = true];
105
+ float sys_packets_dropped_per_sec = 31 [deprecated = true];
106
+ float sys_packets_dropped_pct_per_sec = 32 [deprecated = true];
107
+
108
+ // retransmissions
109
+ uint64 retransmit_bytes_out = 22;
110
+ uint64 retransmit_packets_out = 23;
111
+ float retransmit_bytes_out_per_sec = 24 [deprecated = true];
112
+ float retransmit_packets_out_per_sec = 25 [deprecated = true];
113
+
114
+ // participant joins
115
+ uint64 participant_signal_connected = 26;
116
+ float participant_signal_connected_per_sec = 27 [deprecated = true];
117
+ uint64 participant_signal_failed = 55 [deprecated = true];
118
+ uint64 participant_signal_validation_failed = 56 [deprecated = true];
119
+ uint64 participant_rtc_connected = 44;
120
+ float participant_rtc_connected_per_sec = 45 [deprecated = true];
121
+ uint64 participant_rtc_init = 46;
122
+ float participant_rtc_init_per_sec = 47 [deprecated = true];
123
+ uint64 participant_rtc_canceled = 53;
124
+ uint64 participant_rtc_active = 54;
125
+
126
+ // forward metrics
127
+ uint32 forward_latency = 48;
128
+ uint32 forward_jitter = 49;
129
+
130
+ repeated NodeStatsRate rates = 50;
131
+
132
+ // NEXT ID: 57
133
+ }
134
+
135
+ // rates of different node stats (per second)
136
+ message NodeStatsRate {
137
+ int64 started_at = 1;
138
+ int64 ended_at = 2;
139
+ int64 duration = 3;
140
+
141
+ float track_publish_attempts = 4;
142
+ float track_publish_success = 5;
143
+ float track_publish_cancels = 24;
144
+ float track_subscribe_attempts = 6;
145
+ float track_subscribe_success = 7;
146
+ float track_subscribe_cancels = 25;
147
+
148
+ float bytes_in = 8;
149
+ float bytes_out = 9;
150
+ float packets_in = 10;
151
+ float packets_out = 11;
152
+ float nack_total = 12;
153
+
154
+ float sys_packets_out = 13;
155
+ float sys_packets_dropped = 14;
156
+
157
+ float retransmit_bytes_out = 15;
158
+ float retransmit_packets_out = 16;
159
+
160
+ float participant_signal_connected = 17;
161
+ float participant_signal_failed = 28;
162
+ float participant_signal_validation_failed = 29;
163
+ float participant_rtc_connected = 18;
164
+ float participant_rtc_init = 19;
165
+ float participant_rtc_canceled = 26;
166
+ float participant_rtc_active = 27;
167
+
168
+ // time weighted averages across stats windows forming part of a rate measurement interval
169
+ float cpu_load = 20;
170
+ float memory_load = 21;
171
+ float memory_used = 22;
172
+ float memory_total = 23;
173
+
174
+ // NEXT ID: 30
175
+ }
176
+
177
+ message StartSession {
178
+ string room_name = 1;
179
+ string identity = 2;
180
+ string connection_id = 3 [(logger.name) = "connectionID"];
181
+ // if a client is reconnecting (i.e. resume instead of restart)
182
+ bool reconnect = 4;
183
+ bool auto_subscribe = 9;
184
+ optional bool auto_subscribe_data_track = 25;
185
+ bool hidden = 10 [deprecated = true];
186
+ ClientInfo client = 11;
187
+ bool recorder = 12 [deprecated = true];
188
+ string name = 13;
189
+ // A user's ClaimGrants serialized in JSON
190
+ string grants_json = 14;
191
+ bool adaptive_stream = 15;
192
+ //if reconnect, client will set current sid
193
+ string participant_id = 16 [(logger.name) = "participantID"];
194
+ ReconnectReason reconnect_reason = 17;
195
+ optional bool subscriber_allow_pause = 18;
196
+ bool disable_ice_lite = 19;
197
+ CreateRoomRequest create_room = 20;
198
+ repeated livekit.AddTrackRequest add_track_requests = 21;
199
+ SessionDescription publisher_offer = 22;
200
+ SyncState sync_state = 23;
201
+ bool use_single_peer_connection = 24;
202
+ int64 token_expires_at = 26;
203
+
204
+ // NEXT ID: 27
205
+ }
206
+
207
+ // room info that should not be returned to clients
208
+ message RoomInternal {
209
+ AutoTrackEgress track_egress = 1;
210
+ AutoParticipantEgress participant_egress = 2;
211
+ PlayoutDelay playout_delay = 3;
212
+ repeated RoomAgentDispatch agent_dispatches = 5;
213
+ bool sync_streams = 4;
214
+ bool replay_enabled = 6;
215
+ bool export_room = 7;
216
+ map<string, string> tags = 8;
217
+ }
218
+
219
+ enum ICECandidateType {
220
+ ICT_NONE = 0;
221
+ ICT_TCP = 1;
222
+ ICT_TLS = 2;
223
+ }
224
+
225
+ message ICEConfig {
226
+ ICECandidateType preference_subscriber = 1;
227
+ ICECandidateType preference_publisher = 2;
228
+ }
@@ -0,0 +1,103 @@
1
+ syntax = "proto3";
2
+
3
+ package livekit;
4
+ option go_package = "github.com/livekit/protocol/livekit";
5
+ option csharp_namespace = "LiveKit.Proto";
6
+ option ruby_package = "LiveKit::Proto";
7
+
8
+ import "google/protobuf/timestamp.proto";
9
+ import "logger/options.proto";
10
+
11
+
12
+ /*
13
+ Protocol used to record metrics for a specific session.
14
+
15
+ Clients send their timestamp in their own monotonically increasing time (e.g `performance.now` on JS).
16
+ These timestamps are then augmented by the SFU to its time base.
17
+
18
+ A metric can be linked to a specific track by setting `track_sid`.
19
+ */
20
+
21
+
22
+ // index from [0: MAX_LABEL_PREDEFINED_MAX_VALUE) are for predefined labels (`MetricLabel`)
23
+ enum MetricLabel {
24
+ AGENTS_LLM_TTFT = 0; // time to first token from LLM
25
+ AGENTS_STT_TTFT = 1; // time to final transcription
26
+ AGENTS_TTS_TTFB = 2; // time to first byte
27
+
28
+ CLIENT_VIDEO_SUBSCRIBER_FREEZE_COUNT = 3; // Number of video freezes
29
+ CLIENT_VIDEO_SUBSCRIBER_TOTAL_FREEZE_DURATION = 4; // total duration of freezes
30
+ CLIENT_VIDEO_SUBSCRIBER_PAUSE_COUNT = 5; // number of video pauses
31
+ CLIENT_VIDEO_SUBSCRIBER_TOTAL_PAUSES_DURATION = 6; // total duration of pauses
32
+ CLIENT_AUDIO_SUBSCRIBER_CONCEALED_SAMPLES = 7; // number of concealed (synthesized) audio samples
33
+ CLIENT_AUDIO_SUBSCRIBER_SILENT_CONCEALED_SAMPLES = 8; // number of silent concealed samples
34
+ CLIENT_AUDIO_SUBSCRIBER_CONCEALMENT_EVENTS = 9; // number of concealment events
35
+ CLIENT_AUDIO_SUBSCRIBER_INTERRUPTION_COUNT = 10; // number of interruptions
36
+ CLIENT_AUDIO_SUBSCRIBER_TOTAL_INTERRUPTION_DURATION = 11; // total duration of interruptions
37
+ CLIENT_SUBSCRIBER_JITTER_BUFFER_DELAY = 12; // total time spent in jitter buffer
38
+ CLIENT_SUBSCRIBER_JITTER_BUFFER_EMITTED_COUNT = 13; // total time spent in jitter buffer
39
+ CLIENT_VIDEO_PUBLISHER_QUALITY_LIMITATION_DURATION_BANDWIDTH = 14; // total duration spent in bandwidth quality limitation
40
+ CLIENT_VIDEO_PUBLISHER_QUALITY_LIMITATION_DURATION_CPU = 15; // total duration spent in cpu quality limitation
41
+ CLIENT_VIDEO_PUBLISHER_QUALITY_LIMITATION_DURATION_OTHER = 16; // total duration spent in other quality limitation
42
+
43
+ PUBLISHER_RTT = 17; // Publisher RTT (participant -> server)
44
+ SERVER_MESH_RTT = 18; // RTT between publisher node and subscriber node (could involve intermedia node(s))
45
+ SUBSCRIBER_RTT = 19; // Subscribe RTT (server -> participant)
46
+
47
+ METRIC_LABEL_PREDEFINED_MAX_VALUE = 4096;
48
+ }
49
+
50
+ message MetricsBatch {
51
+ int64 timestamp_ms = 1; // time at which this batch is sent based on a monotonic clock (millisecond resolution)
52
+ google.protobuf.Timestamp normalized_timestamp = 2;
53
+ // To avoid repeating string values, we store them in a separate list and reference them by index
54
+ // This is useful for storing participant identities, track names, etc.
55
+ // There is also a predefined list of labels that can be used to reference common metrics.
56
+ // They have reserved indices from 0 to (METRIC_LABEL_PREDEFINED_MAX_VALUE - 1).
57
+ // Indexes pointing at str_data should start from METRIC_LABEL_PREDEFINED_MAX_VALUE,
58
+ // such that str_data[0] == index of METRIC_LABEL_PREDEFINED_MAX_VALUE.
59
+ repeated string str_data = 3;
60
+ repeated TimeSeriesMetric time_series = 4;
61
+ repeated EventMetric events = 5;
62
+ }
63
+
64
+ message TimeSeriesMetric {
65
+ // Metric name e.g "speech_probablity". The string value is not directly stored in the message, but referenced by index
66
+ // in the `str_data` field of `MetricsBatch`
67
+ uint32 label = 1;
68
+ uint32 participant_identity = 2; // index into `str_data`
69
+ uint32 track_sid = 3; // index into `str_data`
70
+ repeated MetricSample samples = 4;
71
+ uint32 rid = 5; // index into 'str_data'
72
+ }
73
+
74
+ message MetricSample {
75
+ int64 timestamp_ms = 1; // time of metric based on a monotonic clock (in milliseconds)
76
+ google.protobuf.Timestamp normalized_timestamp = 2;
77
+ float value = 3;
78
+ }
79
+
80
+ message EventMetric {
81
+ uint32 label = 1;
82
+ uint32 participant_identity = 2; // index into `str_data`
83
+ uint32 track_sid = 3; // index into `str_data`
84
+ int64 start_timestamp_ms = 4; // start time of event based on a monotonic clock (in milliseconds)
85
+ optional int64 end_timestamp_ms = 5; // end time of event based on a monotonic clock (in milliseconds), if needed
86
+ google.protobuf.Timestamp normalized_start_timestamp = 6;
87
+ optional google.protobuf.Timestamp normalized_end_timestamp = 7;
88
+ string metadata = 8;
89
+ uint32 rid = 9; // index into 'str_data'
90
+ }
91
+
92
+ message MetricsRecordingHeader {
93
+ reserved 2; // was observability field, removed in #1294
94
+ string room_id = 1 [(logger.name) = "roomID"];
95
+ uint64 duration = 3; // milliseconds
96
+ google.protobuf.Timestamp start_time = 4;
97
+ map<string, string> room_tags = 5;
98
+ string room_name = 6;
99
+ google.protobuf.Timestamp room_start_time = 7;
100
+ string job_id = 8;
101
+ bool simulated = 9; // session is a simulation; the collector skips PII redaction for it unless redaction_enabled is set
102
+ bool redaction_enabled = 10; // force PII redaction on for this session (only ever enables, never disables)
103
+ }