livekit-client 1.12.1 → 1.12.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. package/README.md +7 -3
  2. package/dist/livekit-client.e2ee.worker.js +1 -1
  3. package/dist/livekit-client.e2ee.worker.js.map +1 -1
  4. package/dist/livekit-client.e2ee.worker.mjs +389 -301
  5. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  6. package/dist/livekit-client.esm.mjs +11279 -13498
  7. package/dist/livekit-client.esm.mjs.map +1 -1
  8. package/dist/livekit-client.umd.js +1 -1
  9. package/dist/livekit-client.umd.js.map +1 -1
  10. package/dist/src/api/SignalClient.d.ts +2 -2
  11. package/dist/src/api/SignalClient.d.ts.map +1 -1
  12. package/dist/src/connectionHelper/ConnectionCheck.d.ts +3 -2
  13. package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
  14. package/dist/src/connectionHelper/checks/Checker.d.ts +3 -2
  15. package/dist/src/connectionHelper/checks/Checker.d.ts.map +1 -1
  16. package/dist/src/connectionHelper/checks/webrtc.d.ts.map +1 -1
  17. package/dist/src/connectionHelper/checks/websocket.d.ts.map +1 -1
  18. package/dist/src/e2ee/E2eeManager.d.ts +4 -2
  19. package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
  20. package/dist/src/e2ee/KeyProvider.d.ts +4 -2
  21. package/dist/src/e2ee/KeyProvider.d.ts.map +1 -1
  22. package/dist/src/e2ee/constants.d.ts +1 -0
  23. package/dist/src/e2ee/constants.d.ts.map +1 -1
  24. package/dist/src/e2ee/types.d.ts +1 -0
  25. package/dist/src/e2ee/types.d.ts.map +1 -1
  26. package/dist/src/e2ee/worker/FrameCryptor.d.ts +4 -2
  27. package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
  28. package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts +14 -3
  29. package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts.map +1 -1
  30. package/dist/src/index.d.ts +1 -1
  31. package/dist/src/index.d.ts.map +1 -1
  32. package/dist/src/proto/livekit_models_pb.d.ts +1264 -0
  33. package/dist/src/proto/livekit_models_pb.d.ts.map +1 -0
  34. package/dist/src/proto/livekit_rtc_pb.d.ts +1373 -0
  35. package/dist/src/proto/livekit_rtc_pb.d.ts.map +1 -0
  36. package/dist/src/room/PCTransport.d.ts +2 -1
  37. package/dist/src/room/PCTransport.d.ts.map +1 -1
  38. package/dist/src/room/RTCEngine.d.ts +9 -5
  39. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  40. package/dist/src/room/RegionUrlProvider.d.ts +4 -1
  41. package/dist/src/room/RegionUrlProvider.d.ts.map +1 -1
  42. package/dist/src/room/Room.d.ts +15 -11
  43. package/dist/src/room/Room.d.ts.map +1 -1
  44. package/dist/src/room/participant/LocalParticipant.d.ts +2 -2
  45. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  46. package/dist/src/room/participant/Participant.d.ts +5 -3
  47. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  48. package/dist/src/room/participant/ParticipantTrackPermission.d.ts +1 -1
  49. package/dist/src/room/participant/ParticipantTrackPermission.d.ts.map +1 -1
  50. package/dist/src/room/participant/RemoteParticipant.d.ts +2 -3
  51. package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
  52. package/dist/src/room/participant/publishUtils.d.ts +1 -1
  53. package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
  54. package/dist/src/room/timers.d.ts +5 -4
  55. package/dist/src/room/timers.d.ts.map +1 -1
  56. package/dist/src/room/track/LocalTrack.d.ts +3 -0
  57. package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
  58. package/dist/src/room/track/LocalTrackPublication.d.ts +1 -1
  59. package/dist/src/room/track/LocalTrackPublication.d.ts.map +1 -1
  60. package/dist/src/room/track/LocalVideoTrack.d.ts +2 -2
  61. package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
  62. package/dist/src/room/track/RemoteTrackPublication.d.ts +1 -1
  63. package/dist/src/room/track/RemoteTrackPublication.d.ts.map +1 -1
  64. package/dist/src/room/track/Track.d.ts +6 -4
  65. package/dist/src/room/track/Track.d.ts.map +1 -1
  66. package/dist/src/room/track/TrackPublication.d.ts +7 -5
  67. package/dist/src/room/track/TrackPublication.d.ts.map +1 -1
  68. package/dist/src/room/track/create.d.ts.map +1 -1
  69. package/dist/src/room/track/options.d.ts +8 -0
  70. package/dist/src/room/track/options.d.ts.map +1 -1
  71. package/dist/src/room/track/utils.d.ts +5 -1
  72. package/dist/src/room/track/utils.d.ts.map +1 -1
  73. package/dist/src/room/utils.d.ts +3 -1
  74. package/dist/src/room/utils.d.ts.map +1 -1
  75. package/dist/src/test/mocks.d.ts +4 -3
  76. package/dist/src/test/mocks.d.ts.map +1 -1
  77. package/dist/ts4.2/src/api/SignalClient.d.ts +2 -2
  78. package/dist/ts4.2/src/connectionHelper/ConnectionCheck.d.ts +3 -2
  79. package/dist/ts4.2/src/connectionHelper/checks/Checker.d.ts +3 -2
  80. package/dist/ts4.2/src/e2ee/E2eeManager.d.ts +4 -2
  81. package/dist/ts4.2/src/e2ee/KeyProvider.d.ts +4 -2
  82. package/dist/ts4.2/src/e2ee/constants.d.ts +1 -0
  83. package/dist/ts4.2/src/e2ee/types.d.ts +1 -0
  84. package/dist/ts4.2/src/e2ee/worker/FrameCryptor.d.ts +4 -2
  85. package/dist/ts4.2/src/e2ee/worker/ParticipantKeyHandler.d.ts +14 -3
  86. package/dist/ts4.2/src/index.d.ts +1 -1
  87. package/dist/ts4.2/src/proto/livekit_models_pb.d.ts +1264 -0
  88. package/dist/ts4.2/src/proto/livekit_rtc_pb.d.ts +1373 -0
  89. package/dist/ts4.2/src/room/PCTransport.d.ts +2 -1
  90. package/dist/ts4.2/src/room/RTCEngine.d.ts +9 -5
  91. package/dist/ts4.2/src/room/RegionUrlProvider.d.ts +4 -1
  92. package/dist/ts4.2/src/room/Room.d.ts +15 -11
  93. package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +2 -2
  94. package/dist/ts4.2/src/room/participant/Participant.d.ts +5 -3
  95. package/dist/ts4.2/src/room/participant/ParticipantTrackPermission.d.ts +1 -1
  96. package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +2 -3
  97. package/dist/ts4.2/src/room/participant/publishUtils.d.ts +1 -1
  98. package/dist/ts4.2/src/room/timers.d.ts +5 -4
  99. package/dist/ts4.2/src/room/track/LocalTrack.d.ts +3 -0
  100. package/dist/ts4.2/src/room/track/LocalTrackPublication.d.ts +1 -1
  101. package/dist/ts4.2/src/room/track/LocalVideoTrack.d.ts +2 -2
  102. package/dist/ts4.2/src/room/track/RemoteTrackPublication.d.ts +1 -1
  103. package/dist/ts4.2/src/room/track/Track.d.ts +6 -4
  104. package/dist/ts4.2/src/room/track/TrackPublication.d.ts +7 -5
  105. package/dist/ts4.2/src/room/track/options.d.ts +8 -0
  106. package/dist/ts4.2/src/room/track/utils.d.ts +5 -1
  107. package/dist/ts4.2/src/room/utils.d.ts +3 -1
  108. package/dist/ts4.2/src/test/mocks.d.ts +4 -3
  109. package/package.json +10 -10
  110. package/src/api/SignalClient.ts +104 -101
  111. package/src/connectionHelper/ConnectionCheck.ts +3 -2
  112. package/src/connectionHelper/checks/Checker.ts +3 -3
  113. package/src/connectionHelper/checks/webrtc.ts +66 -2
  114. package/src/connectionHelper/checks/websocket.ts +4 -0
  115. package/src/e2ee/E2eeManager.ts +4 -3
  116. package/src/e2ee/KeyProvider.ts +3 -2
  117. package/src/e2ee/constants.ts +4 -0
  118. package/src/e2ee/types.ts +1 -0
  119. package/src/e2ee/worker/FrameCryptor.test.ts +1 -3
  120. package/src/e2ee/worker/FrameCryptor.ts +5 -5
  121. package/src/e2ee/worker/ParticipantKeyHandler.ts +37 -6
  122. package/src/e2ee/worker/e2ee.worker.ts +1 -1
  123. package/src/index.ts +1 -1
  124. package/src/proto/livekit_models_pb.ts +2096 -0
  125. package/src/proto/livekit_rtc_pb.ts +2332 -0
  126. package/src/room/PCTransport.ts +1 -1
  127. package/src/room/RTCEngine.ts +28 -22
  128. package/src/room/RegionUrlProvider.ts +11 -2
  129. package/src/room/Room.test.ts +1 -0
  130. package/src/room/Room.ts +158 -79
  131. package/src/room/participant/LocalParticipant.ts +43 -59
  132. package/src/room/participant/Participant.ts +6 -4
  133. package/src/room/participant/ParticipantTrackPermission.ts +3 -3
  134. package/src/room/participant/RemoteParticipant.ts +5 -6
  135. package/src/room/participant/publishUtils.test.ts +1 -0
  136. package/src/room/participant/publishUtils.ts +4 -2
  137. package/src/room/track/LocalTrack.ts +24 -9
  138. package/src/room/track/LocalTrackPublication.ts +1 -1
  139. package/src/room/track/LocalVideoTrack.test.ts +2 -1
  140. package/src/room/track/LocalVideoTrack.ts +28 -26
  141. package/src/room/track/RemoteTrackPublication.ts +12 -7
  142. package/src/room/track/RemoteVideoTrack.test.ts +5 -4
  143. package/src/room/track/Track.ts +9 -6
  144. package/src/room/track/TrackPublication.ts +7 -5
  145. package/src/room/track/create.ts +9 -17
  146. package/src/room/track/facingMode.test.ts +1 -0
  147. package/src/room/track/options.ts +23 -16
  148. package/src/room/track/utils.test.ts +1 -0
  149. package/src/room/track/utils.ts +44 -2
  150. package/src/room/utils.test.ts +16 -0
  151. package/src/room/utils.ts +20 -4
  152. package/src/test/mocks.ts +7 -5
  153. package/src/utils/AsyncQueue.test.ts +1 -0
  154. package/src/utils/browserParser.test.ts +33 -3
  155. package/src/utils/browserParser.ts +1 -1
  156. package/dist/src/proto/google/protobuf/timestamp.d.ts +0 -146
  157. package/dist/src/proto/google/protobuf/timestamp.d.ts.map +0 -1
  158. package/dist/src/proto/livekit_models.d.ts +0 -2399
  159. package/dist/src/proto/livekit_models.d.ts.map +0 -1
  160. package/dist/src/proto/livekit_rtc.d.ts +0 -14352
  161. package/dist/src/proto/livekit_rtc.d.ts.map +0 -1
  162. package/dist/ts4.2/src/proto/google/protobuf/timestamp.d.ts +0 -150
  163. package/dist/ts4.2/src/proto/livekit_models.d.ts +0 -2659
  164. package/dist/ts4.2/src/proto/livekit_rtc.d.ts +0 -15764
  165. package/src/proto/google/protobuf/timestamp.ts +0 -230
  166. package/src/proto/livekit_models.ts +0 -4006
  167. package/src/proto/livekit_rtc.ts +0 -4672
@@ -1,4006 +0,0 @@
1
- /* eslint-disable */
2
- import Long from "long";
3
- import _m0 from "protobufjs/minimal";
4
- import { Timestamp } from "./google/protobuf/timestamp";
5
-
6
- export const protobufPackage = "livekit";
7
-
8
- export enum AudioCodec {
9
- DEFAULT_AC = 0,
10
- OPUS = 1,
11
- AAC = 2,
12
- UNRECOGNIZED = -1,
13
- }
14
-
15
- export function audioCodecFromJSON(object: any): AudioCodec {
16
- switch (object) {
17
- case 0:
18
- case "DEFAULT_AC":
19
- return AudioCodec.DEFAULT_AC;
20
- case 1:
21
- case "OPUS":
22
- return AudioCodec.OPUS;
23
- case 2:
24
- case "AAC":
25
- return AudioCodec.AAC;
26
- case -1:
27
- case "UNRECOGNIZED":
28
- default:
29
- return AudioCodec.UNRECOGNIZED;
30
- }
31
- }
32
-
33
- export function audioCodecToJSON(object: AudioCodec): string {
34
- switch (object) {
35
- case AudioCodec.DEFAULT_AC:
36
- return "DEFAULT_AC";
37
- case AudioCodec.OPUS:
38
- return "OPUS";
39
- case AudioCodec.AAC:
40
- return "AAC";
41
- case AudioCodec.UNRECOGNIZED:
42
- default:
43
- return "UNRECOGNIZED";
44
- }
45
- }
46
-
47
- export enum VideoCodec {
48
- DEFAULT_VC = 0,
49
- H264_BASELINE = 1,
50
- H264_MAIN = 2,
51
- H264_HIGH = 3,
52
- VP8 = 4,
53
- UNRECOGNIZED = -1,
54
- }
55
-
56
- export function videoCodecFromJSON(object: any): VideoCodec {
57
- switch (object) {
58
- case 0:
59
- case "DEFAULT_VC":
60
- return VideoCodec.DEFAULT_VC;
61
- case 1:
62
- case "H264_BASELINE":
63
- return VideoCodec.H264_BASELINE;
64
- case 2:
65
- case "H264_MAIN":
66
- return VideoCodec.H264_MAIN;
67
- case 3:
68
- case "H264_HIGH":
69
- return VideoCodec.H264_HIGH;
70
- case 4:
71
- case "VP8":
72
- return VideoCodec.VP8;
73
- case -1:
74
- case "UNRECOGNIZED":
75
- default:
76
- return VideoCodec.UNRECOGNIZED;
77
- }
78
- }
79
-
80
- export function videoCodecToJSON(object: VideoCodec): string {
81
- switch (object) {
82
- case VideoCodec.DEFAULT_VC:
83
- return "DEFAULT_VC";
84
- case VideoCodec.H264_BASELINE:
85
- return "H264_BASELINE";
86
- case VideoCodec.H264_MAIN:
87
- return "H264_MAIN";
88
- case VideoCodec.H264_HIGH:
89
- return "H264_HIGH";
90
- case VideoCodec.VP8:
91
- return "VP8";
92
- case VideoCodec.UNRECOGNIZED:
93
- default:
94
- return "UNRECOGNIZED";
95
- }
96
- }
97
-
98
- export enum TrackType {
99
- AUDIO = 0,
100
- VIDEO = 1,
101
- DATA = 2,
102
- UNRECOGNIZED = -1,
103
- }
104
-
105
- export function trackTypeFromJSON(object: any): TrackType {
106
- switch (object) {
107
- case 0:
108
- case "AUDIO":
109
- return TrackType.AUDIO;
110
- case 1:
111
- case "VIDEO":
112
- return TrackType.VIDEO;
113
- case 2:
114
- case "DATA":
115
- return TrackType.DATA;
116
- case -1:
117
- case "UNRECOGNIZED":
118
- default:
119
- return TrackType.UNRECOGNIZED;
120
- }
121
- }
122
-
123
- export function trackTypeToJSON(object: TrackType): string {
124
- switch (object) {
125
- case TrackType.AUDIO:
126
- return "AUDIO";
127
- case TrackType.VIDEO:
128
- return "VIDEO";
129
- case TrackType.DATA:
130
- return "DATA";
131
- case TrackType.UNRECOGNIZED:
132
- default:
133
- return "UNRECOGNIZED";
134
- }
135
- }
136
-
137
- export enum TrackSource {
138
- UNKNOWN = 0,
139
- CAMERA = 1,
140
- MICROPHONE = 2,
141
- SCREEN_SHARE = 3,
142
- SCREEN_SHARE_AUDIO = 4,
143
- UNRECOGNIZED = -1,
144
- }
145
-
146
- export function trackSourceFromJSON(object: any): TrackSource {
147
- switch (object) {
148
- case 0:
149
- case "UNKNOWN":
150
- return TrackSource.UNKNOWN;
151
- case 1:
152
- case "CAMERA":
153
- return TrackSource.CAMERA;
154
- case 2:
155
- case "MICROPHONE":
156
- return TrackSource.MICROPHONE;
157
- case 3:
158
- case "SCREEN_SHARE":
159
- return TrackSource.SCREEN_SHARE;
160
- case 4:
161
- case "SCREEN_SHARE_AUDIO":
162
- return TrackSource.SCREEN_SHARE_AUDIO;
163
- case -1:
164
- case "UNRECOGNIZED":
165
- default:
166
- return TrackSource.UNRECOGNIZED;
167
- }
168
- }
169
-
170
- export function trackSourceToJSON(object: TrackSource): string {
171
- switch (object) {
172
- case TrackSource.UNKNOWN:
173
- return "UNKNOWN";
174
- case TrackSource.CAMERA:
175
- return "CAMERA";
176
- case TrackSource.MICROPHONE:
177
- return "MICROPHONE";
178
- case TrackSource.SCREEN_SHARE:
179
- return "SCREEN_SHARE";
180
- case TrackSource.SCREEN_SHARE_AUDIO:
181
- return "SCREEN_SHARE_AUDIO";
182
- case TrackSource.UNRECOGNIZED:
183
- default:
184
- return "UNRECOGNIZED";
185
- }
186
- }
187
-
188
- export enum VideoQuality {
189
- LOW = 0,
190
- MEDIUM = 1,
191
- HIGH = 2,
192
- OFF = 3,
193
- UNRECOGNIZED = -1,
194
- }
195
-
196
- export function videoQualityFromJSON(object: any): VideoQuality {
197
- switch (object) {
198
- case 0:
199
- case "LOW":
200
- return VideoQuality.LOW;
201
- case 1:
202
- case "MEDIUM":
203
- return VideoQuality.MEDIUM;
204
- case 2:
205
- case "HIGH":
206
- return VideoQuality.HIGH;
207
- case 3:
208
- case "OFF":
209
- return VideoQuality.OFF;
210
- case -1:
211
- case "UNRECOGNIZED":
212
- default:
213
- return VideoQuality.UNRECOGNIZED;
214
- }
215
- }
216
-
217
- export function videoQualityToJSON(object: VideoQuality): string {
218
- switch (object) {
219
- case VideoQuality.LOW:
220
- return "LOW";
221
- case VideoQuality.MEDIUM:
222
- return "MEDIUM";
223
- case VideoQuality.HIGH:
224
- return "HIGH";
225
- case VideoQuality.OFF:
226
- return "OFF";
227
- case VideoQuality.UNRECOGNIZED:
228
- default:
229
- return "UNRECOGNIZED";
230
- }
231
- }
232
-
233
- export enum ConnectionQuality {
234
- POOR = 0,
235
- GOOD = 1,
236
- EXCELLENT = 2,
237
- UNRECOGNIZED = -1,
238
- }
239
-
240
- export function connectionQualityFromJSON(object: any): ConnectionQuality {
241
- switch (object) {
242
- case 0:
243
- case "POOR":
244
- return ConnectionQuality.POOR;
245
- case 1:
246
- case "GOOD":
247
- return ConnectionQuality.GOOD;
248
- case 2:
249
- case "EXCELLENT":
250
- return ConnectionQuality.EXCELLENT;
251
- case -1:
252
- case "UNRECOGNIZED":
253
- default:
254
- return ConnectionQuality.UNRECOGNIZED;
255
- }
256
- }
257
-
258
- export function connectionQualityToJSON(object: ConnectionQuality): string {
259
- switch (object) {
260
- case ConnectionQuality.POOR:
261
- return "POOR";
262
- case ConnectionQuality.GOOD:
263
- return "GOOD";
264
- case ConnectionQuality.EXCELLENT:
265
- return "EXCELLENT";
266
- case ConnectionQuality.UNRECOGNIZED:
267
- default:
268
- return "UNRECOGNIZED";
269
- }
270
- }
271
-
272
- export enum ClientConfigSetting {
273
- UNSET = 0,
274
- DISABLED = 1,
275
- ENABLED = 2,
276
- UNRECOGNIZED = -1,
277
- }
278
-
279
- export function clientConfigSettingFromJSON(object: any): ClientConfigSetting {
280
- switch (object) {
281
- case 0:
282
- case "UNSET":
283
- return ClientConfigSetting.UNSET;
284
- case 1:
285
- case "DISABLED":
286
- return ClientConfigSetting.DISABLED;
287
- case 2:
288
- case "ENABLED":
289
- return ClientConfigSetting.ENABLED;
290
- case -1:
291
- case "UNRECOGNIZED":
292
- default:
293
- return ClientConfigSetting.UNRECOGNIZED;
294
- }
295
- }
296
-
297
- export function clientConfigSettingToJSON(object: ClientConfigSetting): string {
298
- switch (object) {
299
- case ClientConfigSetting.UNSET:
300
- return "UNSET";
301
- case ClientConfigSetting.DISABLED:
302
- return "DISABLED";
303
- case ClientConfigSetting.ENABLED:
304
- return "ENABLED";
305
- case ClientConfigSetting.UNRECOGNIZED:
306
- default:
307
- return "UNRECOGNIZED";
308
- }
309
- }
310
-
311
- export enum DisconnectReason {
312
- UNKNOWN_REASON = 0,
313
- CLIENT_INITIATED = 1,
314
- DUPLICATE_IDENTITY = 2,
315
- SERVER_SHUTDOWN = 3,
316
- PARTICIPANT_REMOVED = 4,
317
- ROOM_DELETED = 5,
318
- STATE_MISMATCH = 6,
319
- JOIN_FAILURE = 7,
320
- UNRECOGNIZED = -1,
321
- }
322
-
323
- export function disconnectReasonFromJSON(object: any): DisconnectReason {
324
- switch (object) {
325
- case 0:
326
- case "UNKNOWN_REASON":
327
- return DisconnectReason.UNKNOWN_REASON;
328
- case 1:
329
- case "CLIENT_INITIATED":
330
- return DisconnectReason.CLIENT_INITIATED;
331
- case 2:
332
- case "DUPLICATE_IDENTITY":
333
- return DisconnectReason.DUPLICATE_IDENTITY;
334
- case 3:
335
- case "SERVER_SHUTDOWN":
336
- return DisconnectReason.SERVER_SHUTDOWN;
337
- case 4:
338
- case "PARTICIPANT_REMOVED":
339
- return DisconnectReason.PARTICIPANT_REMOVED;
340
- case 5:
341
- case "ROOM_DELETED":
342
- return DisconnectReason.ROOM_DELETED;
343
- case 6:
344
- case "STATE_MISMATCH":
345
- return DisconnectReason.STATE_MISMATCH;
346
- case 7:
347
- case "JOIN_FAILURE":
348
- return DisconnectReason.JOIN_FAILURE;
349
- case -1:
350
- case "UNRECOGNIZED":
351
- default:
352
- return DisconnectReason.UNRECOGNIZED;
353
- }
354
- }
355
-
356
- export function disconnectReasonToJSON(object: DisconnectReason): string {
357
- switch (object) {
358
- case DisconnectReason.UNKNOWN_REASON:
359
- return "UNKNOWN_REASON";
360
- case DisconnectReason.CLIENT_INITIATED:
361
- return "CLIENT_INITIATED";
362
- case DisconnectReason.DUPLICATE_IDENTITY:
363
- return "DUPLICATE_IDENTITY";
364
- case DisconnectReason.SERVER_SHUTDOWN:
365
- return "SERVER_SHUTDOWN";
366
- case DisconnectReason.PARTICIPANT_REMOVED:
367
- return "PARTICIPANT_REMOVED";
368
- case DisconnectReason.ROOM_DELETED:
369
- return "ROOM_DELETED";
370
- case DisconnectReason.STATE_MISMATCH:
371
- return "STATE_MISMATCH";
372
- case DisconnectReason.JOIN_FAILURE:
373
- return "JOIN_FAILURE";
374
- case DisconnectReason.UNRECOGNIZED:
375
- default:
376
- return "UNRECOGNIZED";
377
- }
378
- }
379
-
380
- export enum ReconnectReason {
381
- RR_UNKNOWN = 0,
382
- RR_SIGNAL_DISCONNECTED = 1,
383
- RR_PUBLISHER_FAILED = 2,
384
- RR_SUBSCRIBER_FAILED = 3,
385
- RR_SWITCH_CANDIDATE = 4,
386
- UNRECOGNIZED = -1,
387
- }
388
-
389
- export function reconnectReasonFromJSON(object: any): ReconnectReason {
390
- switch (object) {
391
- case 0:
392
- case "RR_UNKNOWN":
393
- return ReconnectReason.RR_UNKNOWN;
394
- case 1:
395
- case "RR_SIGNAL_DISCONNECTED":
396
- return ReconnectReason.RR_SIGNAL_DISCONNECTED;
397
- case 2:
398
- case "RR_PUBLISHER_FAILED":
399
- return ReconnectReason.RR_PUBLISHER_FAILED;
400
- case 3:
401
- case "RR_SUBSCRIBER_FAILED":
402
- return ReconnectReason.RR_SUBSCRIBER_FAILED;
403
- case 4:
404
- case "RR_SWITCH_CANDIDATE":
405
- return ReconnectReason.RR_SWITCH_CANDIDATE;
406
- case -1:
407
- case "UNRECOGNIZED":
408
- default:
409
- return ReconnectReason.UNRECOGNIZED;
410
- }
411
- }
412
-
413
- export function reconnectReasonToJSON(object: ReconnectReason): string {
414
- switch (object) {
415
- case ReconnectReason.RR_UNKNOWN:
416
- return "RR_UNKNOWN";
417
- case ReconnectReason.RR_SIGNAL_DISCONNECTED:
418
- return "RR_SIGNAL_DISCONNECTED";
419
- case ReconnectReason.RR_PUBLISHER_FAILED:
420
- return "RR_PUBLISHER_FAILED";
421
- case ReconnectReason.RR_SUBSCRIBER_FAILED:
422
- return "RR_SUBSCRIBER_FAILED";
423
- case ReconnectReason.RR_SWITCH_CANDIDATE:
424
- return "RR_SWITCH_CANDIDATE";
425
- case ReconnectReason.UNRECOGNIZED:
426
- default:
427
- return "UNRECOGNIZED";
428
- }
429
- }
430
-
431
- export enum SubscriptionError {
432
- SE_UNKNOWN = 0,
433
- SE_CODEC_UNSUPPORTED = 1,
434
- SE_TRACK_NOTFOUND = 2,
435
- UNRECOGNIZED = -1,
436
- }
437
-
438
- export function subscriptionErrorFromJSON(object: any): SubscriptionError {
439
- switch (object) {
440
- case 0:
441
- case "SE_UNKNOWN":
442
- return SubscriptionError.SE_UNKNOWN;
443
- case 1:
444
- case "SE_CODEC_UNSUPPORTED":
445
- return SubscriptionError.SE_CODEC_UNSUPPORTED;
446
- case 2:
447
- case "SE_TRACK_NOTFOUND":
448
- return SubscriptionError.SE_TRACK_NOTFOUND;
449
- case -1:
450
- case "UNRECOGNIZED":
451
- default:
452
- return SubscriptionError.UNRECOGNIZED;
453
- }
454
- }
455
-
456
- export function subscriptionErrorToJSON(object: SubscriptionError): string {
457
- switch (object) {
458
- case SubscriptionError.SE_UNKNOWN:
459
- return "SE_UNKNOWN";
460
- case SubscriptionError.SE_CODEC_UNSUPPORTED:
461
- return "SE_CODEC_UNSUPPORTED";
462
- case SubscriptionError.SE_TRACK_NOTFOUND:
463
- return "SE_TRACK_NOTFOUND";
464
- case SubscriptionError.UNRECOGNIZED:
465
- default:
466
- return "UNRECOGNIZED";
467
- }
468
- }
469
-
470
- export interface Room {
471
- sid: string;
472
- name: string;
473
- emptyTimeout: number;
474
- maxParticipants: number;
475
- creationTime: number;
476
- turnPassword: string;
477
- enabledCodecs: Codec[];
478
- metadata: string;
479
- numParticipants: number;
480
- numPublishers: number;
481
- activeRecording: boolean;
482
- }
483
-
484
- export interface Codec {
485
- mime: string;
486
- fmtpLine: string;
487
- }
488
-
489
- export interface ParticipantPermission {
490
- /** allow participant to subscribe to other tracks in the room */
491
- canSubscribe: boolean;
492
- /** allow participant to publish new tracks to room */
493
- canPublish: boolean;
494
- /** allow participant to publish data */
495
- canPublishData: boolean;
496
- /** sources that are allowed to be published */
497
- canPublishSources: TrackSource[];
498
- /** indicates that it's hidden to others */
499
- hidden: boolean;
500
- /** indicates it's a recorder instance */
501
- recorder: boolean;
502
- /** indicates that participant can update own metadata */
503
- canUpdateMetadata: boolean;
504
- }
505
-
506
- export interface ParticipantInfo {
507
- sid: string;
508
- identity: string;
509
- state: ParticipantInfo_State;
510
- tracks: TrackInfo[];
511
- metadata: string;
512
- /** timestamp when participant joined room, in seconds */
513
- joinedAt: number;
514
- name: string;
515
- version: number;
516
- permission?: ParticipantPermission;
517
- region: string;
518
- /**
519
- * indicates the participant has an active publisher connection
520
- * and can publish to the server
521
- */
522
- isPublisher: boolean;
523
- }
524
-
525
- export enum ParticipantInfo_State {
526
- /** JOINING - websocket' connected, but not offered yet */
527
- JOINING = 0,
528
- /** JOINED - server received client offer */
529
- JOINED = 1,
530
- /** ACTIVE - ICE connectivity established */
531
- ACTIVE = 2,
532
- /** DISCONNECTED - WS disconnected */
533
- DISCONNECTED = 3,
534
- UNRECOGNIZED = -1,
535
- }
536
-
537
- export function participantInfo_StateFromJSON(object: any): ParticipantInfo_State {
538
- switch (object) {
539
- case 0:
540
- case "JOINING":
541
- return ParticipantInfo_State.JOINING;
542
- case 1:
543
- case "JOINED":
544
- return ParticipantInfo_State.JOINED;
545
- case 2:
546
- case "ACTIVE":
547
- return ParticipantInfo_State.ACTIVE;
548
- case 3:
549
- case "DISCONNECTED":
550
- return ParticipantInfo_State.DISCONNECTED;
551
- case -1:
552
- case "UNRECOGNIZED":
553
- default:
554
- return ParticipantInfo_State.UNRECOGNIZED;
555
- }
556
- }
557
-
558
- export function participantInfo_StateToJSON(object: ParticipantInfo_State): string {
559
- switch (object) {
560
- case ParticipantInfo_State.JOINING:
561
- return "JOINING";
562
- case ParticipantInfo_State.JOINED:
563
- return "JOINED";
564
- case ParticipantInfo_State.ACTIVE:
565
- return "ACTIVE";
566
- case ParticipantInfo_State.DISCONNECTED:
567
- return "DISCONNECTED";
568
- case ParticipantInfo_State.UNRECOGNIZED:
569
- default:
570
- return "UNRECOGNIZED";
571
- }
572
- }
573
-
574
- export interface Encryption {
575
- }
576
-
577
- export enum Encryption_Type {
578
- NONE = 0,
579
- GCM = 1,
580
- CUSTOM = 2,
581
- UNRECOGNIZED = -1,
582
- }
583
-
584
- export function encryption_TypeFromJSON(object: any): Encryption_Type {
585
- switch (object) {
586
- case 0:
587
- case "NONE":
588
- return Encryption_Type.NONE;
589
- case 1:
590
- case "GCM":
591
- return Encryption_Type.GCM;
592
- case 2:
593
- case "CUSTOM":
594
- return Encryption_Type.CUSTOM;
595
- case -1:
596
- case "UNRECOGNIZED":
597
- default:
598
- return Encryption_Type.UNRECOGNIZED;
599
- }
600
- }
601
-
602
- export function encryption_TypeToJSON(object: Encryption_Type): string {
603
- switch (object) {
604
- case Encryption_Type.NONE:
605
- return "NONE";
606
- case Encryption_Type.GCM:
607
- return "GCM";
608
- case Encryption_Type.CUSTOM:
609
- return "CUSTOM";
610
- case Encryption_Type.UNRECOGNIZED:
611
- default:
612
- return "UNRECOGNIZED";
613
- }
614
- }
615
-
616
- export interface SimulcastCodecInfo {
617
- mimeType: string;
618
- mid: string;
619
- cid: string;
620
- layers: VideoLayer[];
621
- }
622
-
623
- export interface TrackInfo {
624
- sid: string;
625
- type: TrackType;
626
- name: string;
627
- muted: boolean;
628
- /**
629
- * original width of video (unset for audio)
630
- * clients may receive a lower resolution version with simulcast
631
- */
632
- width: number;
633
- /** original height of video (unset for audio) */
634
- height: number;
635
- /** true if track is simulcasted */
636
- simulcast: boolean;
637
- /** true if DTX (Discontinuous Transmission) is disabled for audio */
638
- disableDtx: boolean;
639
- /** source of media */
640
- source: TrackSource;
641
- layers: VideoLayer[];
642
- /** mime type of codec */
643
- mimeType: string;
644
- mid: string;
645
- codecs: SimulcastCodecInfo[];
646
- stereo: boolean;
647
- /** true if RED (Redundant Encoding) is disabled for audio */
648
- disableRed: boolean;
649
- encryption: Encryption_Type;
650
- }
651
-
652
- /** provide information about available spatial layers */
653
- export interface VideoLayer {
654
- /** for tracks with a single layer, this should be HIGH */
655
- quality: VideoQuality;
656
- width: number;
657
- height: number;
658
- /** target bitrate in bit per second (bps), server will measure actual */
659
- bitrate: number;
660
- ssrc: number;
661
- }
662
-
663
- /** new DataPacket API */
664
- export interface DataPacket {
665
- kind: DataPacket_Kind;
666
- value?: { $case: "user"; user: UserPacket } | { $case: "speaker"; speaker: ActiveSpeakerUpdate };
667
- }
668
-
669
- export enum DataPacket_Kind {
670
- RELIABLE = 0,
671
- LOSSY = 1,
672
- UNRECOGNIZED = -1,
673
- }
674
-
675
- export function dataPacket_KindFromJSON(object: any): DataPacket_Kind {
676
- switch (object) {
677
- case 0:
678
- case "RELIABLE":
679
- return DataPacket_Kind.RELIABLE;
680
- case 1:
681
- case "LOSSY":
682
- return DataPacket_Kind.LOSSY;
683
- case -1:
684
- case "UNRECOGNIZED":
685
- default:
686
- return DataPacket_Kind.UNRECOGNIZED;
687
- }
688
- }
689
-
690
- export function dataPacket_KindToJSON(object: DataPacket_Kind): string {
691
- switch (object) {
692
- case DataPacket_Kind.RELIABLE:
693
- return "RELIABLE";
694
- case DataPacket_Kind.LOSSY:
695
- return "LOSSY";
696
- case DataPacket_Kind.UNRECOGNIZED:
697
- default:
698
- return "UNRECOGNIZED";
699
- }
700
- }
701
-
702
- export interface ActiveSpeakerUpdate {
703
- speakers: SpeakerInfo[];
704
- }
705
-
706
- export interface SpeakerInfo {
707
- sid: string;
708
- /** audio level, 0-1.0, 1 is loudest */
709
- level: number;
710
- /** true if speaker is currently active */
711
- active: boolean;
712
- }
713
-
714
- export interface UserPacket {
715
- /** participant ID of user that sent the message */
716
- participantSid: string;
717
- /** user defined payload */
718
- payload: Uint8Array;
719
- /** the ID of the participants who will receive the message (the message will be sent to all the people in the room if this variable is empty) */
720
- destinationSids: string[];
721
- /** topic under which the message was published */
722
- topic?: string | undefined;
723
- }
724
-
725
- export interface ParticipantTracks {
726
- /** participant ID of participant to whom the tracks belong */
727
- participantSid: string;
728
- trackSids: string[];
729
- }
730
-
731
- /** details about the server */
732
- export interface ServerInfo {
733
- edition: ServerInfo_Edition;
734
- version: string;
735
- protocol: number;
736
- region: string;
737
- nodeId: string;
738
- /** additional debugging information. sent only if server is in development mode */
739
- debugInfo: string;
740
- }
741
-
742
- export enum ServerInfo_Edition {
743
- Standard = 0,
744
- Cloud = 1,
745
- UNRECOGNIZED = -1,
746
- }
747
-
748
- export function serverInfo_EditionFromJSON(object: any): ServerInfo_Edition {
749
- switch (object) {
750
- case 0:
751
- case "Standard":
752
- return ServerInfo_Edition.Standard;
753
- case 1:
754
- case "Cloud":
755
- return ServerInfo_Edition.Cloud;
756
- case -1:
757
- case "UNRECOGNIZED":
758
- default:
759
- return ServerInfo_Edition.UNRECOGNIZED;
760
- }
761
- }
762
-
763
- export function serverInfo_EditionToJSON(object: ServerInfo_Edition): string {
764
- switch (object) {
765
- case ServerInfo_Edition.Standard:
766
- return "Standard";
767
- case ServerInfo_Edition.Cloud:
768
- return "Cloud";
769
- case ServerInfo_Edition.UNRECOGNIZED:
770
- default:
771
- return "UNRECOGNIZED";
772
- }
773
- }
774
-
775
- /** details about the client */
776
- export interface ClientInfo {
777
- sdk: ClientInfo_SDK;
778
- version: string;
779
- protocol: number;
780
- os: string;
781
- osVersion: string;
782
- deviceModel: string;
783
- browser: string;
784
- browserVersion: string;
785
- address: string;
786
- /** wifi, wired, cellular, vpn, empty if not known */
787
- network: string;
788
- }
789
-
790
- export enum ClientInfo_SDK {
791
- UNKNOWN = 0,
792
- JS = 1,
793
- SWIFT = 2,
794
- ANDROID = 3,
795
- FLUTTER = 4,
796
- GO = 5,
797
- UNITY = 6,
798
- REACT_NATIVE = 7,
799
- RUST = 8,
800
- UNRECOGNIZED = -1,
801
- }
802
-
803
- export function clientInfo_SDKFromJSON(object: any): ClientInfo_SDK {
804
- switch (object) {
805
- case 0:
806
- case "UNKNOWN":
807
- return ClientInfo_SDK.UNKNOWN;
808
- case 1:
809
- case "JS":
810
- return ClientInfo_SDK.JS;
811
- case 2:
812
- case "SWIFT":
813
- return ClientInfo_SDK.SWIFT;
814
- case 3:
815
- case "ANDROID":
816
- return ClientInfo_SDK.ANDROID;
817
- case 4:
818
- case "FLUTTER":
819
- return ClientInfo_SDK.FLUTTER;
820
- case 5:
821
- case "GO":
822
- return ClientInfo_SDK.GO;
823
- case 6:
824
- case "UNITY":
825
- return ClientInfo_SDK.UNITY;
826
- case 7:
827
- case "REACT_NATIVE":
828
- return ClientInfo_SDK.REACT_NATIVE;
829
- case 8:
830
- case "RUST":
831
- return ClientInfo_SDK.RUST;
832
- case -1:
833
- case "UNRECOGNIZED":
834
- default:
835
- return ClientInfo_SDK.UNRECOGNIZED;
836
- }
837
- }
838
-
839
- export function clientInfo_SDKToJSON(object: ClientInfo_SDK): string {
840
- switch (object) {
841
- case ClientInfo_SDK.UNKNOWN:
842
- return "UNKNOWN";
843
- case ClientInfo_SDK.JS:
844
- return "JS";
845
- case ClientInfo_SDK.SWIFT:
846
- return "SWIFT";
847
- case ClientInfo_SDK.ANDROID:
848
- return "ANDROID";
849
- case ClientInfo_SDK.FLUTTER:
850
- return "FLUTTER";
851
- case ClientInfo_SDK.GO:
852
- return "GO";
853
- case ClientInfo_SDK.UNITY:
854
- return "UNITY";
855
- case ClientInfo_SDK.REACT_NATIVE:
856
- return "REACT_NATIVE";
857
- case ClientInfo_SDK.RUST:
858
- return "RUST";
859
- case ClientInfo_SDK.UNRECOGNIZED:
860
- default:
861
- return "UNRECOGNIZED";
862
- }
863
- }
864
-
865
- /** server provided client configuration */
866
- export interface ClientConfiguration {
867
- video?: VideoConfiguration;
868
- screen?: VideoConfiguration;
869
- resumeConnection: ClientConfigSetting;
870
- disabledCodecs?: DisabledCodecs;
871
- forceRelay: ClientConfigSetting;
872
- }
873
-
874
- export interface VideoConfiguration {
875
- hardwareEncoder: ClientConfigSetting;
876
- }
877
-
878
- export interface DisabledCodecs {
879
- /** disabled for both publish and subscribe */
880
- codecs: Codec[];
881
- /** only disable for publish */
882
- publish: Codec[];
883
- }
884
-
885
- export interface RTPStats {
886
- startTime?: Date;
887
- endTime?: Date;
888
- duration: number;
889
- packets: number;
890
- packetRate: number;
891
- bytes: number;
892
- headerBytes: number;
893
- bitrate: number;
894
- packetsLost: number;
895
- packetLossRate: number;
896
- packetLossPercentage: number;
897
- packetsDuplicate: number;
898
- packetDuplicateRate: number;
899
- bytesDuplicate: number;
900
- headerBytesDuplicate: number;
901
- bitrateDuplicate: number;
902
- packetsPadding: number;
903
- packetPaddingRate: number;
904
- bytesPadding: number;
905
- headerBytesPadding: number;
906
- bitratePadding: number;
907
- packetsOutOfOrder: number;
908
- frames: number;
909
- frameRate: number;
910
- jitterCurrent: number;
911
- jitterMax: number;
912
- gapHistogram: { [key: number]: number };
913
- nacks: number;
914
- nackAcks: number;
915
- nackMisses: number;
916
- nackRepeated: number;
917
- plis: number;
918
- lastPli?: Date;
919
- firs: number;
920
- lastFir?: Date;
921
- rttCurrent: number;
922
- rttMax: number;
923
- keyFrames: number;
924
- lastKeyFrame?: Date;
925
- layerLockPlis: number;
926
- lastLayerLockPli?: Date;
927
- sampleRate: number;
928
- /** NEXT_ID: 44 */
929
- driftMs: number;
930
- }
931
-
932
- export interface RTPStats_GapHistogramEntry {
933
- key: number;
934
- value: number;
935
- }
936
-
937
- export interface TimedVersion {
938
- unixMicro: number;
939
- ticks: number;
940
- }
941
-
942
- function createBaseRoom(): Room {
943
- return {
944
- sid: "",
945
- name: "",
946
- emptyTimeout: 0,
947
- maxParticipants: 0,
948
- creationTime: 0,
949
- turnPassword: "",
950
- enabledCodecs: [],
951
- metadata: "",
952
- numParticipants: 0,
953
- numPublishers: 0,
954
- activeRecording: false,
955
- };
956
- }
957
-
958
- export const Room = {
959
- encode(message: Room, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
960
- if (message.sid !== "") {
961
- writer.uint32(10).string(message.sid);
962
- }
963
- if (message.name !== "") {
964
- writer.uint32(18).string(message.name);
965
- }
966
- if (message.emptyTimeout !== 0) {
967
- writer.uint32(24).uint32(message.emptyTimeout);
968
- }
969
- if (message.maxParticipants !== 0) {
970
- writer.uint32(32).uint32(message.maxParticipants);
971
- }
972
- if (message.creationTime !== 0) {
973
- writer.uint32(40).int64(message.creationTime);
974
- }
975
- if (message.turnPassword !== "") {
976
- writer.uint32(50).string(message.turnPassword);
977
- }
978
- for (const v of message.enabledCodecs) {
979
- Codec.encode(v!, writer.uint32(58).fork()).ldelim();
980
- }
981
- if (message.metadata !== "") {
982
- writer.uint32(66).string(message.metadata);
983
- }
984
- if (message.numParticipants !== 0) {
985
- writer.uint32(72).uint32(message.numParticipants);
986
- }
987
- if (message.numPublishers !== 0) {
988
- writer.uint32(88).uint32(message.numPublishers);
989
- }
990
- if (message.activeRecording === true) {
991
- writer.uint32(80).bool(message.activeRecording);
992
- }
993
- return writer;
994
- },
995
-
996
- decode(input: _m0.Reader | Uint8Array, length?: number): Room {
997
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
998
- let end = length === undefined ? reader.len : reader.pos + length;
999
- const message = createBaseRoom();
1000
- while (reader.pos < end) {
1001
- const tag = reader.uint32();
1002
- switch (tag >>> 3) {
1003
- case 1:
1004
- if (tag !== 10) {
1005
- break;
1006
- }
1007
-
1008
- message.sid = reader.string();
1009
- continue;
1010
- case 2:
1011
- if (tag !== 18) {
1012
- break;
1013
- }
1014
-
1015
- message.name = reader.string();
1016
- continue;
1017
- case 3:
1018
- if (tag !== 24) {
1019
- break;
1020
- }
1021
-
1022
- message.emptyTimeout = reader.uint32();
1023
- continue;
1024
- case 4:
1025
- if (tag !== 32) {
1026
- break;
1027
- }
1028
-
1029
- message.maxParticipants = reader.uint32();
1030
- continue;
1031
- case 5:
1032
- if (tag !== 40) {
1033
- break;
1034
- }
1035
-
1036
- message.creationTime = longToNumber(reader.int64() as Long);
1037
- continue;
1038
- case 6:
1039
- if (tag !== 50) {
1040
- break;
1041
- }
1042
-
1043
- message.turnPassword = reader.string();
1044
- continue;
1045
- case 7:
1046
- if (tag !== 58) {
1047
- break;
1048
- }
1049
-
1050
- message.enabledCodecs.push(Codec.decode(reader, reader.uint32()));
1051
- continue;
1052
- case 8:
1053
- if (tag !== 66) {
1054
- break;
1055
- }
1056
-
1057
- message.metadata = reader.string();
1058
- continue;
1059
- case 9:
1060
- if (tag !== 72) {
1061
- break;
1062
- }
1063
-
1064
- message.numParticipants = reader.uint32();
1065
- continue;
1066
- case 11:
1067
- if (tag !== 88) {
1068
- break;
1069
- }
1070
-
1071
- message.numPublishers = reader.uint32();
1072
- continue;
1073
- case 10:
1074
- if (tag !== 80) {
1075
- break;
1076
- }
1077
-
1078
- message.activeRecording = reader.bool();
1079
- continue;
1080
- }
1081
- if ((tag & 7) === 4 || tag === 0) {
1082
- break;
1083
- }
1084
- reader.skipType(tag & 7);
1085
- }
1086
- return message;
1087
- },
1088
-
1089
- fromJSON(object: any): Room {
1090
- return {
1091
- sid: isSet(object.sid) ? String(object.sid) : "",
1092
- name: isSet(object.name) ? String(object.name) : "",
1093
- emptyTimeout: isSet(object.emptyTimeout) ? Number(object.emptyTimeout) : 0,
1094
- maxParticipants: isSet(object.maxParticipants) ? Number(object.maxParticipants) : 0,
1095
- creationTime: isSet(object.creationTime) ? Number(object.creationTime) : 0,
1096
- turnPassword: isSet(object.turnPassword) ? String(object.turnPassword) : "",
1097
- enabledCodecs: Array.isArray(object?.enabledCodecs)
1098
- ? object.enabledCodecs.map((e: any) => Codec.fromJSON(e))
1099
- : [],
1100
- metadata: isSet(object.metadata) ? String(object.metadata) : "",
1101
- numParticipants: isSet(object.numParticipants) ? Number(object.numParticipants) : 0,
1102
- numPublishers: isSet(object.numPublishers) ? Number(object.numPublishers) : 0,
1103
- activeRecording: isSet(object.activeRecording) ? Boolean(object.activeRecording) : false,
1104
- };
1105
- },
1106
-
1107
- toJSON(message: Room): unknown {
1108
- const obj: any = {};
1109
- message.sid !== undefined && (obj.sid = message.sid);
1110
- message.name !== undefined && (obj.name = message.name);
1111
- message.emptyTimeout !== undefined && (obj.emptyTimeout = Math.round(message.emptyTimeout));
1112
- message.maxParticipants !== undefined && (obj.maxParticipants = Math.round(message.maxParticipants));
1113
- message.creationTime !== undefined && (obj.creationTime = Math.round(message.creationTime));
1114
- message.turnPassword !== undefined && (obj.turnPassword = message.turnPassword);
1115
- if (message.enabledCodecs) {
1116
- obj.enabledCodecs = message.enabledCodecs.map((e) => e ? Codec.toJSON(e) : undefined);
1117
- } else {
1118
- obj.enabledCodecs = [];
1119
- }
1120
- message.metadata !== undefined && (obj.metadata = message.metadata);
1121
- message.numParticipants !== undefined && (obj.numParticipants = Math.round(message.numParticipants));
1122
- message.numPublishers !== undefined && (obj.numPublishers = Math.round(message.numPublishers));
1123
- message.activeRecording !== undefined && (obj.activeRecording = message.activeRecording);
1124
- return obj;
1125
- },
1126
-
1127
- create<I extends Exact<DeepPartial<Room>, I>>(base?: I): Room {
1128
- return Room.fromPartial(base ?? {});
1129
- },
1130
-
1131
- fromPartial<I extends Exact<DeepPartial<Room>, I>>(object: I): Room {
1132
- const message = createBaseRoom();
1133
- message.sid = object.sid ?? "";
1134
- message.name = object.name ?? "";
1135
- message.emptyTimeout = object.emptyTimeout ?? 0;
1136
- message.maxParticipants = object.maxParticipants ?? 0;
1137
- message.creationTime = object.creationTime ?? 0;
1138
- message.turnPassword = object.turnPassword ?? "";
1139
- message.enabledCodecs = object.enabledCodecs?.map((e) => Codec.fromPartial(e)) || [];
1140
- message.metadata = object.metadata ?? "";
1141
- message.numParticipants = object.numParticipants ?? 0;
1142
- message.numPublishers = object.numPublishers ?? 0;
1143
- message.activeRecording = object.activeRecording ?? false;
1144
- return message;
1145
- },
1146
- };
1147
-
1148
- function createBaseCodec(): Codec {
1149
- return { mime: "", fmtpLine: "" };
1150
- }
1151
-
1152
- export const Codec = {
1153
- encode(message: Codec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
1154
- if (message.mime !== "") {
1155
- writer.uint32(10).string(message.mime);
1156
- }
1157
- if (message.fmtpLine !== "") {
1158
- writer.uint32(18).string(message.fmtpLine);
1159
- }
1160
- return writer;
1161
- },
1162
-
1163
- decode(input: _m0.Reader | Uint8Array, length?: number): Codec {
1164
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
1165
- let end = length === undefined ? reader.len : reader.pos + length;
1166
- const message = createBaseCodec();
1167
- while (reader.pos < end) {
1168
- const tag = reader.uint32();
1169
- switch (tag >>> 3) {
1170
- case 1:
1171
- if (tag !== 10) {
1172
- break;
1173
- }
1174
-
1175
- message.mime = reader.string();
1176
- continue;
1177
- case 2:
1178
- if (tag !== 18) {
1179
- break;
1180
- }
1181
-
1182
- message.fmtpLine = reader.string();
1183
- continue;
1184
- }
1185
- if ((tag & 7) === 4 || tag === 0) {
1186
- break;
1187
- }
1188
- reader.skipType(tag & 7);
1189
- }
1190
- return message;
1191
- },
1192
-
1193
- fromJSON(object: any): Codec {
1194
- return {
1195
- mime: isSet(object.mime) ? String(object.mime) : "",
1196
- fmtpLine: isSet(object.fmtpLine) ? String(object.fmtpLine) : "",
1197
- };
1198
- },
1199
-
1200
- toJSON(message: Codec): unknown {
1201
- const obj: any = {};
1202
- message.mime !== undefined && (obj.mime = message.mime);
1203
- message.fmtpLine !== undefined && (obj.fmtpLine = message.fmtpLine);
1204
- return obj;
1205
- },
1206
-
1207
- create<I extends Exact<DeepPartial<Codec>, I>>(base?: I): Codec {
1208
- return Codec.fromPartial(base ?? {});
1209
- },
1210
-
1211
- fromPartial<I extends Exact<DeepPartial<Codec>, I>>(object: I): Codec {
1212
- const message = createBaseCodec();
1213
- message.mime = object.mime ?? "";
1214
- message.fmtpLine = object.fmtpLine ?? "";
1215
- return message;
1216
- },
1217
- };
1218
-
1219
- function createBaseParticipantPermission(): ParticipantPermission {
1220
- return {
1221
- canSubscribe: false,
1222
- canPublish: false,
1223
- canPublishData: false,
1224
- canPublishSources: [],
1225
- hidden: false,
1226
- recorder: false,
1227
- canUpdateMetadata: false,
1228
- };
1229
- }
1230
-
1231
- export const ParticipantPermission = {
1232
- encode(message: ParticipantPermission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
1233
- if (message.canSubscribe === true) {
1234
- writer.uint32(8).bool(message.canSubscribe);
1235
- }
1236
- if (message.canPublish === true) {
1237
- writer.uint32(16).bool(message.canPublish);
1238
- }
1239
- if (message.canPublishData === true) {
1240
- writer.uint32(24).bool(message.canPublishData);
1241
- }
1242
- writer.uint32(74).fork();
1243
- for (const v of message.canPublishSources) {
1244
- writer.int32(v);
1245
- }
1246
- writer.ldelim();
1247
- if (message.hidden === true) {
1248
- writer.uint32(56).bool(message.hidden);
1249
- }
1250
- if (message.recorder === true) {
1251
- writer.uint32(64).bool(message.recorder);
1252
- }
1253
- if (message.canUpdateMetadata === true) {
1254
- writer.uint32(80).bool(message.canUpdateMetadata);
1255
- }
1256
- return writer;
1257
- },
1258
-
1259
- decode(input: _m0.Reader | Uint8Array, length?: number): ParticipantPermission {
1260
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
1261
- let end = length === undefined ? reader.len : reader.pos + length;
1262
- const message = createBaseParticipantPermission();
1263
- while (reader.pos < end) {
1264
- const tag = reader.uint32();
1265
- switch (tag >>> 3) {
1266
- case 1:
1267
- if (tag !== 8) {
1268
- break;
1269
- }
1270
-
1271
- message.canSubscribe = reader.bool();
1272
- continue;
1273
- case 2:
1274
- if (tag !== 16) {
1275
- break;
1276
- }
1277
-
1278
- message.canPublish = reader.bool();
1279
- continue;
1280
- case 3:
1281
- if (tag !== 24) {
1282
- break;
1283
- }
1284
-
1285
- message.canPublishData = reader.bool();
1286
- continue;
1287
- case 9:
1288
- if (tag === 72) {
1289
- message.canPublishSources.push(reader.int32() as any);
1290
-
1291
- continue;
1292
- }
1293
-
1294
- if (tag === 74) {
1295
- const end2 = reader.uint32() + reader.pos;
1296
- while (reader.pos < end2) {
1297
- message.canPublishSources.push(reader.int32() as any);
1298
- }
1299
-
1300
- continue;
1301
- }
1302
-
1303
- break;
1304
- case 7:
1305
- if (tag !== 56) {
1306
- break;
1307
- }
1308
-
1309
- message.hidden = reader.bool();
1310
- continue;
1311
- case 8:
1312
- if (tag !== 64) {
1313
- break;
1314
- }
1315
-
1316
- message.recorder = reader.bool();
1317
- continue;
1318
- case 10:
1319
- if (tag !== 80) {
1320
- break;
1321
- }
1322
-
1323
- message.canUpdateMetadata = reader.bool();
1324
- continue;
1325
- }
1326
- if ((tag & 7) === 4 || tag === 0) {
1327
- break;
1328
- }
1329
- reader.skipType(tag & 7);
1330
- }
1331
- return message;
1332
- },
1333
-
1334
- fromJSON(object: any): ParticipantPermission {
1335
- return {
1336
- canSubscribe: isSet(object.canSubscribe) ? Boolean(object.canSubscribe) : false,
1337
- canPublish: isSet(object.canPublish) ? Boolean(object.canPublish) : false,
1338
- canPublishData: isSet(object.canPublishData) ? Boolean(object.canPublishData) : false,
1339
- canPublishSources: Array.isArray(object?.canPublishSources)
1340
- ? object.canPublishSources.map((e: any) => trackSourceFromJSON(e))
1341
- : [],
1342
- hidden: isSet(object.hidden) ? Boolean(object.hidden) : false,
1343
- recorder: isSet(object.recorder) ? Boolean(object.recorder) : false,
1344
- canUpdateMetadata: isSet(object.canUpdateMetadata) ? Boolean(object.canUpdateMetadata) : false,
1345
- };
1346
- },
1347
-
1348
- toJSON(message: ParticipantPermission): unknown {
1349
- const obj: any = {};
1350
- message.canSubscribe !== undefined && (obj.canSubscribe = message.canSubscribe);
1351
- message.canPublish !== undefined && (obj.canPublish = message.canPublish);
1352
- message.canPublishData !== undefined && (obj.canPublishData = message.canPublishData);
1353
- if (message.canPublishSources) {
1354
- obj.canPublishSources = message.canPublishSources.map((e) => trackSourceToJSON(e));
1355
- } else {
1356
- obj.canPublishSources = [];
1357
- }
1358
- message.hidden !== undefined && (obj.hidden = message.hidden);
1359
- message.recorder !== undefined && (obj.recorder = message.recorder);
1360
- message.canUpdateMetadata !== undefined && (obj.canUpdateMetadata = message.canUpdateMetadata);
1361
- return obj;
1362
- },
1363
-
1364
- create<I extends Exact<DeepPartial<ParticipantPermission>, I>>(base?: I): ParticipantPermission {
1365
- return ParticipantPermission.fromPartial(base ?? {});
1366
- },
1367
-
1368
- fromPartial<I extends Exact<DeepPartial<ParticipantPermission>, I>>(object: I): ParticipantPermission {
1369
- const message = createBaseParticipantPermission();
1370
- message.canSubscribe = object.canSubscribe ?? false;
1371
- message.canPublish = object.canPublish ?? false;
1372
- message.canPublishData = object.canPublishData ?? false;
1373
- message.canPublishSources = object.canPublishSources?.map((e) => e) || [];
1374
- message.hidden = object.hidden ?? false;
1375
- message.recorder = object.recorder ?? false;
1376
- message.canUpdateMetadata = object.canUpdateMetadata ?? false;
1377
- return message;
1378
- },
1379
- };
1380
-
1381
- function createBaseParticipantInfo(): ParticipantInfo {
1382
- return {
1383
- sid: "",
1384
- identity: "",
1385
- state: 0,
1386
- tracks: [],
1387
- metadata: "",
1388
- joinedAt: 0,
1389
- name: "",
1390
- version: 0,
1391
- permission: undefined,
1392
- region: "",
1393
- isPublisher: false,
1394
- };
1395
- }
1396
-
1397
- export const ParticipantInfo = {
1398
- encode(message: ParticipantInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
1399
- if (message.sid !== "") {
1400
- writer.uint32(10).string(message.sid);
1401
- }
1402
- if (message.identity !== "") {
1403
- writer.uint32(18).string(message.identity);
1404
- }
1405
- if (message.state !== 0) {
1406
- writer.uint32(24).int32(message.state);
1407
- }
1408
- for (const v of message.tracks) {
1409
- TrackInfo.encode(v!, writer.uint32(34).fork()).ldelim();
1410
- }
1411
- if (message.metadata !== "") {
1412
- writer.uint32(42).string(message.metadata);
1413
- }
1414
- if (message.joinedAt !== 0) {
1415
- writer.uint32(48).int64(message.joinedAt);
1416
- }
1417
- if (message.name !== "") {
1418
- writer.uint32(74).string(message.name);
1419
- }
1420
- if (message.version !== 0) {
1421
- writer.uint32(80).uint32(message.version);
1422
- }
1423
- if (message.permission !== undefined) {
1424
- ParticipantPermission.encode(message.permission, writer.uint32(90).fork()).ldelim();
1425
- }
1426
- if (message.region !== "") {
1427
- writer.uint32(98).string(message.region);
1428
- }
1429
- if (message.isPublisher === true) {
1430
- writer.uint32(104).bool(message.isPublisher);
1431
- }
1432
- return writer;
1433
- },
1434
-
1435
- decode(input: _m0.Reader | Uint8Array, length?: number): ParticipantInfo {
1436
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
1437
- let end = length === undefined ? reader.len : reader.pos + length;
1438
- const message = createBaseParticipantInfo();
1439
- while (reader.pos < end) {
1440
- const tag = reader.uint32();
1441
- switch (tag >>> 3) {
1442
- case 1:
1443
- if (tag !== 10) {
1444
- break;
1445
- }
1446
-
1447
- message.sid = reader.string();
1448
- continue;
1449
- case 2:
1450
- if (tag !== 18) {
1451
- break;
1452
- }
1453
-
1454
- message.identity = reader.string();
1455
- continue;
1456
- case 3:
1457
- if (tag !== 24) {
1458
- break;
1459
- }
1460
-
1461
- message.state = reader.int32() as any;
1462
- continue;
1463
- case 4:
1464
- if (tag !== 34) {
1465
- break;
1466
- }
1467
-
1468
- message.tracks.push(TrackInfo.decode(reader, reader.uint32()));
1469
- continue;
1470
- case 5:
1471
- if (tag !== 42) {
1472
- break;
1473
- }
1474
-
1475
- message.metadata = reader.string();
1476
- continue;
1477
- case 6:
1478
- if (tag !== 48) {
1479
- break;
1480
- }
1481
-
1482
- message.joinedAt = longToNumber(reader.int64() as Long);
1483
- continue;
1484
- case 9:
1485
- if (tag !== 74) {
1486
- break;
1487
- }
1488
-
1489
- message.name = reader.string();
1490
- continue;
1491
- case 10:
1492
- if (tag !== 80) {
1493
- break;
1494
- }
1495
-
1496
- message.version = reader.uint32();
1497
- continue;
1498
- case 11:
1499
- if (tag !== 90) {
1500
- break;
1501
- }
1502
-
1503
- message.permission = ParticipantPermission.decode(reader, reader.uint32());
1504
- continue;
1505
- case 12:
1506
- if (tag !== 98) {
1507
- break;
1508
- }
1509
-
1510
- message.region = reader.string();
1511
- continue;
1512
- case 13:
1513
- if (tag !== 104) {
1514
- break;
1515
- }
1516
-
1517
- message.isPublisher = reader.bool();
1518
- continue;
1519
- }
1520
- if ((tag & 7) === 4 || tag === 0) {
1521
- break;
1522
- }
1523
- reader.skipType(tag & 7);
1524
- }
1525
- return message;
1526
- },
1527
-
1528
- fromJSON(object: any): ParticipantInfo {
1529
- return {
1530
- sid: isSet(object.sid) ? String(object.sid) : "",
1531
- identity: isSet(object.identity) ? String(object.identity) : "",
1532
- state: isSet(object.state) ? participantInfo_StateFromJSON(object.state) : 0,
1533
- tracks: Array.isArray(object?.tracks) ? object.tracks.map((e: any) => TrackInfo.fromJSON(e)) : [],
1534
- metadata: isSet(object.metadata) ? String(object.metadata) : "",
1535
- joinedAt: isSet(object.joinedAt) ? Number(object.joinedAt) : 0,
1536
- name: isSet(object.name) ? String(object.name) : "",
1537
- version: isSet(object.version) ? Number(object.version) : 0,
1538
- permission: isSet(object.permission) ? ParticipantPermission.fromJSON(object.permission) : undefined,
1539
- region: isSet(object.region) ? String(object.region) : "",
1540
- isPublisher: isSet(object.isPublisher) ? Boolean(object.isPublisher) : false,
1541
- };
1542
- },
1543
-
1544
- toJSON(message: ParticipantInfo): unknown {
1545
- const obj: any = {};
1546
- message.sid !== undefined && (obj.sid = message.sid);
1547
- message.identity !== undefined && (obj.identity = message.identity);
1548
- message.state !== undefined && (obj.state = participantInfo_StateToJSON(message.state));
1549
- if (message.tracks) {
1550
- obj.tracks = message.tracks.map((e) => e ? TrackInfo.toJSON(e) : undefined);
1551
- } else {
1552
- obj.tracks = [];
1553
- }
1554
- message.metadata !== undefined && (obj.metadata = message.metadata);
1555
- message.joinedAt !== undefined && (obj.joinedAt = Math.round(message.joinedAt));
1556
- message.name !== undefined && (obj.name = message.name);
1557
- message.version !== undefined && (obj.version = Math.round(message.version));
1558
- message.permission !== undefined &&
1559
- (obj.permission = message.permission ? ParticipantPermission.toJSON(message.permission) : undefined);
1560
- message.region !== undefined && (obj.region = message.region);
1561
- message.isPublisher !== undefined && (obj.isPublisher = message.isPublisher);
1562
- return obj;
1563
- },
1564
-
1565
- create<I extends Exact<DeepPartial<ParticipantInfo>, I>>(base?: I): ParticipantInfo {
1566
- return ParticipantInfo.fromPartial(base ?? {});
1567
- },
1568
-
1569
- fromPartial<I extends Exact<DeepPartial<ParticipantInfo>, I>>(object: I): ParticipantInfo {
1570
- const message = createBaseParticipantInfo();
1571
- message.sid = object.sid ?? "";
1572
- message.identity = object.identity ?? "";
1573
- message.state = object.state ?? 0;
1574
- message.tracks = object.tracks?.map((e) => TrackInfo.fromPartial(e)) || [];
1575
- message.metadata = object.metadata ?? "";
1576
- message.joinedAt = object.joinedAt ?? 0;
1577
- message.name = object.name ?? "";
1578
- message.version = object.version ?? 0;
1579
- message.permission = (object.permission !== undefined && object.permission !== null)
1580
- ? ParticipantPermission.fromPartial(object.permission)
1581
- : undefined;
1582
- message.region = object.region ?? "";
1583
- message.isPublisher = object.isPublisher ?? false;
1584
- return message;
1585
- },
1586
- };
1587
-
1588
- function createBaseEncryption(): Encryption {
1589
- return {};
1590
- }
1591
-
1592
- export const Encryption = {
1593
- encode(_: Encryption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
1594
- return writer;
1595
- },
1596
-
1597
- decode(input: _m0.Reader | Uint8Array, length?: number): Encryption {
1598
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
1599
- let end = length === undefined ? reader.len : reader.pos + length;
1600
- const message = createBaseEncryption();
1601
- while (reader.pos < end) {
1602
- const tag = reader.uint32();
1603
- switch (tag >>> 3) {
1604
- }
1605
- if ((tag & 7) === 4 || tag === 0) {
1606
- break;
1607
- }
1608
- reader.skipType(tag & 7);
1609
- }
1610
- return message;
1611
- },
1612
-
1613
- fromJSON(_: any): Encryption {
1614
- return {};
1615
- },
1616
-
1617
- toJSON(_: Encryption): unknown {
1618
- const obj: any = {};
1619
- return obj;
1620
- },
1621
-
1622
- create<I extends Exact<DeepPartial<Encryption>, I>>(base?: I): Encryption {
1623
- return Encryption.fromPartial(base ?? {});
1624
- },
1625
-
1626
- fromPartial<I extends Exact<DeepPartial<Encryption>, I>>(_: I): Encryption {
1627
- const message = createBaseEncryption();
1628
- return message;
1629
- },
1630
- };
1631
-
1632
- function createBaseSimulcastCodecInfo(): SimulcastCodecInfo {
1633
- return { mimeType: "", mid: "", cid: "", layers: [] };
1634
- }
1635
-
1636
- export const SimulcastCodecInfo = {
1637
- encode(message: SimulcastCodecInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
1638
- if (message.mimeType !== "") {
1639
- writer.uint32(10).string(message.mimeType);
1640
- }
1641
- if (message.mid !== "") {
1642
- writer.uint32(18).string(message.mid);
1643
- }
1644
- if (message.cid !== "") {
1645
- writer.uint32(26).string(message.cid);
1646
- }
1647
- for (const v of message.layers) {
1648
- VideoLayer.encode(v!, writer.uint32(34).fork()).ldelim();
1649
- }
1650
- return writer;
1651
- },
1652
-
1653
- decode(input: _m0.Reader | Uint8Array, length?: number): SimulcastCodecInfo {
1654
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
1655
- let end = length === undefined ? reader.len : reader.pos + length;
1656
- const message = createBaseSimulcastCodecInfo();
1657
- while (reader.pos < end) {
1658
- const tag = reader.uint32();
1659
- switch (tag >>> 3) {
1660
- case 1:
1661
- if (tag !== 10) {
1662
- break;
1663
- }
1664
-
1665
- message.mimeType = reader.string();
1666
- continue;
1667
- case 2:
1668
- if (tag !== 18) {
1669
- break;
1670
- }
1671
-
1672
- message.mid = reader.string();
1673
- continue;
1674
- case 3:
1675
- if (tag !== 26) {
1676
- break;
1677
- }
1678
-
1679
- message.cid = reader.string();
1680
- continue;
1681
- case 4:
1682
- if (tag !== 34) {
1683
- break;
1684
- }
1685
-
1686
- message.layers.push(VideoLayer.decode(reader, reader.uint32()));
1687
- continue;
1688
- }
1689
- if ((tag & 7) === 4 || tag === 0) {
1690
- break;
1691
- }
1692
- reader.skipType(tag & 7);
1693
- }
1694
- return message;
1695
- },
1696
-
1697
- fromJSON(object: any): SimulcastCodecInfo {
1698
- return {
1699
- mimeType: isSet(object.mimeType) ? String(object.mimeType) : "",
1700
- mid: isSet(object.mid) ? String(object.mid) : "",
1701
- cid: isSet(object.cid) ? String(object.cid) : "",
1702
- layers: Array.isArray(object?.layers) ? object.layers.map((e: any) => VideoLayer.fromJSON(e)) : [],
1703
- };
1704
- },
1705
-
1706
- toJSON(message: SimulcastCodecInfo): unknown {
1707
- const obj: any = {};
1708
- message.mimeType !== undefined && (obj.mimeType = message.mimeType);
1709
- message.mid !== undefined && (obj.mid = message.mid);
1710
- message.cid !== undefined && (obj.cid = message.cid);
1711
- if (message.layers) {
1712
- obj.layers = message.layers.map((e) => e ? VideoLayer.toJSON(e) : undefined);
1713
- } else {
1714
- obj.layers = [];
1715
- }
1716
- return obj;
1717
- },
1718
-
1719
- create<I extends Exact<DeepPartial<SimulcastCodecInfo>, I>>(base?: I): SimulcastCodecInfo {
1720
- return SimulcastCodecInfo.fromPartial(base ?? {});
1721
- },
1722
-
1723
- fromPartial<I extends Exact<DeepPartial<SimulcastCodecInfo>, I>>(object: I): SimulcastCodecInfo {
1724
- const message = createBaseSimulcastCodecInfo();
1725
- message.mimeType = object.mimeType ?? "";
1726
- message.mid = object.mid ?? "";
1727
- message.cid = object.cid ?? "";
1728
- message.layers = object.layers?.map((e) => VideoLayer.fromPartial(e)) || [];
1729
- return message;
1730
- },
1731
- };
1732
-
1733
- function createBaseTrackInfo(): TrackInfo {
1734
- return {
1735
- sid: "",
1736
- type: 0,
1737
- name: "",
1738
- muted: false,
1739
- width: 0,
1740
- height: 0,
1741
- simulcast: false,
1742
- disableDtx: false,
1743
- source: 0,
1744
- layers: [],
1745
- mimeType: "",
1746
- mid: "",
1747
- codecs: [],
1748
- stereo: false,
1749
- disableRed: false,
1750
- encryption: 0,
1751
- };
1752
- }
1753
-
1754
- export const TrackInfo = {
1755
- encode(message: TrackInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
1756
- if (message.sid !== "") {
1757
- writer.uint32(10).string(message.sid);
1758
- }
1759
- if (message.type !== 0) {
1760
- writer.uint32(16).int32(message.type);
1761
- }
1762
- if (message.name !== "") {
1763
- writer.uint32(26).string(message.name);
1764
- }
1765
- if (message.muted === true) {
1766
- writer.uint32(32).bool(message.muted);
1767
- }
1768
- if (message.width !== 0) {
1769
- writer.uint32(40).uint32(message.width);
1770
- }
1771
- if (message.height !== 0) {
1772
- writer.uint32(48).uint32(message.height);
1773
- }
1774
- if (message.simulcast === true) {
1775
- writer.uint32(56).bool(message.simulcast);
1776
- }
1777
- if (message.disableDtx === true) {
1778
- writer.uint32(64).bool(message.disableDtx);
1779
- }
1780
- if (message.source !== 0) {
1781
- writer.uint32(72).int32(message.source);
1782
- }
1783
- for (const v of message.layers) {
1784
- VideoLayer.encode(v!, writer.uint32(82).fork()).ldelim();
1785
- }
1786
- if (message.mimeType !== "") {
1787
- writer.uint32(90).string(message.mimeType);
1788
- }
1789
- if (message.mid !== "") {
1790
- writer.uint32(98).string(message.mid);
1791
- }
1792
- for (const v of message.codecs) {
1793
- SimulcastCodecInfo.encode(v!, writer.uint32(106).fork()).ldelim();
1794
- }
1795
- if (message.stereo === true) {
1796
- writer.uint32(112).bool(message.stereo);
1797
- }
1798
- if (message.disableRed === true) {
1799
- writer.uint32(120).bool(message.disableRed);
1800
- }
1801
- if (message.encryption !== 0) {
1802
- writer.uint32(128).int32(message.encryption);
1803
- }
1804
- return writer;
1805
- },
1806
-
1807
- decode(input: _m0.Reader | Uint8Array, length?: number): TrackInfo {
1808
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
1809
- let end = length === undefined ? reader.len : reader.pos + length;
1810
- const message = createBaseTrackInfo();
1811
- while (reader.pos < end) {
1812
- const tag = reader.uint32();
1813
- switch (tag >>> 3) {
1814
- case 1:
1815
- if (tag !== 10) {
1816
- break;
1817
- }
1818
-
1819
- message.sid = reader.string();
1820
- continue;
1821
- case 2:
1822
- if (tag !== 16) {
1823
- break;
1824
- }
1825
-
1826
- message.type = reader.int32() as any;
1827
- continue;
1828
- case 3:
1829
- if (tag !== 26) {
1830
- break;
1831
- }
1832
-
1833
- message.name = reader.string();
1834
- continue;
1835
- case 4:
1836
- if (tag !== 32) {
1837
- break;
1838
- }
1839
-
1840
- message.muted = reader.bool();
1841
- continue;
1842
- case 5:
1843
- if (tag !== 40) {
1844
- break;
1845
- }
1846
-
1847
- message.width = reader.uint32();
1848
- continue;
1849
- case 6:
1850
- if (tag !== 48) {
1851
- break;
1852
- }
1853
-
1854
- message.height = reader.uint32();
1855
- continue;
1856
- case 7:
1857
- if (tag !== 56) {
1858
- break;
1859
- }
1860
-
1861
- message.simulcast = reader.bool();
1862
- continue;
1863
- case 8:
1864
- if (tag !== 64) {
1865
- break;
1866
- }
1867
-
1868
- message.disableDtx = reader.bool();
1869
- continue;
1870
- case 9:
1871
- if (tag !== 72) {
1872
- break;
1873
- }
1874
-
1875
- message.source = reader.int32() as any;
1876
- continue;
1877
- case 10:
1878
- if (tag !== 82) {
1879
- break;
1880
- }
1881
-
1882
- message.layers.push(VideoLayer.decode(reader, reader.uint32()));
1883
- continue;
1884
- case 11:
1885
- if (tag !== 90) {
1886
- break;
1887
- }
1888
-
1889
- message.mimeType = reader.string();
1890
- continue;
1891
- case 12:
1892
- if (tag !== 98) {
1893
- break;
1894
- }
1895
-
1896
- message.mid = reader.string();
1897
- continue;
1898
- case 13:
1899
- if (tag !== 106) {
1900
- break;
1901
- }
1902
-
1903
- message.codecs.push(SimulcastCodecInfo.decode(reader, reader.uint32()));
1904
- continue;
1905
- case 14:
1906
- if (tag !== 112) {
1907
- break;
1908
- }
1909
-
1910
- message.stereo = reader.bool();
1911
- continue;
1912
- case 15:
1913
- if (tag !== 120) {
1914
- break;
1915
- }
1916
-
1917
- message.disableRed = reader.bool();
1918
- continue;
1919
- case 16:
1920
- if (tag !== 128) {
1921
- break;
1922
- }
1923
-
1924
- message.encryption = reader.int32() as any;
1925
- continue;
1926
- }
1927
- if ((tag & 7) === 4 || tag === 0) {
1928
- break;
1929
- }
1930
- reader.skipType(tag & 7);
1931
- }
1932
- return message;
1933
- },
1934
-
1935
- fromJSON(object: any): TrackInfo {
1936
- return {
1937
- sid: isSet(object.sid) ? String(object.sid) : "",
1938
- type: isSet(object.type) ? trackTypeFromJSON(object.type) : 0,
1939
- name: isSet(object.name) ? String(object.name) : "",
1940
- muted: isSet(object.muted) ? Boolean(object.muted) : false,
1941
- width: isSet(object.width) ? Number(object.width) : 0,
1942
- height: isSet(object.height) ? Number(object.height) : 0,
1943
- simulcast: isSet(object.simulcast) ? Boolean(object.simulcast) : false,
1944
- disableDtx: isSet(object.disableDtx) ? Boolean(object.disableDtx) : false,
1945
- source: isSet(object.source) ? trackSourceFromJSON(object.source) : 0,
1946
- layers: Array.isArray(object?.layers) ? object.layers.map((e: any) => VideoLayer.fromJSON(e)) : [],
1947
- mimeType: isSet(object.mimeType) ? String(object.mimeType) : "",
1948
- mid: isSet(object.mid) ? String(object.mid) : "",
1949
- codecs: Array.isArray(object?.codecs) ? object.codecs.map((e: any) => SimulcastCodecInfo.fromJSON(e)) : [],
1950
- stereo: isSet(object.stereo) ? Boolean(object.stereo) : false,
1951
- disableRed: isSet(object.disableRed) ? Boolean(object.disableRed) : false,
1952
- encryption: isSet(object.encryption) ? encryption_TypeFromJSON(object.encryption) : 0,
1953
- };
1954
- },
1955
-
1956
- toJSON(message: TrackInfo): unknown {
1957
- const obj: any = {};
1958
- message.sid !== undefined && (obj.sid = message.sid);
1959
- message.type !== undefined && (obj.type = trackTypeToJSON(message.type));
1960
- message.name !== undefined && (obj.name = message.name);
1961
- message.muted !== undefined && (obj.muted = message.muted);
1962
- message.width !== undefined && (obj.width = Math.round(message.width));
1963
- message.height !== undefined && (obj.height = Math.round(message.height));
1964
- message.simulcast !== undefined && (obj.simulcast = message.simulcast);
1965
- message.disableDtx !== undefined && (obj.disableDtx = message.disableDtx);
1966
- message.source !== undefined && (obj.source = trackSourceToJSON(message.source));
1967
- if (message.layers) {
1968
- obj.layers = message.layers.map((e) => e ? VideoLayer.toJSON(e) : undefined);
1969
- } else {
1970
- obj.layers = [];
1971
- }
1972
- message.mimeType !== undefined && (obj.mimeType = message.mimeType);
1973
- message.mid !== undefined && (obj.mid = message.mid);
1974
- if (message.codecs) {
1975
- obj.codecs = message.codecs.map((e) => e ? SimulcastCodecInfo.toJSON(e) : undefined);
1976
- } else {
1977
- obj.codecs = [];
1978
- }
1979
- message.stereo !== undefined && (obj.stereo = message.stereo);
1980
- message.disableRed !== undefined && (obj.disableRed = message.disableRed);
1981
- message.encryption !== undefined && (obj.encryption = encryption_TypeToJSON(message.encryption));
1982
- return obj;
1983
- },
1984
-
1985
- create<I extends Exact<DeepPartial<TrackInfo>, I>>(base?: I): TrackInfo {
1986
- return TrackInfo.fromPartial(base ?? {});
1987
- },
1988
-
1989
- fromPartial<I extends Exact<DeepPartial<TrackInfo>, I>>(object: I): TrackInfo {
1990
- const message = createBaseTrackInfo();
1991
- message.sid = object.sid ?? "";
1992
- message.type = object.type ?? 0;
1993
- message.name = object.name ?? "";
1994
- message.muted = object.muted ?? false;
1995
- message.width = object.width ?? 0;
1996
- message.height = object.height ?? 0;
1997
- message.simulcast = object.simulcast ?? false;
1998
- message.disableDtx = object.disableDtx ?? false;
1999
- message.source = object.source ?? 0;
2000
- message.layers = object.layers?.map((e) => VideoLayer.fromPartial(e)) || [];
2001
- message.mimeType = object.mimeType ?? "";
2002
- message.mid = object.mid ?? "";
2003
- message.codecs = object.codecs?.map((e) => SimulcastCodecInfo.fromPartial(e)) || [];
2004
- message.stereo = object.stereo ?? false;
2005
- message.disableRed = object.disableRed ?? false;
2006
- message.encryption = object.encryption ?? 0;
2007
- return message;
2008
- },
2009
- };
2010
-
2011
- function createBaseVideoLayer(): VideoLayer {
2012
- return { quality: 0, width: 0, height: 0, bitrate: 0, ssrc: 0 };
2013
- }
2014
-
2015
- export const VideoLayer = {
2016
- encode(message: VideoLayer, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2017
- if (message.quality !== 0) {
2018
- writer.uint32(8).int32(message.quality);
2019
- }
2020
- if (message.width !== 0) {
2021
- writer.uint32(16).uint32(message.width);
2022
- }
2023
- if (message.height !== 0) {
2024
- writer.uint32(24).uint32(message.height);
2025
- }
2026
- if (message.bitrate !== 0) {
2027
- writer.uint32(32).uint32(message.bitrate);
2028
- }
2029
- if (message.ssrc !== 0) {
2030
- writer.uint32(40).uint32(message.ssrc);
2031
- }
2032
- return writer;
2033
- },
2034
-
2035
- decode(input: _m0.Reader | Uint8Array, length?: number): VideoLayer {
2036
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2037
- let end = length === undefined ? reader.len : reader.pos + length;
2038
- const message = createBaseVideoLayer();
2039
- while (reader.pos < end) {
2040
- const tag = reader.uint32();
2041
- switch (tag >>> 3) {
2042
- case 1:
2043
- if (tag !== 8) {
2044
- break;
2045
- }
2046
-
2047
- message.quality = reader.int32() as any;
2048
- continue;
2049
- case 2:
2050
- if (tag !== 16) {
2051
- break;
2052
- }
2053
-
2054
- message.width = reader.uint32();
2055
- continue;
2056
- case 3:
2057
- if (tag !== 24) {
2058
- break;
2059
- }
2060
-
2061
- message.height = reader.uint32();
2062
- continue;
2063
- case 4:
2064
- if (tag !== 32) {
2065
- break;
2066
- }
2067
-
2068
- message.bitrate = reader.uint32();
2069
- continue;
2070
- case 5:
2071
- if (tag !== 40) {
2072
- break;
2073
- }
2074
-
2075
- message.ssrc = reader.uint32();
2076
- continue;
2077
- }
2078
- if ((tag & 7) === 4 || tag === 0) {
2079
- break;
2080
- }
2081
- reader.skipType(tag & 7);
2082
- }
2083
- return message;
2084
- },
2085
-
2086
- fromJSON(object: any): VideoLayer {
2087
- return {
2088
- quality: isSet(object.quality) ? videoQualityFromJSON(object.quality) : 0,
2089
- width: isSet(object.width) ? Number(object.width) : 0,
2090
- height: isSet(object.height) ? Number(object.height) : 0,
2091
- bitrate: isSet(object.bitrate) ? Number(object.bitrate) : 0,
2092
- ssrc: isSet(object.ssrc) ? Number(object.ssrc) : 0,
2093
- };
2094
- },
2095
-
2096
- toJSON(message: VideoLayer): unknown {
2097
- const obj: any = {};
2098
- message.quality !== undefined && (obj.quality = videoQualityToJSON(message.quality));
2099
- message.width !== undefined && (obj.width = Math.round(message.width));
2100
- message.height !== undefined && (obj.height = Math.round(message.height));
2101
- message.bitrate !== undefined && (obj.bitrate = Math.round(message.bitrate));
2102
- message.ssrc !== undefined && (obj.ssrc = Math.round(message.ssrc));
2103
- return obj;
2104
- },
2105
-
2106
- create<I extends Exact<DeepPartial<VideoLayer>, I>>(base?: I): VideoLayer {
2107
- return VideoLayer.fromPartial(base ?? {});
2108
- },
2109
-
2110
- fromPartial<I extends Exact<DeepPartial<VideoLayer>, I>>(object: I): VideoLayer {
2111
- const message = createBaseVideoLayer();
2112
- message.quality = object.quality ?? 0;
2113
- message.width = object.width ?? 0;
2114
- message.height = object.height ?? 0;
2115
- message.bitrate = object.bitrate ?? 0;
2116
- message.ssrc = object.ssrc ?? 0;
2117
- return message;
2118
- },
2119
- };
2120
-
2121
- function createBaseDataPacket(): DataPacket {
2122
- return { kind: 0, value: undefined };
2123
- }
2124
-
2125
- export const DataPacket = {
2126
- encode(message: DataPacket, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2127
- if (message.kind !== 0) {
2128
- writer.uint32(8).int32(message.kind);
2129
- }
2130
- switch (message.value?.$case) {
2131
- case "user":
2132
- UserPacket.encode(message.value.user, writer.uint32(18).fork()).ldelim();
2133
- break;
2134
- case "speaker":
2135
- ActiveSpeakerUpdate.encode(message.value.speaker, writer.uint32(26).fork()).ldelim();
2136
- break;
2137
- }
2138
- return writer;
2139
- },
2140
-
2141
- decode(input: _m0.Reader | Uint8Array, length?: number): DataPacket {
2142
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2143
- let end = length === undefined ? reader.len : reader.pos + length;
2144
- const message = createBaseDataPacket();
2145
- while (reader.pos < end) {
2146
- const tag = reader.uint32();
2147
- switch (tag >>> 3) {
2148
- case 1:
2149
- if (tag !== 8) {
2150
- break;
2151
- }
2152
-
2153
- message.kind = reader.int32() as any;
2154
- continue;
2155
- case 2:
2156
- if (tag !== 18) {
2157
- break;
2158
- }
2159
-
2160
- message.value = { $case: "user", user: UserPacket.decode(reader, reader.uint32()) };
2161
- continue;
2162
- case 3:
2163
- if (tag !== 26) {
2164
- break;
2165
- }
2166
-
2167
- message.value = { $case: "speaker", speaker: ActiveSpeakerUpdate.decode(reader, reader.uint32()) };
2168
- continue;
2169
- }
2170
- if ((tag & 7) === 4 || tag === 0) {
2171
- break;
2172
- }
2173
- reader.skipType(tag & 7);
2174
- }
2175
- return message;
2176
- },
2177
-
2178
- fromJSON(object: any): DataPacket {
2179
- return {
2180
- kind: isSet(object.kind) ? dataPacket_KindFromJSON(object.kind) : 0,
2181
- value: isSet(object.user)
2182
- ? { $case: "user", user: UserPacket.fromJSON(object.user) }
2183
- : isSet(object.speaker)
2184
- ? { $case: "speaker", speaker: ActiveSpeakerUpdate.fromJSON(object.speaker) }
2185
- : undefined,
2186
- };
2187
- },
2188
-
2189
- toJSON(message: DataPacket): unknown {
2190
- const obj: any = {};
2191
- message.kind !== undefined && (obj.kind = dataPacket_KindToJSON(message.kind));
2192
- message.value?.$case === "user" &&
2193
- (obj.user = message.value?.user ? UserPacket.toJSON(message.value?.user) : undefined);
2194
- message.value?.$case === "speaker" &&
2195
- (obj.speaker = message.value?.speaker ? ActiveSpeakerUpdate.toJSON(message.value?.speaker) : undefined);
2196
- return obj;
2197
- },
2198
-
2199
- create<I extends Exact<DeepPartial<DataPacket>, I>>(base?: I): DataPacket {
2200
- return DataPacket.fromPartial(base ?? {});
2201
- },
2202
-
2203
- fromPartial<I extends Exact<DeepPartial<DataPacket>, I>>(object: I): DataPacket {
2204
- const message = createBaseDataPacket();
2205
- message.kind = object.kind ?? 0;
2206
- if (object.value?.$case === "user" && object.value?.user !== undefined && object.value?.user !== null) {
2207
- message.value = { $case: "user", user: UserPacket.fromPartial(object.value.user) };
2208
- }
2209
- if (object.value?.$case === "speaker" && object.value?.speaker !== undefined && object.value?.speaker !== null) {
2210
- message.value = { $case: "speaker", speaker: ActiveSpeakerUpdate.fromPartial(object.value.speaker) };
2211
- }
2212
- return message;
2213
- },
2214
- };
2215
-
2216
- function createBaseActiveSpeakerUpdate(): ActiveSpeakerUpdate {
2217
- return { speakers: [] };
2218
- }
2219
-
2220
- export const ActiveSpeakerUpdate = {
2221
- encode(message: ActiveSpeakerUpdate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2222
- for (const v of message.speakers) {
2223
- SpeakerInfo.encode(v!, writer.uint32(10).fork()).ldelim();
2224
- }
2225
- return writer;
2226
- },
2227
-
2228
- decode(input: _m0.Reader | Uint8Array, length?: number): ActiveSpeakerUpdate {
2229
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2230
- let end = length === undefined ? reader.len : reader.pos + length;
2231
- const message = createBaseActiveSpeakerUpdate();
2232
- while (reader.pos < end) {
2233
- const tag = reader.uint32();
2234
- switch (tag >>> 3) {
2235
- case 1:
2236
- if (tag !== 10) {
2237
- break;
2238
- }
2239
-
2240
- message.speakers.push(SpeakerInfo.decode(reader, reader.uint32()));
2241
- continue;
2242
- }
2243
- if ((tag & 7) === 4 || tag === 0) {
2244
- break;
2245
- }
2246
- reader.skipType(tag & 7);
2247
- }
2248
- return message;
2249
- },
2250
-
2251
- fromJSON(object: any): ActiveSpeakerUpdate {
2252
- return {
2253
- speakers: Array.isArray(object?.speakers) ? object.speakers.map((e: any) => SpeakerInfo.fromJSON(e)) : [],
2254
- };
2255
- },
2256
-
2257
- toJSON(message: ActiveSpeakerUpdate): unknown {
2258
- const obj: any = {};
2259
- if (message.speakers) {
2260
- obj.speakers = message.speakers.map((e) => e ? SpeakerInfo.toJSON(e) : undefined);
2261
- } else {
2262
- obj.speakers = [];
2263
- }
2264
- return obj;
2265
- },
2266
-
2267
- create<I extends Exact<DeepPartial<ActiveSpeakerUpdate>, I>>(base?: I): ActiveSpeakerUpdate {
2268
- return ActiveSpeakerUpdate.fromPartial(base ?? {});
2269
- },
2270
-
2271
- fromPartial<I extends Exact<DeepPartial<ActiveSpeakerUpdate>, I>>(object: I): ActiveSpeakerUpdate {
2272
- const message = createBaseActiveSpeakerUpdate();
2273
- message.speakers = object.speakers?.map((e) => SpeakerInfo.fromPartial(e)) || [];
2274
- return message;
2275
- },
2276
- };
2277
-
2278
- function createBaseSpeakerInfo(): SpeakerInfo {
2279
- return { sid: "", level: 0, active: false };
2280
- }
2281
-
2282
- export const SpeakerInfo = {
2283
- encode(message: SpeakerInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2284
- if (message.sid !== "") {
2285
- writer.uint32(10).string(message.sid);
2286
- }
2287
- if (message.level !== 0) {
2288
- writer.uint32(21).float(message.level);
2289
- }
2290
- if (message.active === true) {
2291
- writer.uint32(24).bool(message.active);
2292
- }
2293
- return writer;
2294
- },
2295
-
2296
- decode(input: _m0.Reader | Uint8Array, length?: number): SpeakerInfo {
2297
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2298
- let end = length === undefined ? reader.len : reader.pos + length;
2299
- const message = createBaseSpeakerInfo();
2300
- while (reader.pos < end) {
2301
- const tag = reader.uint32();
2302
- switch (tag >>> 3) {
2303
- case 1:
2304
- if (tag !== 10) {
2305
- break;
2306
- }
2307
-
2308
- message.sid = reader.string();
2309
- continue;
2310
- case 2:
2311
- if (tag !== 21) {
2312
- break;
2313
- }
2314
-
2315
- message.level = reader.float();
2316
- continue;
2317
- case 3:
2318
- if (tag !== 24) {
2319
- break;
2320
- }
2321
-
2322
- message.active = reader.bool();
2323
- continue;
2324
- }
2325
- if ((tag & 7) === 4 || tag === 0) {
2326
- break;
2327
- }
2328
- reader.skipType(tag & 7);
2329
- }
2330
- return message;
2331
- },
2332
-
2333
- fromJSON(object: any): SpeakerInfo {
2334
- return {
2335
- sid: isSet(object.sid) ? String(object.sid) : "",
2336
- level: isSet(object.level) ? Number(object.level) : 0,
2337
- active: isSet(object.active) ? Boolean(object.active) : false,
2338
- };
2339
- },
2340
-
2341
- toJSON(message: SpeakerInfo): unknown {
2342
- const obj: any = {};
2343
- message.sid !== undefined && (obj.sid = message.sid);
2344
- message.level !== undefined && (obj.level = message.level);
2345
- message.active !== undefined && (obj.active = message.active);
2346
- return obj;
2347
- },
2348
-
2349
- create<I extends Exact<DeepPartial<SpeakerInfo>, I>>(base?: I): SpeakerInfo {
2350
- return SpeakerInfo.fromPartial(base ?? {});
2351
- },
2352
-
2353
- fromPartial<I extends Exact<DeepPartial<SpeakerInfo>, I>>(object: I): SpeakerInfo {
2354
- const message = createBaseSpeakerInfo();
2355
- message.sid = object.sid ?? "";
2356
- message.level = object.level ?? 0;
2357
- message.active = object.active ?? false;
2358
- return message;
2359
- },
2360
- };
2361
-
2362
- function createBaseUserPacket(): UserPacket {
2363
- return { participantSid: "", payload: new Uint8Array(), destinationSids: [], topic: undefined };
2364
- }
2365
-
2366
- export const UserPacket = {
2367
- encode(message: UserPacket, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2368
- if (message.participantSid !== "") {
2369
- writer.uint32(10).string(message.participantSid);
2370
- }
2371
- if (message.payload.length !== 0) {
2372
- writer.uint32(18).bytes(message.payload);
2373
- }
2374
- for (const v of message.destinationSids) {
2375
- writer.uint32(26).string(v!);
2376
- }
2377
- if (message.topic !== undefined) {
2378
- writer.uint32(34).string(message.topic);
2379
- }
2380
- return writer;
2381
- },
2382
-
2383
- decode(input: _m0.Reader | Uint8Array, length?: number): UserPacket {
2384
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2385
- let end = length === undefined ? reader.len : reader.pos + length;
2386
- const message = createBaseUserPacket();
2387
- while (reader.pos < end) {
2388
- const tag = reader.uint32();
2389
- switch (tag >>> 3) {
2390
- case 1:
2391
- if (tag !== 10) {
2392
- break;
2393
- }
2394
-
2395
- message.participantSid = reader.string();
2396
- continue;
2397
- case 2:
2398
- if (tag !== 18) {
2399
- break;
2400
- }
2401
-
2402
- message.payload = reader.bytes();
2403
- continue;
2404
- case 3:
2405
- if (tag !== 26) {
2406
- break;
2407
- }
2408
-
2409
- message.destinationSids.push(reader.string());
2410
- continue;
2411
- case 4:
2412
- if (tag !== 34) {
2413
- break;
2414
- }
2415
-
2416
- message.topic = reader.string();
2417
- continue;
2418
- }
2419
- if ((tag & 7) === 4 || tag === 0) {
2420
- break;
2421
- }
2422
- reader.skipType(tag & 7);
2423
- }
2424
- return message;
2425
- },
2426
-
2427
- fromJSON(object: any): UserPacket {
2428
- return {
2429
- participantSid: isSet(object.participantSid) ? String(object.participantSid) : "",
2430
- payload: isSet(object.payload) ? bytesFromBase64(object.payload) : new Uint8Array(),
2431
- destinationSids: Array.isArray(object?.destinationSids) ? object.destinationSids.map((e: any) => String(e)) : [],
2432
- topic: isSet(object.topic) ? String(object.topic) : undefined,
2433
- };
2434
- },
2435
-
2436
- toJSON(message: UserPacket): unknown {
2437
- const obj: any = {};
2438
- message.participantSid !== undefined && (obj.participantSid = message.participantSid);
2439
- message.payload !== undefined &&
2440
- (obj.payload = base64FromBytes(message.payload !== undefined ? message.payload : new Uint8Array()));
2441
- if (message.destinationSids) {
2442
- obj.destinationSids = message.destinationSids.map((e) => e);
2443
- } else {
2444
- obj.destinationSids = [];
2445
- }
2446
- message.topic !== undefined && (obj.topic = message.topic);
2447
- return obj;
2448
- },
2449
-
2450
- create<I extends Exact<DeepPartial<UserPacket>, I>>(base?: I): UserPacket {
2451
- return UserPacket.fromPartial(base ?? {});
2452
- },
2453
-
2454
- fromPartial<I extends Exact<DeepPartial<UserPacket>, I>>(object: I): UserPacket {
2455
- const message = createBaseUserPacket();
2456
- message.participantSid = object.participantSid ?? "";
2457
- message.payload = object.payload ?? new Uint8Array();
2458
- message.destinationSids = object.destinationSids?.map((e) => e) || [];
2459
- message.topic = object.topic ?? undefined;
2460
- return message;
2461
- },
2462
- };
2463
-
2464
- function createBaseParticipantTracks(): ParticipantTracks {
2465
- return { participantSid: "", trackSids: [] };
2466
- }
2467
-
2468
- export const ParticipantTracks = {
2469
- encode(message: ParticipantTracks, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2470
- if (message.participantSid !== "") {
2471
- writer.uint32(10).string(message.participantSid);
2472
- }
2473
- for (const v of message.trackSids) {
2474
- writer.uint32(18).string(v!);
2475
- }
2476
- return writer;
2477
- },
2478
-
2479
- decode(input: _m0.Reader | Uint8Array, length?: number): ParticipantTracks {
2480
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2481
- let end = length === undefined ? reader.len : reader.pos + length;
2482
- const message = createBaseParticipantTracks();
2483
- while (reader.pos < end) {
2484
- const tag = reader.uint32();
2485
- switch (tag >>> 3) {
2486
- case 1:
2487
- if (tag !== 10) {
2488
- break;
2489
- }
2490
-
2491
- message.participantSid = reader.string();
2492
- continue;
2493
- case 2:
2494
- if (tag !== 18) {
2495
- break;
2496
- }
2497
-
2498
- message.trackSids.push(reader.string());
2499
- continue;
2500
- }
2501
- if ((tag & 7) === 4 || tag === 0) {
2502
- break;
2503
- }
2504
- reader.skipType(tag & 7);
2505
- }
2506
- return message;
2507
- },
2508
-
2509
- fromJSON(object: any): ParticipantTracks {
2510
- return {
2511
- participantSid: isSet(object.participantSid) ? String(object.participantSid) : "",
2512
- trackSids: Array.isArray(object?.trackSids) ? object.trackSids.map((e: any) => String(e)) : [],
2513
- };
2514
- },
2515
-
2516
- toJSON(message: ParticipantTracks): unknown {
2517
- const obj: any = {};
2518
- message.participantSid !== undefined && (obj.participantSid = message.participantSid);
2519
- if (message.trackSids) {
2520
- obj.trackSids = message.trackSids.map((e) => e);
2521
- } else {
2522
- obj.trackSids = [];
2523
- }
2524
- return obj;
2525
- },
2526
-
2527
- create<I extends Exact<DeepPartial<ParticipantTracks>, I>>(base?: I): ParticipantTracks {
2528
- return ParticipantTracks.fromPartial(base ?? {});
2529
- },
2530
-
2531
- fromPartial<I extends Exact<DeepPartial<ParticipantTracks>, I>>(object: I): ParticipantTracks {
2532
- const message = createBaseParticipantTracks();
2533
- message.participantSid = object.participantSid ?? "";
2534
- message.trackSids = object.trackSids?.map((e) => e) || [];
2535
- return message;
2536
- },
2537
- };
2538
-
2539
- function createBaseServerInfo(): ServerInfo {
2540
- return { edition: 0, version: "", protocol: 0, region: "", nodeId: "", debugInfo: "" };
2541
- }
2542
-
2543
- export const ServerInfo = {
2544
- encode(message: ServerInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2545
- if (message.edition !== 0) {
2546
- writer.uint32(8).int32(message.edition);
2547
- }
2548
- if (message.version !== "") {
2549
- writer.uint32(18).string(message.version);
2550
- }
2551
- if (message.protocol !== 0) {
2552
- writer.uint32(24).int32(message.protocol);
2553
- }
2554
- if (message.region !== "") {
2555
- writer.uint32(34).string(message.region);
2556
- }
2557
- if (message.nodeId !== "") {
2558
- writer.uint32(42).string(message.nodeId);
2559
- }
2560
- if (message.debugInfo !== "") {
2561
- writer.uint32(50).string(message.debugInfo);
2562
- }
2563
- return writer;
2564
- },
2565
-
2566
- decode(input: _m0.Reader | Uint8Array, length?: number): ServerInfo {
2567
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2568
- let end = length === undefined ? reader.len : reader.pos + length;
2569
- const message = createBaseServerInfo();
2570
- while (reader.pos < end) {
2571
- const tag = reader.uint32();
2572
- switch (tag >>> 3) {
2573
- case 1:
2574
- if (tag !== 8) {
2575
- break;
2576
- }
2577
-
2578
- message.edition = reader.int32() as any;
2579
- continue;
2580
- case 2:
2581
- if (tag !== 18) {
2582
- break;
2583
- }
2584
-
2585
- message.version = reader.string();
2586
- continue;
2587
- case 3:
2588
- if (tag !== 24) {
2589
- break;
2590
- }
2591
-
2592
- message.protocol = reader.int32();
2593
- continue;
2594
- case 4:
2595
- if (tag !== 34) {
2596
- break;
2597
- }
2598
-
2599
- message.region = reader.string();
2600
- continue;
2601
- case 5:
2602
- if (tag !== 42) {
2603
- break;
2604
- }
2605
-
2606
- message.nodeId = reader.string();
2607
- continue;
2608
- case 6:
2609
- if (tag !== 50) {
2610
- break;
2611
- }
2612
-
2613
- message.debugInfo = reader.string();
2614
- continue;
2615
- }
2616
- if ((tag & 7) === 4 || tag === 0) {
2617
- break;
2618
- }
2619
- reader.skipType(tag & 7);
2620
- }
2621
- return message;
2622
- },
2623
-
2624
- fromJSON(object: any): ServerInfo {
2625
- return {
2626
- edition: isSet(object.edition) ? serverInfo_EditionFromJSON(object.edition) : 0,
2627
- version: isSet(object.version) ? String(object.version) : "",
2628
- protocol: isSet(object.protocol) ? Number(object.protocol) : 0,
2629
- region: isSet(object.region) ? String(object.region) : "",
2630
- nodeId: isSet(object.nodeId) ? String(object.nodeId) : "",
2631
- debugInfo: isSet(object.debugInfo) ? String(object.debugInfo) : "",
2632
- };
2633
- },
2634
-
2635
- toJSON(message: ServerInfo): unknown {
2636
- const obj: any = {};
2637
- message.edition !== undefined && (obj.edition = serverInfo_EditionToJSON(message.edition));
2638
- message.version !== undefined && (obj.version = message.version);
2639
- message.protocol !== undefined && (obj.protocol = Math.round(message.protocol));
2640
- message.region !== undefined && (obj.region = message.region);
2641
- message.nodeId !== undefined && (obj.nodeId = message.nodeId);
2642
- message.debugInfo !== undefined && (obj.debugInfo = message.debugInfo);
2643
- return obj;
2644
- },
2645
-
2646
- create<I extends Exact<DeepPartial<ServerInfo>, I>>(base?: I): ServerInfo {
2647
- return ServerInfo.fromPartial(base ?? {});
2648
- },
2649
-
2650
- fromPartial<I extends Exact<DeepPartial<ServerInfo>, I>>(object: I): ServerInfo {
2651
- const message = createBaseServerInfo();
2652
- message.edition = object.edition ?? 0;
2653
- message.version = object.version ?? "";
2654
- message.protocol = object.protocol ?? 0;
2655
- message.region = object.region ?? "";
2656
- message.nodeId = object.nodeId ?? "";
2657
- message.debugInfo = object.debugInfo ?? "";
2658
- return message;
2659
- },
2660
- };
2661
-
2662
- function createBaseClientInfo(): ClientInfo {
2663
- return {
2664
- sdk: 0,
2665
- version: "",
2666
- protocol: 0,
2667
- os: "",
2668
- osVersion: "",
2669
- deviceModel: "",
2670
- browser: "",
2671
- browserVersion: "",
2672
- address: "",
2673
- network: "",
2674
- };
2675
- }
2676
-
2677
- export const ClientInfo = {
2678
- encode(message: ClientInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2679
- if (message.sdk !== 0) {
2680
- writer.uint32(8).int32(message.sdk);
2681
- }
2682
- if (message.version !== "") {
2683
- writer.uint32(18).string(message.version);
2684
- }
2685
- if (message.protocol !== 0) {
2686
- writer.uint32(24).int32(message.protocol);
2687
- }
2688
- if (message.os !== "") {
2689
- writer.uint32(34).string(message.os);
2690
- }
2691
- if (message.osVersion !== "") {
2692
- writer.uint32(42).string(message.osVersion);
2693
- }
2694
- if (message.deviceModel !== "") {
2695
- writer.uint32(50).string(message.deviceModel);
2696
- }
2697
- if (message.browser !== "") {
2698
- writer.uint32(58).string(message.browser);
2699
- }
2700
- if (message.browserVersion !== "") {
2701
- writer.uint32(66).string(message.browserVersion);
2702
- }
2703
- if (message.address !== "") {
2704
- writer.uint32(74).string(message.address);
2705
- }
2706
- if (message.network !== "") {
2707
- writer.uint32(82).string(message.network);
2708
- }
2709
- return writer;
2710
- },
2711
-
2712
- decode(input: _m0.Reader | Uint8Array, length?: number): ClientInfo {
2713
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2714
- let end = length === undefined ? reader.len : reader.pos + length;
2715
- const message = createBaseClientInfo();
2716
- while (reader.pos < end) {
2717
- const tag = reader.uint32();
2718
- switch (tag >>> 3) {
2719
- case 1:
2720
- if (tag !== 8) {
2721
- break;
2722
- }
2723
-
2724
- message.sdk = reader.int32() as any;
2725
- continue;
2726
- case 2:
2727
- if (tag !== 18) {
2728
- break;
2729
- }
2730
-
2731
- message.version = reader.string();
2732
- continue;
2733
- case 3:
2734
- if (tag !== 24) {
2735
- break;
2736
- }
2737
-
2738
- message.protocol = reader.int32();
2739
- continue;
2740
- case 4:
2741
- if (tag !== 34) {
2742
- break;
2743
- }
2744
-
2745
- message.os = reader.string();
2746
- continue;
2747
- case 5:
2748
- if (tag !== 42) {
2749
- break;
2750
- }
2751
-
2752
- message.osVersion = reader.string();
2753
- continue;
2754
- case 6:
2755
- if (tag !== 50) {
2756
- break;
2757
- }
2758
-
2759
- message.deviceModel = reader.string();
2760
- continue;
2761
- case 7:
2762
- if (tag !== 58) {
2763
- break;
2764
- }
2765
-
2766
- message.browser = reader.string();
2767
- continue;
2768
- case 8:
2769
- if (tag !== 66) {
2770
- break;
2771
- }
2772
-
2773
- message.browserVersion = reader.string();
2774
- continue;
2775
- case 9:
2776
- if (tag !== 74) {
2777
- break;
2778
- }
2779
-
2780
- message.address = reader.string();
2781
- continue;
2782
- case 10:
2783
- if (tag !== 82) {
2784
- break;
2785
- }
2786
-
2787
- message.network = reader.string();
2788
- continue;
2789
- }
2790
- if ((tag & 7) === 4 || tag === 0) {
2791
- break;
2792
- }
2793
- reader.skipType(tag & 7);
2794
- }
2795
- return message;
2796
- },
2797
-
2798
- fromJSON(object: any): ClientInfo {
2799
- return {
2800
- sdk: isSet(object.sdk) ? clientInfo_SDKFromJSON(object.sdk) : 0,
2801
- version: isSet(object.version) ? String(object.version) : "",
2802
- protocol: isSet(object.protocol) ? Number(object.protocol) : 0,
2803
- os: isSet(object.os) ? String(object.os) : "",
2804
- osVersion: isSet(object.osVersion) ? String(object.osVersion) : "",
2805
- deviceModel: isSet(object.deviceModel) ? String(object.deviceModel) : "",
2806
- browser: isSet(object.browser) ? String(object.browser) : "",
2807
- browserVersion: isSet(object.browserVersion) ? String(object.browserVersion) : "",
2808
- address: isSet(object.address) ? String(object.address) : "",
2809
- network: isSet(object.network) ? String(object.network) : "",
2810
- };
2811
- },
2812
-
2813
- toJSON(message: ClientInfo): unknown {
2814
- const obj: any = {};
2815
- message.sdk !== undefined && (obj.sdk = clientInfo_SDKToJSON(message.sdk));
2816
- message.version !== undefined && (obj.version = message.version);
2817
- message.protocol !== undefined && (obj.protocol = Math.round(message.protocol));
2818
- message.os !== undefined && (obj.os = message.os);
2819
- message.osVersion !== undefined && (obj.osVersion = message.osVersion);
2820
- message.deviceModel !== undefined && (obj.deviceModel = message.deviceModel);
2821
- message.browser !== undefined && (obj.browser = message.browser);
2822
- message.browserVersion !== undefined && (obj.browserVersion = message.browserVersion);
2823
- message.address !== undefined && (obj.address = message.address);
2824
- message.network !== undefined && (obj.network = message.network);
2825
- return obj;
2826
- },
2827
-
2828
- create<I extends Exact<DeepPartial<ClientInfo>, I>>(base?: I): ClientInfo {
2829
- return ClientInfo.fromPartial(base ?? {});
2830
- },
2831
-
2832
- fromPartial<I extends Exact<DeepPartial<ClientInfo>, I>>(object: I): ClientInfo {
2833
- const message = createBaseClientInfo();
2834
- message.sdk = object.sdk ?? 0;
2835
- message.version = object.version ?? "";
2836
- message.protocol = object.protocol ?? 0;
2837
- message.os = object.os ?? "";
2838
- message.osVersion = object.osVersion ?? "";
2839
- message.deviceModel = object.deviceModel ?? "";
2840
- message.browser = object.browser ?? "";
2841
- message.browserVersion = object.browserVersion ?? "";
2842
- message.address = object.address ?? "";
2843
- message.network = object.network ?? "";
2844
- return message;
2845
- },
2846
- };
2847
-
2848
- function createBaseClientConfiguration(): ClientConfiguration {
2849
- return { video: undefined, screen: undefined, resumeConnection: 0, disabledCodecs: undefined, forceRelay: 0 };
2850
- }
2851
-
2852
- export const ClientConfiguration = {
2853
- encode(message: ClientConfiguration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2854
- if (message.video !== undefined) {
2855
- VideoConfiguration.encode(message.video, writer.uint32(10).fork()).ldelim();
2856
- }
2857
- if (message.screen !== undefined) {
2858
- VideoConfiguration.encode(message.screen, writer.uint32(18).fork()).ldelim();
2859
- }
2860
- if (message.resumeConnection !== 0) {
2861
- writer.uint32(24).int32(message.resumeConnection);
2862
- }
2863
- if (message.disabledCodecs !== undefined) {
2864
- DisabledCodecs.encode(message.disabledCodecs, writer.uint32(34).fork()).ldelim();
2865
- }
2866
- if (message.forceRelay !== 0) {
2867
- writer.uint32(40).int32(message.forceRelay);
2868
- }
2869
- return writer;
2870
- },
2871
-
2872
- decode(input: _m0.Reader | Uint8Array, length?: number): ClientConfiguration {
2873
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2874
- let end = length === undefined ? reader.len : reader.pos + length;
2875
- const message = createBaseClientConfiguration();
2876
- while (reader.pos < end) {
2877
- const tag = reader.uint32();
2878
- switch (tag >>> 3) {
2879
- case 1:
2880
- if (tag !== 10) {
2881
- break;
2882
- }
2883
-
2884
- message.video = VideoConfiguration.decode(reader, reader.uint32());
2885
- continue;
2886
- case 2:
2887
- if (tag !== 18) {
2888
- break;
2889
- }
2890
-
2891
- message.screen = VideoConfiguration.decode(reader, reader.uint32());
2892
- continue;
2893
- case 3:
2894
- if (tag !== 24) {
2895
- break;
2896
- }
2897
-
2898
- message.resumeConnection = reader.int32() as any;
2899
- continue;
2900
- case 4:
2901
- if (tag !== 34) {
2902
- break;
2903
- }
2904
-
2905
- message.disabledCodecs = DisabledCodecs.decode(reader, reader.uint32());
2906
- continue;
2907
- case 5:
2908
- if (tag !== 40) {
2909
- break;
2910
- }
2911
-
2912
- message.forceRelay = reader.int32() as any;
2913
- continue;
2914
- }
2915
- if ((tag & 7) === 4 || tag === 0) {
2916
- break;
2917
- }
2918
- reader.skipType(tag & 7);
2919
- }
2920
- return message;
2921
- },
2922
-
2923
- fromJSON(object: any): ClientConfiguration {
2924
- return {
2925
- video: isSet(object.video) ? VideoConfiguration.fromJSON(object.video) : undefined,
2926
- screen: isSet(object.screen) ? VideoConfiguration.fromJSON(object.screen) : undefined,
2927
- resumeConnection: isSet(object.resumeConnection) ? clientConfigSettingFromJSON(object.resumeConnection) : 0,
2928
- disabledCodecs: isSet(object.disabledCodecs) ? DisabledCodecs.fromJSON(object.disabledCodecs) : undefined,
2929
- forceRelay: isSet(object.forceRelay) ? clientConfigSettingFromJSON(object.forceRelay) : 0,
2930
- };
2931
- },
2932
-
2933
- toJSON(message: ClientConfiguration): unknown {
2934
- const obj: any = {};
2935
- message.video !== undefined && (obj.video = message.video ? VideoConfiguration.toJSON(message.video) : undefined);
2936
- message.screen !== undefined &&
2937
- (obj.screen = message.screen ? VideoConfiguration.toJSON(message.screen) : undefined);
2938
- message.resumeConnection !== undefined &&
2939
- (obj.resumeConnection = clientConfigSettingToJSON(message.resumeConnection));
2940
- message.disabledCodecs !== undefined &&
2941
- (obj.disabledCodecs = message.disabledCodecs ? DisabledCodecs.toJSON(message.disabledCodecs) : undefined);
2942
- message.forceRelay !== undefined && (obj.forceRelay = clientConfigSettingToJSON(message.forceRelay));
2943
- return obj;
2944
- },
2945
-
2946
- create<I extends Exact<DeepPartial<ClientConfiguration>, I>>(base?: I): ClientConfiguration {
2947
- return ClientConfiguration.fromPartial(base ?? {});
2948
- },
2949
-
2950
- fromPartial<I extends Exact<DeepPartial<ClientConfiguration>, I>>(object: I): ClientConfiguration {
2951
- const message = createBaseClientConfiguration();
2952
- message.video = (object.video !== undefined && object.video !== null)
2953
- ? VideoConfiguration.fromPartial(object.video)
2954
- : undefined;
2955
- message.screen = (object.screen !== undefined && object.screen !== null)
2956
- ? VideoConfiguration.fromPartial(object.screen)
2957
- : undefined;
2958
- message.resumeConnection = object.resumeConnection ?? 0;
2959
- message.disabledCodecs = (object.disabledCodecs !== undefined && object.disabledCodecs !== null)
2960
- ? DisabledCodecs.fromPartial(object.disabledCodecs)
2961
- : undefined;
2962
- message.forceRelay = object.forceRelay ?? 0;
2963
- return message;
2964
- },
2965
- };
2966
-
2967
- function createBaseVideoConfiguration(): VideoConfiguration {
2968
- return { hardwareEncoder: 0 };
2969
- }
2970
-
2971
- export const VideoConfiguration = {
2972
- encode(message: VideoConfiguration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2973
- if (message.hardwareEncoder !== 0) {
2974
- writer.uint32(8).int32(message.hardwareEncoder);
2975
- }
2976
- return writer;
2977
- },
2978
-
2979
- decode(input: _m0.Reader | Uint8Array, length?: number): VideoConfiguration {
2980
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2981
- let end = length === undefined ? reader.len : reader.pos + length;
2982
- const message = createBaseVideoConfiguration();
2983
- while (reader.pos < end) {
2984
- const tag = reader.uint32();
2985
- switch (tag >>> 3) {
2986
- case 1:
2987
- if (tag !== 8) {
2988
- break;
2989
- }
2990
-
2991
- message.hardwareEncoder = reader.int32() as any;
2992
- continue;
2993
- }
2994
- if ((tag & 7) === 4 || tag === 0) {
2995
- break;
2996
- }
2997
- reader.skipType(tag & 7);
2998
- }
2999
- return message;
3000
- },
3001
-
3002
- fromJSON(object: any): VideoConfiguration {
3003
- return { hardwareEncoder: isSet(object.hardwareEncoder) ? clientConfigSettingFromJSON(object.hardwareEncoder) : 0 };
3004
- },
3005
-
3006
- toJSON(message: VideoConfiguration): unknown {
3007
- const obj: any = {};
3008
- message.hardwareEncoder !== undefined && (obj.hardwareEncoder = clientConfigSettingToJSON(message.hardwareEncoder));
3009
- return obj;
3010
- },
3011
-
3012
- create<I extends Exact<DeepPartial<VideoConfiguration>, I>>(base?: I): VideoConfiguration {
3013
- return VideoConfiguration.fromPartial(base ?? {});
3014
- },
3015
-
3016
- fromPartial<I extends Exact<DeepPartial<VideoConfiguration>, I>>(object: I): VideoConfiguration {
3017
- const message = createBaseVideoConfiguration();
3018
- message.hardwareEncoder = object.hardwareEncoder ?? 0;
3019
- return message;
3020
- },
3021
- };
3022
-
3023
- function createBaseDisabledCodecs(): DisabledCodecs {
3024
- return { codecs: [], publish: [] };
3025
- }
3026
-
3027
- export const DisabledCodecs = {
3028
- encode(message: DisabledCodecs, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3029
- for (const v of message.codecs) {
3030
- Codec.encode(v!, writer.uint32(10).fork()).ldelim();
3031
- }
3032
- for (const v of message.publish) {
3033
- Codec.encode(v!, writer.uint32(18).fork()).ldelim();
3034
- }
3035
- return writer;
3036
- },
3037
-
3038
- decode(input: _m0.Reader | Uint8Array, length?: number): DisabledCodecs {
3039
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
3040
- let end = length === undefined ? reader.len : reader.pos + length;
3041
- const message = createBaseDisabledCodecs();
3042
- while (reader.pos < end) {
3043
- const tag = reader.uint32();
3044
- switch (tag >>> 3) {
3045
- case 1:
3046
- if (tag !== 10) {
3047
- break;
3048
- }
3049
-
3050
- message.codecs.push(Codec.decode(reader, reader.uint32()));
3051
- continue;
3052
- case 2:
3053
- if (tag !== 18) {
3054
- break;
3055
- }
3056
-
3057
- message.publish.push(Codec.decode(reader, reader.uint32()));
3058
- continue;
3059
- }
3060
- if ((tag & 7) === 4 || tag === 0) {
3061
- break;
3062
- }
3063
- reader.skipType(tag & 7);
3064
- }
3065
- return message;
3066
- },
3067
-
3068
- fromJSON(object: any): DisabledCodecs {
3069
- return {
3070
- codecs: Array.isArray(object?.codecs) ? object.codecs.map((e: any) => Codec.fromJSON(e)) : [],
3071
- publish: Array.isArray(object?.publish) ? object.publish.map((e: any) => Codec.fromJSON(e)) : [],
3072
- };
3073
- },
3074
-
3075
- toJSON(message: DisabledCodecs): unknown {
3076
- const obj: any = {};
3077
- if (message.codecs) {
3078
- obj.codecs = message.codecs.map((e) => e ? Codec.toJSON(e) : undefined);
3079
- } else {
3080
- obj.codecs = [];
3081
- }
3082
- if (message.publish) {
3083
- obj.publish = message.publish.map((e) => e ? Codec.toJSON(e) : undefined);
3084
- } else {
3085
- obj.publish = [];
3086
- }
3087
- return obj;
3088
- },
3089
-
3090
- create<I extends Exact<DeepPartial<DisabledCodecs>, I>>(base?: I): DisabledCodecs {
3091
- return DisabledCodecs.fromPartial(base ?? {});
3092
- },
3093
-
3094
- fromPartial<I extends Exact<DeepPartial<DisabledCodecs>, I>>(object: I): DisabledCodecs {
3095
- const message = createBaseDisabledCodecs();
3096
- message.codecs = object.codecs?.map((e) => Codec.fromPartial(e)) || [];
3097
- message.publish = object.publish?.map((e) => Codec.fromPartial(e)) || [];
3098
- return message;
3099
- },
3100
- };
3101
-
3102
- function createBaseRTPStats(): RTPStats {
3103
- return {
3104
- startTime: undefined,
3105
- endTime: undefined,
3106
- duration: 0,
3107
- packets: 0,
3108
- packetRate: 0,
3109
- bytes: 0,
3110
- headerBytes: 0,
3111
- bitrate: 0,
3112
- packetsLost: 0,
3113
- packetLossRate: 0,
3114
- packetLossPercentage: 0,
3115
- packetsDuplicate: 0,
3116
- packetDuplicateRate: 0,
3117
- bytesDuplicate: 0,
3118
- headerBytesDuplicate: 0,
3119
- bitrateDuplicate: 0,
3120
- packetsPadding: 0,
3121
- packetPaddingRate: 0,
3122
- bytesPadding: 0,
3123
- headerBytesPadding: 0,
3124
- bitratePadding: 0,
3125
- packetsOutOfOrder: 0,
3126
- frames: 0,
3127
- frameRate: 0,
3128
- jitterCurrent: 0,
3129
- jitterMax: 0,
3130
- gapHistogram: {},
3131
- nacks: 0,
3132
- nackAcks: 0,
3133
- nackMisses: 0,
3134
- nackRepeated: 0,
3135
- plis: 0,
3136
- lastPli: undefined,
3137
- firs: 0,
3138
- lastFir: undefined,
3139
- rttCurrent: 0,
3140
- rttMax: 0,
3141
- keyFrames: 0,
3142
- lastKeyFrame: undefined,
3143
- layerLockPlis: 0,
3144
- lastLayerLockPli: undefined,
3145
- sampleRate: 0,
3146
- driftMs: 0,
3147
- };
3148
- }
3149
-
3150
- export const RTPStats = {
3151
- encode(message: RTPStats, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3152
- if (message.startTime !== undefined) {
3153
- Timestamp.encode(toTimestamp(message.startTime), writer.uint32(10).fork()).ldelim();
3154
- }
3155
- if (message.endTime !== undefined) {
3156
- Timestamp.encode(toTimestamp(message.endTime), writer.uint32(18).fork()).ldelim();
3157
- }
3158
- if (message.duration !== 0) {
3159
- writer.uint32(25).double(message.duration);
3160
- }
3161
- if (message.packets !== 0) {
3162
- writer.uint32(32).uint32(message.packets);
3163
- }
3164
- if (message.packetRate !== 0) {
3165
- writer.uint32(41).double(message.packetRate);
3166
- }
3167
- if (message.bytes !== 0) {
3168
- writer.uint32(48).uint64(message.bytes);
3169
- }
3170
- if (message.headerBytes !== 0) {
3171
- writer.uint32(312).uint64(message.headerBytes);
3172
- }
3173
- if (message.bitrate !== 0) {
3174
- writer.uint32(57).double(message.bitrate);
3175
- }
3176
- if (message.packetsLost !== 0) {
3177
- writer.uint32(64).uint32(message.packetsLost);
3178
- }
3179
- if (message.packetLossRate !== 0) {
3180
- writer.uint32(73).double(message.packetLossRate);
3181
- }
3182
- if (message.packetLossPercentage !== 0) {
3183
- writer.uint32(85).float(message.packetLossPercentage);
3184
- }
3185
- if (message.packetsDuplicate !== 0) {
3186
- writer.uint32(88).uint32(message.packetsDuplicate);
3187
- }
3188
- if (message.packetDuplicateRate !== 0) {
3189
- writer.uint32(97).double(message.packetDuplicateRate);
3190
- }
3191
- if (message.bytesDuplicate !== 0) {
3192
- writer.uint32(104).uint64(message.bytesDuplicate);
3193
- }
3194
- if (message.headerBytesDuplicate !== 0) {
3195
- writer.uint32(320).uint64(message.headerBytesDuplicate);
3196
- }
3197
- if (message.bitrateDuplicate !== 0) {
3198
- writer.uint32(113).double(message.bitrateDuplicate);
3199
- }
3200
- if (message.packetsPadding !== 0) {
3201
- writer.uint32(120).uint32(message.packetsPadding);
3202
- }
3203
- if (message.packetPaddingRate !== 0) {
3204
- writer.uint32(129).double(message.packetPaddingRate);
3205
- }
3206
- if (message.bytesPadding !== 0) {
3207
- writer.uint32(136).uint64(message.bytesPadding);
3208
- }
3209
- if (message.headerBytesPadding !== 0) {
3210
- writer.uint32(328).uint64(message.headerBytesPadding);
3211
- }
3212
- if (message.bitratePadding !== 0) {
3213
- writer.uint32(145).double(message.bitratePadding);
3214
- }
3215
- if (message.packetsOutOfOrder !== 0) {
3216
- writer.uint32(152).uint32(message.packetsOutOfOrder);
3217
- }
3218
- if (message.frames !== 0) {
3219
- writer.uint32(160).uint32(message.frames);
3220
- }
3221
- if (message.frameRate !== 0) {
3222
- writer.uint32(169).double(message.frameRate);
3223
- }
3224
- if (message.jitterCurrent !== 0) {
3225
- writer.uint32(177).double(message.jitterCurrent);
3226
- }
3227
- if (message.jitterMax !== 0) {
3228
- writer.uint32(185).double(message.jitterMax);
3229
- }
3230
- Object.entries(message.gapHistogram).forEach(([key, value]) => {
3231
- RTPStats_GapHistogramEntry.encode({ key: key as any, value }, writer.uint32(194).fork()).ldelim();
3232
- });
3233
- if (message.nacks !== 0) {
3234
- writer.uint32(200).uint32(message.nacks);
3235
- }
3236
- if (message.nackAcks !== 0) {
3237
- writer.uint32(296).uint32(message.nackAcks);
3238
- }
3239
- if (message.nackMisses !== 0) {
3240
- writer.uint32(208).uint32(message.nackMisses);
3241
- }
3242
- if (message.nackRepeated !== 0) {
3243
- writer.uint32(304).uint32(message.nackRepeated);
3244
- }
3245
- if (message.plis !== 0) {
3246
- writer.uint32(216).uint32(message.plis);
3247
- }
3248
- if (message.lastPli !== undefined) {
3249
- Timestamp.encode(toTimestamp(message.lastPli), writer.uint32(226).fork()).ldelim();
3250
- }
3251
- if (message.firs !== 0) {
3252
- writer.uint32(232).uint32(message.firs);
3253
- }
3254
- if (message.lastFir !== undefined) {
3255
- Timestamp.encode(toTimestamp(message.lastFir), writer.uint32(242).fork()).ldelim();
3256
- }
3257
- if (message.rttCurrent !== 0) {
3258
- writer.uint32(248).uint32(message.rttCurrent);
3259
- }
3260
- if (message.rttMax !== 0) {
3261
- writer.uint32(256).uint32(message.rttMax);
3262
- }
3263
- if (message.keyFrames !== 0) {
3264
- writer.uint32(264).uint32(message.keyFrames);
3265
- }
3266
- if (message.lastKeyFrame !== undefined) {
3267
- Timestamp.encode(toTimestamp(message.lastKeyFrame), writer.uint32(274).fork()).ldelim();
3268
- }
3269
- if (message.layerLockPlis !== 0) {
3270
- writer.uint32(280).uint32(message.layerLockPlis);
3271
- }
3272
- if (message.lastLayerLockPli !== undefined) {
3273
- Timestamp.encode(toTimestamp(message.lastLayerLockPli), writer.uint32(290).fork()).ldelim();
3274
- }
3275
- if (message.sampleRate !== 0) {
3276
- writer.uint32(337).double(message.sampleRate);
3277
- }
3278
- if (message.driftMs !== 0) {
3279
- writer.uint32(345).double(message.driftMs);
3280
- }
3281
- return writer;
3282
- },
3283
-
3284
- decode(input: _m0.Reader | Uint8Array, length?: number): RTPStats {
3285
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
3286
- let end = length === undefined ? reader.len : reader.pos + length;
3287
- const message = createBaseRTPStats();
3288
- while (reader.pos < end) {
3289
- const tag = reader.uint32();
3290
- switch (tag >>> 3) {
3291
- case 1:
3292
- if (tag !== 10) {
3293
- break;
3294
- }
3295
-
3296
- message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
3297
- continue;
3298
- case 2:
3299
- if (tag !== 18) {
3300
- break;
3301
- }
3302
-
3303
- message.endTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
3304
- continue;
3305
- case 3:
3306
- if (tag !== 25) {
3307
- break;
3308
- }
3309
-
3310
- message.duration = reader.double();
3311
- continue;
3312
- case 4:
3313
- if (tag !== 32) {
3314
- break;
3315
- }
3316
-
3317
- message.packets = reader.uint32();
3318
- continue;
3319
- case 5:
3320
- if (tag !== 41) {
3321
- break;
3322
- }
3323
-
3324
- message.packetRate = reader.double();
3325
- continue;
3326
- case 6:
3327
- if (tag !== 48) {
3328
- break;
3329
- }
3330
-
3331
- message.bytes = longToNumber(reader.uint64() as Long);
3332
- continue;
3333
- case 39:
3334
- if (tag !== 312) {
3335
- break;
3336
- }
3337
-
3338
- message.headerBytes = longToNumber(reader.uint64() as Long);
3339
- continue;
3340
- case 7:
3341
- if (tag !== 57) {
3342
- break;
3343
- }
3344
-
3345
- message.bitrate = reader.double();
3346
- continue;
3347
- case 8:
3348
- if (tag !== 64) {
3349
- break;
3350
- }
3351
-
3352
- message.packetsLost = reader.uint32();
3353
- continue;
3354
- case 9:
3355
- if (tag !== 73) {
3356
- break;
3357
- }
3358
-
3359
- message.packetLossRate = reader.double();
3360
- continue;
3361
- case 10:
3362
- if (tag !== 85) {
3363
- break;
3364
- }
3365
-
3366
- message.packetLossPercentage = reader.float();
3367
- continue;
3368
- case 11:
3369
- if (tag !== 88) {
3370
- break;
3371
- }
3372
-
3373
- message.packetsDuplicate = reader.uint32();
3374
- continue;
3375
- case 12:
3376
- if (tag !== 97) {
3377
- break;
3378
- }
3379
-
3380
- message.packetDuplicateRate = reader.double();
3381
- continue;
3382
- case 13:
3383
- if (tag !== 104) {
3384
- break;
3385
- }
3386
-
3387
- message.bytesDuplicate = longToNumber(reader.uint64() as Long);
3388
- continue;
3389
- case 40:
3390
- if (tag !== 320) {
3391
- break;
3392
- }
3393
-
3394
- message.headerBytesDuplicate = longToNumber(reader.uint64() as Long);
3395
- continue;
3396
- case 14:
3397
- if (tag !== 113) {
3398
- break;
3399
- }
3400
-
3401
- message.bitrateDuplicate = reader.double();
3402
- continue;
3403
- case 15:
3404
- if (tag !== 120) {
3405
- break;
3406
- }
3407
-
3408
- message.packetsPadding = reader.uint32();
3409
- continue;
3410
- case 16:
3411
- if (tag !== 129) {
3412
- break;
3413
- }
3414
-
3415
- message.packetPaddingRate = reader.double();
3416
- continue;
3417
- case 17:
3418
- if (tag !== 136) {
3419
- break;
3420
- }
3421
-
3422
- message.bytesPadding = longToNumber(reader.uint64() as Long);
3423
- continue;
3424
- case 41:
3425
- if (tag !== 328) {
3426
- break;
3427
- }
3428
-
3429
- message.headerBytesPadding = longToNumber(reader.uint64() as Long);
3430
- continue;
3431
- case 18:
3432
- if (tag !== 145) {
3433
- break;
3434
- }
3435
-
3436
- message.bitratePadding = reader.double();
3437
- continue;
3438
- case 19:
3439
- if (tag !== 152) {
3440
- break;
3441
- }
3442
-
3443
- message.packetsOutOfOrder = reader.uint32();
3444
- continue;
3445
- case 20:
3446
- if (tag !== 160) {
3447
- break;
3448
- }
3449
-
3450
- message.frames = reader.uint32();
3451
- continue;
3452
- case 21:
3453
- if (tag !== 169) {
3454
- break;
3455
- }
3456
-
3457
- message.frameRate = reader.double();
3458
- continue;
3459
- case 22:
3460
- if (tag !== 177) {
3461
- break;
3462
- }
3463
-
3464
- message.jitterCurrent = reader.double();
3465
- continue;
3466
- case 23:
3467
- if (tag !== 185) {
3468
- break;
3469
- }
3470
-
3471
- message.jitterMax = reader.double();
3472
- continue;
3473
- case 24:
3474
- if (tag !== 194) {
3475
- break;
3476
- }
3477
-
3478
- const entry24 = RTPStats_GapHistogramEntry.decode(reader, reader.uint32());
3479
- if (entry24.value !== undefined) {
3480
- message.gapHistogram[entry24.key] = entry24.value;
3481
- }
3482
- continue;
3483
- case 25:
3484
- if (tag !== 200) {
3485
- break;
3486
- }
3487
-
3488
- message.nacks = reader.uint32();
3489
- continue;
3490
- case 37:
3491
- if (tag !== 296) {
3492
- break;
3493
- }
3494
-
3495
- message.nackAcks = reader.uint32();
3496
- continue;
3497
- case 26:
3498
- if (tag !== 208) {
3499
- break;
3500
- }
3501
-
3502
- message.nackMisses = reader.uint32();
3503
- continue;
3504
- case 38:
3505
- if (tag !== 304) {
3506
- break;
3507
- }
3508
-
3509
- message.nackRepeated = reader.uint32();
3510
- continue;
3511
- case 27:
3512
- if (tag !== 216) {
3513
- break;
3514
- }
3515
-
3516
- message.plis = reader.uint32();
3517
- continue;
3518
- case 28:
3519
- if (tag !== 226) {
3520
- break;
3521
- }
3522
-
3523
- message.lastPli = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
3524
- continue;
3525
- case 29:
3526
- if (tag !== 232) {
3527
- break;
3528
- }
3529
-
3530
- message.firs = reader.uint32();
3531
- continue;
3532
- case 30:
3533
- if (tag !== 242) {
3534
- break;
3535
- }
3536
-
3537
- message.lastFir = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
3538
- continue;
3539
- case 31:
3540
- if (tag !== 248) {
3541
- break;
3542
- }
3543
-
3544
- message.rttCurrent = reader.uint32();
3545
- continue;
3546
- case 32:
3547
- if (tag !== 256) {
3548
- break;
3549
- }
3550
-
3551
- message.rttMax = reader.uint32();
3552
- continue;
3553
- case 33:
3554
- if (tag !== 264) {
3555
- break;
3556
- }
3557
-
3558
- message.keyFrames = reader.uint32();
3559
- continue;
3560
- case 34:
3561
- if (tag !== 274) {
3562
- break;
3563
- }
3564
-
3565
- message.lastKeyFrame = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
3566
- continue;
3567
- case 35:
3568
- if (tag !== 280) {
3569
- break;
3570
- }
3571
-
3572
- message.layerLockPlis = reader.uint32();
3573
- continue;
3574
- case 36:
3575
- if (tag !== 290) {
3576
- break;
3577
- }
3578
-
3579
- message.lastLayerLockPli = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
3580
- continue;
3581
- case 42:
3582
- if (tag !== 337) {
3583
- break;
3584
- }
3585
-
3586
- message.sampleRate = reader.double();
3587
- continue;
3588
- case 43:
3589
- if (tag !== 345) {
3590
- break;
3591
- }
3592
-
3593
- message.driftMs = reader.double();
3594
- continue;
3595
- }
3596
- if ((tag & 7) === 4 || tag === 0) {
3597
- break;
3598
- }
3599
- reader.skipType(tag & 7);
3600
- }
3601
- return message;
3602
- },
3603
-
3604
- fromJSON(object: any): RTPStats {
3605
- return {
3606
- startTime: isSet(object.startTime) ? fromJsonTimestamp(object.startTime) : undefined,
3607
- endTime: isSet(object.endTime) ? fromJsonTimestamp(object.endTime) : undefined,
3608
- duration: isSet(object.duration) ? Number(object.duration) : 0,
3609
- packets: isSet(object.packets) ? Number(object.packets) : 0,
3610
- packetRate: isSet(object.packetRate) ? Number(object.packetRate) : 0,
3611
- bytes: isSet(object.bytes) ? Number(object.bytes) : 0,
3612
- headerBytes: isSet(object.headerBytes) ? Number(object.headerBytes) : 0,
3613
- bitrate: isSet(object.bitrate) ? Number(object.bitrate) : 0,
3614
- packetsLost: isSet(object.packetsLost) ? Number(object.packetsLost) : 0,
3615
- packetLossRate: isSet(object.packetLossRate) ? Number(object.packetLossRate) : 0,
3616
- packetLossPercentage: isSet(object.packetLossPercentage) ? Number(object.packetLossPercentage) : 0,
3617
- packetsDuplicate: isSet(object.packetsDuplicate) ? Number(object.packetsDuplicate) : 0,
3618
- packetDuplicateRate: isSet(object.packetDuplicateRate) ? Number(object.packetDuplicateRate) : 0,
3619
- bytesDuplicate: isSet(object.bytesDuplicate) ? Number(object.bytesDuplicate) : 0,
3620
- headerBytesDuplicate: isSet(object.headerBytesDuplicate) ? Number(object.headerBytesDuplicate) : 0,
3621
- bitrateDuplicate: isSet(object.bitrateDuplicate) ? Number(object.bitrateDuplicate) : 0,
3622
- packetsPadding: isSet(object.packetsPadding) ? Number(object.packetsPadding) : 0,
3623
- packetPaddingRate: isSet(object.packetPaddingRate) ? Number(object.packetPaddingRate) : 0,
3624
- bytesPadding: isSet(object.bytesPadding) ? Number(object.bytesPadding) : 0,
3625
- headerBytesPadding: isSet(object.headerBytesPadding) ? Number(object.headerBytesPadding) : 0,
3626
- bitratePadding: isSet(object.bitratePadding) ? Number(object.bitratePadding) : 0,
3627
- packetsOutOfOrder: isSet(object.packetsOutOfOrder) ? Number(object.packetsOutOfOrder) : 0,
3628
- frames: isSet(object.frames) ? Number(object.frames) : 0,
3629
- frameRate: isSet(object.frameRate) ? Number(object.frameRate) : 0,
3630
- jitterCurrent: isSet(object.jitterCurrent) ? Number(object.jitterCurrent) : 0,
3631
- jitterMax: isSet(object.jitterMax) ? Number(object.jitterMax) : 0,
3632
- gapHistogram: isObject(object.gapHistogram)
3633
- ? Object.entries(object.gapHistogram).reduce<{ [key: number]: number }>((acc, [key, value]) => {
3634
- acc[Number(key)] = Number(value);
3635
- return acc;
3636
- }, {})
3637
- : {},
3638
- nacks: isSet(object.nacks) ? Number(object.nacks) : 0,
3639
- nackAcks: isSet(object.nackAcks) ? Number(object.nackAcks) : 0,
3640
- nackMisses: isSet(object.nackMisses) ? Number(object.nackMisses) : 0,
3641
- nackRepeated: isSet(object.nackRepeated) ? Number(object.nackRepeated) : 0,
3642
- plis: isSet(object.plis) ? Number(object.plis) : 0,
3643
- lastPli: isSet(object.lastPli) ? fromJsonTimestamp(object.lastPli) : undefined,
3644
- firs: isSet(object.firs) ? Number(object.firs) : 0,
3645
- lastFir: isSet(object.lastFir) ? fromJsonTimestamp(object.lastFir) : undefined,
3646
- rttCurrent: isSet(object.rttCurrent) ? Number(object.rttCurrent) : 0,
3647
- rttMax: isSet(object.rttMax) ? Number(object.rttMax) : 0,
3648
- keyFrames: isSet(object.keyFrames) ? Number(object.keyFrames) : 0,
3649
- lastKeyFrame: isSet(object.lastKeyFrame) ? fromJsonTimestamp(object.lastKeyFrame) : undefined,
3650
- layerLockPlis: isSet(object.layerLockPlis) ? Number(object.layerLockPlis) : 0,
3651
- lastLayerLockPli: isSet(object.lastLayerLockPli) ? fromJsonTimestamp(object.lastLayerLockPli) : undefined,
3652
- sampleRate: isSet(object.sampleRate) ? Number(object.sampleRate) : 0,
3653
- driftMs: isSet(object.driftMs) ? Number(object.driftMs) : 0,
3654
- };
3655
- },
3656
-
3657
- toJSON(message: RTPStats): unknown {
3658
- const obj: any = {};
3659
- message.startTime !== undefined && (obj.startTime = message.startTime.toISOString());
3660
- message.endTime !== undefined && (obj.endTime = message.endTime.toISOString());
3661
- message.duration !== undefined && (obj.duration = message.duration);
3662
- message.packets !== undefined && (obj.packets = Math.round(message.packets));
3663
- message.packetRate !== undefined && (obj.packetRate = message.packetRate);
3664
- message.bytes !== undefined && (obj.bytes = Math.round(message.bytes));
3665
- message.headerBytes !== undefined && (obj.headerBytes = Math.round(message.headerBytes));
3666
- message.bitrate !== undefined && (obj.bitrate = message.bitrate);
3667
- message.packetsLost !== undefined && (obj.packetsLost = Math.round(message.packetsLost));
3668
- message.packetLossRate !== undefined && (obj.packetLossRate = message.packetLossRate);
3669
- message.packetLossPercentage !== undefined && (obj.packetLossPercentage = message.packetLossPercentage);
3670
- message.packetsDuplicate !== undefined && (obj.packetsDuplicate = Math.round(message.packetsDuplicate));
3671
- message.packetDuplicateRate !== undefined && (obj.packetDuplicateRate = message.packetDuplicateRate);
3672
- message.bytesDuplicate !== undefined && (obj.bytesDuplicate = Math.round(message.bytesDuplicate));
3673
- message.headerBytesDuplicate !== undefined && (obj.headerBytesDuplicate = Math.round(message.headerBytesDuplicate));
3674
- message.bitrateDuplicate !== undefined && (obj.bitrateDuplicate = message.bitrateDuplicate);
3675
- message.packetsPadding !== undefined && (obj.packetsPadding = Math.round(message.packetsPadding));
3676
- message.packetPaddingRate !== undefined && (obj.packetPaddingRate = message.packetPaddingRate);
3677
- message.bytesPadding !== undefined && (obj.bytesPadding = Math.round(message.bytesPadding));
3678
- message.headerBytesPadding !== undefined && (obj.headerBytesPadding = Math.round(message.headerBytesPadding));
3679
- message.bitratePadding !== undefined && (obj.bitratePadding = message.bitratePadding);
3680
- message.packetsOutOfOrder !== undefined && (obj.packetsOutOfOrder = Math.round(message.packetsOutOfOrder));
3681
- message.frames !== undefined && (obj.frames = Math.round(message.frames));
3682
- message.frameRate !== undefined && (obj.frameRate = message.frameRate);
3683
- message.jitterCurrent !== undefined && (obj.jitterCurrent = message.jitterCurrent);
3684
- message.jitterMax !== undefined && (obj.jitterMax = message.jitterMax);
3685
- obj.gapHistogram = {};
3686
- if (message.gapHistogram) {
3687
- Object.entries(message.gapHistogram).forEach(([k, v]) => {
3688
- obj.gapHistogram[k] = Math.round(v);
3689
- });
3690
- }
3691
- message.nacks !== undefined && (obj.nacks = Math.round(message.nacks));
3692
- message.nackAcks !== undefined && (obj.nackAcks = Math.round(message.nackAcks));
3693
- message.nackMisses !== undefined && (obj.nackMisses = Math.round(message.nackMisses));
3694
- message.nackRepeated !== undefined && (obj.nackRepeated = Math.round(message.nackRepeated));
3695
- message.plis !== undefined && (obj.plis = Math.round(message.plis));
3696
- message.lastPli !== undefined && (obj.lastPli = message.lastPli.toISOString());
3697
- message.firs !== undefined && (obj.firs = Math.round(message.firs));
3698
- message.lastFir !== undefined && (obj.lastFir = message.lastFir.toISOString());
3699
- message.rttCurrent !== undefined && (obj.rttCurrent = Math.round(message.rttCurrent));
3700
- message.rttMax !== undefined && (obj.rttMax = Math.round(message.rttMax));
3701
- message.keyFrames !== undefined && (obj.keyFrames = Math.round(message.keyFrames));
3702
- message.lastKeyFrame !== undefined && (obj.lastKeyFrame = message.lastKeyFrame.toISOString());
3703
- message.layerLockPlis !== undefined && (obj.layerLockPlis = Math.round(message.layerLockPlis));
3704
- message.lastLayerLockPli !== undefined && (obj.lastLayerLockPli = message.lastLayerLockPli.toISOString());
3705
- message.sampleRate !== undefined && (obj.sampleRate = message.sampleRate);
3706
- message.driftMs !== undefined && (obj.driftMs = message.driftMs);
3707
- return obj;
3708
- },
3709
-
3710
- create<I extends Exact<DeepPartial<RTPStats>, I>>(base?: I): RTPStats {
3711
- return RTPStats.fromPartial(base ?? {});
3712
- },
3713
-
3714
- fromPartial<I extends Exact<DeepPartial<RTPStats>, I>>(object: I): RTPStats {
3715
- const message = createBaseRTPStats();
3716
- message.startTime = object.startTime ?? undefined;
3717
- message.endTime = object.endTime ?? undefined;
3718
- message.duration = object.duration ?? 0;
3719
- message.packets = object.packets ?? 0;
3720
- message.packetRate = object.packetRate ?? 0;
3721
- message.bytes = object.bytes ?? 0;
3722
- message.headerBytes = object.headerBytes ?? 0;
3723
- message.bitrate = object.bitrate ?? 0;
3724
- message.packetsLost = object.packetsLost ?? 0;
3725
- message.packetLossRate = object.packetLossRate ?? 0;
3726
- message.packetLossPercentage = object.packetLossPercentage ?? 0;
3727
- message.packetsDuplicate = object.packetsDuplicate ?? 0;
3728
- message.packetDuplicateRate = object.packetDuplicateRate ?? 0;
3729
- message.bytesDuplicate = object.bytesDuplicate ?? 0;
3730
- message.headerBytesDuplicate = object.headerBytesDuplicate ?? 0;
3731
- message.bitrateDuplicate = object.bitrateDuplicate ?? 0;
3732
- message.packetsPadding = object.packetsPadding ?? 0;
3733
- message.packetPaddingRate = object.packetPaddingRate ?? 0;
3734
- message.bytesPadding = object.bytesPadding ?? 0;
3735
- message.headerBytesPadding = object.headerBytesPadding ?? 0;
3736
- message.bitratePadding = object.bitratePadding ?? 0;
3737
- message.packetsOutOfOrder = object.packetsOutOfOrder ?? 0;
3738
- message.frames = object.frames ?? 0;
3739
- message.frameRate = object.frameRate ?? 0;
3740
- message.jitterCurrent = object.jitterCurrent ?? 0;
3741
- message.jitterMax = object.jitterMax ?? 0;
3742
- message.gapHistogram = Object.entries(object.gapHistogram ?? {}).reduce<{ [key: number]: number }>(
3743
- (acc, [key, value]) => {
3744
- if (value !== undefined) {
3745
- acc[Number(key)] = Number(value);
3746
- }
3747
- return acc;
3748
- },
3749
- {},
3750
- );
3751
- message.nacks = object.nacks ?? 0;
3752
- message.nackAcks = object.nackAcks ?? 0;
3753
- message.nackMisses = object.nackMisses ?? 0;
3754
- message.nackRepeated = object.nackRepeated ?? 0;
3755
- message.plis = object.plis ?? 0;
3756
- message.lastPli = object.lastPli ?? undefined;
3757
- message.firs = object.firs ?? 0;
3758
- message.lastFir = object.lastFir ?? undefined;
3759
- message.rttCurrent = object.rttCurrent ?? 0;
3760
- message.rttMax = object.rttMax ?? 0;
3761
- message.keyFrames = object.keyFrames ?? 0;
3762
- message.lastKeyFrame = object.lastKeyFrame ?? undefined;
3763
- message.layerLockPlis = object.layerLockPlis ?? 0;
3764
- message.lastLayerLockPli = object.lastLayerLockPli ?? undefined;
3765
- message.sampleRate = object.sampleRate ?? 0;
3766
- message.driftMs = object.driftMs ?? 0;
3767
- return message;
3768
- },
3769
- };
3770
-
3771
- function createBaseRTPStats_GapHistogramEntry(): RTPStats_GapHistogramEntry {
3772
- return { key: 0, value: 0 };
3773
- }
3774
-
3775
- export const RTPStats_GapHistogramEntry = {
3776
- encode(message: RTPStats_GapHistogramEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3777
- if (message.key !== 0) {
3778
- writer.uint32(8).int32(message.key);
3779
- }
3780
- if (message.value !== 0) {
3781
- writer.uint32(16).uint32(message.value);
3782
- }
3783
- return writer;
3784
- },
3785
-
3786
- decode(input: _m0.Reader | Uint8Array, length?: number): RTPStats_GapHistogramEntry {
3787
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
3788
- let end = length === undefined ? reader.len : reader.pos + length;
3789
- const message = createBaseRTPStats_GapHistogramEntry();
3790
- while (reader.pos < end) {
3791
- const tag = reader.uint32();
3792
- switch (tag >>> 3) {
3793
- case 1:
3794
- if (tag !== 8) {
3795
- break;
3796
- }
3797
-
3798
- message.key = reader.int32();
3799
- continue;
3800
- case 2:
3801
- if (tag !== 16) {
3802
- break;
3803
- }
3804
-
3805
- message.value = reader.uint32();
3806
- continue;
3807
- }
3808
- if ((tag & 7) === 4 || tag === 0) {
3809
- break;
3810
- }
3811
- reader.skipType(tag & 7);
3812
- }
3813
- return message;
3814
- },
3815
-
3816
- fromJSON(object: any): RTPStats_GapHistogramEntry {
3817
- return { key: isSet(object.key) ? Number(object.key) : 0, value: isSet(object.value) ? Number(object.value) : 0 };
3818
- },
3819
-
3820
- toJSON(message: RTPStats_GapHistogramEntry): unknown {
3821
- const obj: any = {};
3822
- message.key !== undefined && (obj.key = Math.round(message.key));
3823
- message.value !== undefined && (obj.value = Math.round(message.value));
3824
- return obj;
3825
- },
3826
-
3827
- create<I extends Exact<DeepPartial<RTPStats_GapHistogramEntry>, I>>(base?: I): RTPStats_GapHistogramEntry {
3828
- return RTPStats_GapHistogramEntry.fromPartial(base ?? {});
3829
- },
3830
-
3831
- fromPartial<I extends Exact<DeepPartial<RTPStats_GapHistogramEntry>, I>>(object: I): RTPStats_GapHistogramEntry {
3832
- const message = createBaseRTPStats_GapHistogramEntry();
3833
- message.key = object.key ?? 0;
3834
- message.value = object.value ?? 0;
3835
- return message;
3836
- },
3837
- };
3838
-
3839
- function createBaseTimedVersion(): TimedVersion {
3840
- return { unixMicro: 0, ticks: 0 };
3841
- }
3842
-
3843
- export const TimedVersion = {
3844
- encode(message: TimedVersion, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3845
- if (message.unixMicro !== 0) {
3846
- writer.uint32(8).int64(message.unixMicro);
3847
- }
3848
- if (message.ticks !== 0) {
3849
- writer.uint32(16).int32(message.ticks);
3850
- }
3851
- return writer;
3852
- },
3853
-
3854
- decode(input: _m0.Reader | Uint8Array, length?: number): TimedVersion {
3855
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
3856
- let end = length === undefined ? reader.len : reader.pos + length;
3857
- const message = createBaseTimedVersion();
3858
- while (reader.pos < end) {
3859
- const tag = reader.uint32();
3860
- switch (tag >>> 3) {
3861
- case 1:
3862
- if (tag !== 8) {
3863
- break;
3864
- }
3865
-
3866
- message.unixMicro = longToNumber(reader.int64() as Long);
3867
- continue;
3868
- case 2:
3869
- if (tag !== 16) {
3870
- break;
3871
- }
3872
-
3873
- message.ticks = reader.int32();
3874
- continue;
3875
- }
3876
- if ((tag & 7) === 4 || tag === 0) {
3877
- break;
3878
- }
3879
- reader.skipType(tag & 7);
3880
- }
3881
- return message;
3882
- },
3883
-
3884
- fromJSON(object: any): TimedVersion {
3885
- return {
3886
- unixMicro: isSet(object.unixMicro) ? Number(object.unixMicro) : 0,
3887
- ticks: isSet(object.ticks) ? Number(object.ticks) : 0,
3888
- };
3889
- },
3890
-
3891
- toJSON(message: TimedVersion): unknown {
3892
- const obj: any = {};
3893
- message.unixMicro !== undefined && (obj.unixMicro = Math.round(message.unixMicro));
3894
- message.ticks !== undefined && (obj.ticks = Math.round(message.ticks));
3895
- return obj;
3896
- },
3897
-
3898
- create<I extends Exact<DeepPartial<TimedVersion>, I>>(base?: I): TimedVersion {
3899
- return TimedVersion.fromPartial(base ?? {});
3900
- },
3901
-
3902
- fromPartial<I extends Exact<DeepPartial<TimedVersion>, I>>(object: I): TimedVersion {
3903
- const message = createBaseTimedVersion();
3904
- message.unixMicro = object.unixMicro ?? 0;
3905
- message.ticks = object.ticks ?? 0;
3906
- return message;
3907
- },
3908
- };
3909
-
3910
- declare var self: any | undefined;
3911
- declare var window: any | undefined;
3912
- declare var global: any | undefined;
3913
- var tsProtoGlobalThis: any = (() => {
3914
- if (typeof globalThis !== "undefined") {
3915
- return globalThis;
3916
- }
3917
- if (typeof self !== "undefined") {
3918
- return self;
3919
- }
3920
- if (typeof window !== "undefined") {
3921
- return window;
3922
- }
3923
- if (typeof global !== "undefined") {
3924
- return global;
3925
- }
3926
- throw "Unable to locate global object";
3927
- })();
3928
-
3929
- function bytesFromBase64(b64: string): Uint8Array {
3930
- if (tsProtoGlobalThis.Buffer) {
3931
- return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64"));
3932
- } else {
3933
- const bin = tsProtoGlobalThis.atob(b64);
3934
- const arr = new Uint8Array(bin.length);
3935
- for (let i = 0; i < bin.length; ++i) {
3936
- arr[i] = bin.charCodeAt(i);
3937
- }
3938
- return arr;
3939
- }
3940
- }
3941
-
3942
- function base64FromBytes(arr: Uint8Array): string {
3943
- if (tsProtoGlobalThis.Buffer) {
3944
- return tsProtoGlobalThis.Buffer.from(arr).toString("base64");
3945
- } else {
3946
- const bin: string[] = [];
3947
- arr.forEach((byte) => {
3948
- bin.push(String.fromCharCode(byte));
3949
- });
3950
- return tsProtoGlobalThis.btoa(bin.join(""));
3951
- }
3952
- }
3953
-
3954
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
3955
-
3956
- export type DeepPartial<T> = T extends Builtin ? T
3957
- : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
3958
- : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] }
3959
- : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
3960
- : Partial<T>;
3961
-
3962
- type KeysOfUnion<T> = T extends T ? keyof T : never;
3963
- export type Exact<P, I extends P> = P extends Builtin ? P
3964
- : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
3965
-
3966
- function toTimestamp(date: Date): Timestamp {
3967
- const seconds = date.getTime() / 1_000;
3968
- const nanos = (date.getTime() % 1_000) * 1_000_000;
3969
- return { seconds, nanos };
3970
- }
3971
-
3972
- function fromTimestamp(t: Timestamp): Date {
3973
- let millis = (t.seconds || 0) * 1_000;
3974
- millis += (t.nanos || 0) / 1_000_000;
3975
- return new Date(millis);
3976
- }
3977
-
3978
- function fromJsonTimestamp(o: any): Date {
3979
- if (o instanceof Date) {
3980
- return o;
3981
- } else if (typeof o === "string") {
3982
- return new Date(o);
3983
- } else {
3984
- return fromTimestamp(Timestamp.fromJSON(o));
3985
- }
3986
- }
3987
-
3988
- function longToNumber(long: Long): number {
3989
- if (long.gt(Number.MAX_SAFE_INTEGER)) {
3990
- throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
3991
- }
3992
- return long.toNumber();
3993
- }
3994
-
3995
- if (_m0.util.Long !== Long) {
3996
- _m0.util.Long = Long as any;
3997
- _m0.configure();
3998
- }
3999
-
4000
- function isObject(value: any): boolean {
4001
- return typeof value === "object" && value !== null;
4002
- }
4003
-
4004
- function isSet(value: any): boolean {
4005
- return value !== null && value !== undefined;
4006
- }