tirtc-devtools-cli 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +17 -11
  2. package/USAGE.md +72 -33
  3. package/bin/tirtc-devtools-cli.js +1 -1
  4. package/dist/cli/src/bootstrap_flows.d.ts +46 -0
  5. package/dist/cli/src/bootstrap_flows.js +249 -0
  6. package/dist/{devtools/cli → cli}/src/config.d.ts +4 -15
  7. package/dist/{devtools/cli → cli}/src/config.js +7 -31
  8. package/dist/cli/src/default_paths.d.ts +3 -0
  9. package/dist/cli/src/default_paths.js +23 -0
  10. package/dist/{devtools/cli → cli}/src/embedded_paths.d.ts +1 -0
  11. package/dist/{devtools/cli → cli}/src/embedded_paths.js +18 -1
  12. package/dist/{devtools/cli → cli}/src/facade.d.ts +41 -235
  13. package/dist/{devtools/cli → cli}/src/facade.js +8 -27
  14. package/dist/cli/src/guide.js +47 -0
  15. package/dist/{devtools/cli → cli}/src/index.js +55 -141
  16. package/dist/{devtools/cli → cli}/src/session_manager.js +9 -11
  17. package/dist/{devtools/cli → cli}/src/token_command.js +69 -0
  18. package/dist/{devtools/cli → cli}/src/token_tool.d.ts +26 -0
  19. package/dist/{devtools/cli → cli}/src/token_tool.js +123 -22
  20. package/dist/{devtools/cli → cli}/src/transport.d.ts +1 -1
  21. package/package.json +6 -2
  22. package/script/ensure_ffmpeg.sh +1 -1
  23. package/vendor/app-server/bin/native/linux-x64/credential_napi.node +0 -0
  24. package/vendor/app-server/bin/native/macos-arm64/credential_napi.node +0 -0
  25. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/credential.h +34 -0
  26. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/error.h +13 -0
  27. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/foundation/build_info.h +27 -0
  28. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/http.h +57 -0
  29. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/logging.h +3 -1
  30. package/vendor/app-server/bin/runtime/linux-x64/lib/libcrypto.a +0 -0
  31. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_credential.a +0 -0
  32. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_http.a +0 -0
  33. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  34. package/vendor/app-server/bin/runtime/linux-x64/lib/libssl.a +0 -0
  35. package/vendor/app-server/bin/runtime/linux-x64/manifest.txt +2 -32
  36. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio.h +176 -133
  37. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/av.h +223 -182
  38. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/error.h +2 -0
  39. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_downlink.h +6 -0
  40. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/transport.h +58 -133
  41. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/trp.h +47 -224
  42. package/vendor/app-server/bin/runtime/macos-arm64/lib/libTGTRP.a +0 -0
  43. package/vendor/app-server/bin/runtime/macos-arm64/lib/libTiRTC.a +0 -0
  44. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_audio.a +0 -0
  45. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_credential.a +0 -0
  46. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
  47. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_http.a +0 -0
  48. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  49. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
  50. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
  51. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
  52. package/vendor/app-server/bin/runtime/macos-arm64/manifest.txt +19 -15
  53. package/vendor/app-server/dist/host/HostCommandCoordinator.d.ts +19 -0
  54. package/vendor/app-server/dist/host/HostCommandCoordinator.js +196 -0
  55. package/vendor/app-server/dist/host/HostProtocol.d.ts +1 -11
  56. package/vendor/app-server/dist/host/HostProtocol.js +3 -37
  57. package/vendor/app-server/dist/host/HostServer.d.ts +1 -4
  58. package/vendor/app-server/dist/host/HostServer.js +16 -152
  59. package/vendor/app-server/dist/host/RuntimeAdapter.js +2 -2
  60. package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.js +3 -3
  61. package/vendor/app-server/dist/host/native/RuntimeHostBridge.js +4 -4
  62. package/vendor/app-server/dist/host/runtime_backed_preflight.js +2 -2
  63. package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.js +1 -1
  64. package/vendor/app-server/dist/protocol/contract.d.ts +5 -64
  65. package/vendor/app-server/dist/protocol/contract.js +3 -12
  66. package/dist/devtools/cli/src/guide.js +0 -50
  67. package/dist/dummy.d.ts +0 -0
  68. package/dist/dummy.js +0 -1
  69. package/dist/index.d.ts +0 -1
  70. package/dist/index.js +0 -48
  71. package/vendor/app-server/bin/native/macos-arm64/libcrypto.dylib +0 -0
  72. package/vendor/app-server/bin/native/macos-arm64/libssl.dylib +0 -0
  73. package/vendor/app-server/bin/native/macos-arm64/runtime_host_napi.node +0 -0
  74. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_codec.h +0 -23
  75. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_frame.h +0 -36
  76. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io.h +0 -56
  77. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_android.h +0 -19
  78. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_apple.h +0 -19
  79. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_harmony.h +0 -19
  80. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_windows.h +0 -19
  81. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_processing.h +0 -56
  82. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_sample_rate.h +0 -18
  83. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_codec.h +0 -21
  84. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_downlink.h +0 -89
  85. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_uplink.h +0 -115
  86. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/runtime.h +0 -236
  87. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_codec.h +0 -57
  88. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_frame.h +0 -55
  89. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io.h +0 -46
  90. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_android.h +0 -32
  91. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_apple.h +0 -34
  92. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_harmony.h +0 -32
  93. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_windows.h +0 -26
  94. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_processing.h +0 -34
  95. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_audio.a +0 -0
  96. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_facade.a +0 -0
  97. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_media.a +0 -0
  98. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_video.a +0 -0
  99. package/vendor/app-server/bin/runtime/linux-x64/lib/libwebrtc_apm.a +0 -0
  100. package/vendor/app-server/dist/host/RuntimeCredentialTokenIssuer.d.ts +0 -30
  101. package/vendor/app-server/dist/host/RuntimeCredentialTokenIssuer.js +0 -224
  102. /package/dist/{devtools/cli → cli}/src/dummy.d.ts +0 -0
  103. /package/dist/{devtools/cli → cli}/src/dummy.js +0 -0
  104. /package/dist/{devtools/cli → cli}/src/ffmpeg_tool.d.ts +0 -0
  105. /package/dist/{devtools/cli → cli}/src/ffmpeg_tool.js +0 -0
  106. /package/dist/{devtools/cli → cli}/src/guide.d.ts +0 -0
  107. /package/dist/{devtools/cli → cli}/src/index.d.ts +0 -0
  108. /package/dist/{devtools/cli → cli}/src/media_assets.d.ts +0 -0
  109. /package/dist/{devtools/cli → cli}/src/media_assets.js +0 -0
  110. /package/dist/{devtools/cli → cli}/src/progress.d.ts +0 -0
  111. /package/dist/{devtools/cli → cli}/src/progress.js +0 -0
  112. /package/dist/{devtools/cli → cli}/src/session_manager.d.ts +0 -0
  113. /package/dist/{devtools/cli → cli}/src/token_command.d.ts +0 -0
  114. /package/dist/{devtools/cli → cli}/src/transport.js +0 -0
  115. /package/vendor/app-server/bin/{native/macos-arm64 → runtime/macos-arm64/lib}/libtgrtc.dylib +0 -0
@@ -4,42 +4,12 @@
4
4
  #include <stddef.h>
5
5
  #include <stdint.h>
6
6
 
7
+ #include "tirtc/error.h"
8
+
7
9
  #ifdef __cplusplus
8
10
  extern "C" {
9
11
  #endif
10
12
 
11
- /**
12
- * @brief Transport API status code.
13
- */
14
- typedef enum TirtcTransportStatus {
15
- /** Operation succeeded. */
16
- TIRTC_TRANSPORT_STATUS_OK = 0,
17
- /** Input argument is invalid. */
18
- TIRTC_TRANSPORT_STATUS_INVALID_ARGUMENT = 1,
19
- /** Transport runtime has not been initialized. */
20
- TIRTC_TRANSPORT_STATUS_NOT_INITIALIZED = 2,
21
- /** Connection is not established or already closed. */
22
- TIRTC_TRANSPORT_STATUS_NOT_CONNECTED = 3,
23
- /** Requested operation is not supported by current backend. */
24
- TIRTC_TRANSPORT_STATUS_UNSUPPORTED = 4,
25
- /** Backend returned an internal error. */
26
- TIRTC_TRANSPORT_STATUS_BACKEND_ERROR = 5,
27
- /** Backend reported invalid license. */
28
- TIRTC_TRANSPORT_STATUS_BACKEND_INVALID_LICENSE = 6,
29
- /** Backend reported operation timeout. */
30
- TIRTC_TRANSPORT_STATUS_BACKEND_TIMEOUT = 7,
31
- /** Backend reported busy/send-buffer-full. */
32
- TIRTC_TRANSPORT_STATUS_BACKEND_BUSY = 8,
33
- /** Backend reported connection timeout close. */
34
- TIRTC_TRANSPORT_STATUS_BACKEND_CONNECTION_TIMEOUT_CLOSED = 9,
35
- /** Backend reported remote close. */
36
- TIRTC_TRANSPORT_STATUS_BACKEND_REMOTE_CLOSED = 10,
37
- /** Backend reported other connection error. */
38
- TIRTC_TRANSPORT_STATUS_BACKEND_CONNECTION_OTHER_ERROR = 11,
39
- /** Backend reported token expired. */
40
- TIRTC_TRANSPORT_STATUS_BACKEND_TOKEN_EXPIRED = 12,
41
- } TirtcTransportStatus;
42
-
43
13
  /**
44
14
  * @brief Connection state visible to user callbacks.
45
15
  */
@@ -54,24 +24,6 @@ typedef enum TirtcTransportConnState {
54
24
  TIRTC_TRANSPORT_CONN_STATE_DISCONNECTED = 3,
55
25
  } TirtcTransportConnState;
56
26
 
57
- /**
58
- * @brief Reason for disconnected state.
59
- */
60
- typedef enum TirtcTransportDisconnectReason {
61
- /** Unknown reason. */
62
- TIRTC_TRANSPORT_DISCONNECT_REASON_UNKNOWN = 0,
63
- /** Disconnected by local side. */
64
- TIRTC_TRANSPORT_DISCONNECT_REASON_LOCAL_CLOSED = 1,
65
- /** Disconnected by remote side. */
66
- TIRTC_TRANSPORT_DISCONNECT_REASON_REMOTE_CLOSED = 2,
67
- /** Connection establishment failed. */
68
- TIRTC_TRANSPORT_DISCONNECT_REASON_CONNECT_FAILED = 3,
69
- /** Descriptor validation failed. */
70
- TIRTC_TRANSPORT_DISCONNECT_REASON_INVALID_DESCRIPTOR = 4,
71
- /** Backend reported fatal error. */
72
- TIRTC_TRANSPORT_DISCONNECT_REASON_BACKEND_ERROR = 5,
73
- } TirtcTransportDisconnectReason;
74
-
75
27
  /**
76
28
  * @brief Service-level runtime event.
77
29
  */
@@ -174,22 +126,12 @@ typedef struct TirtcTransportConnOptions {
174
126
  /**
175
127
  * @brief Command-channel payload.
176
128
  *
177
- * Command word semantics:
178
- * - sequence_number: high 16 bits
179
- * - command_id: low 15 bits
180
- * - is_response: request/response bit (bit15)
129
+ * command is an opaque backend-defined 32-bit value. The transport public
130
+ * contract forwards it without splitting sequence or request/response bits.
181
131
  */
182
132
  typedef struct TirtcTransportCommand {
183
- /** 16-bit command sequence number. */
184
- uint16_t sequence_number;
185
- /** 15-bit command identifier. */
186
- uint16_t command_id;
187
- /** Non-zero for response, zero for request. */
188
- uint8_t is_response;
189
- /** Reserved, set to zero. */
190
- uint8_t reserved0;
191
- /** Reserved, set to zero. */
192
- uint16_t reserved1;
133
+ /** Opaque raw 32-bit command word. */
134
+ uint32_t command;
193
135
  /** Command payload pointer, can be NULL when payload_length is 0. */
194
136
  const void* payload;
195
137
  /** Command payload bytes. */
@@ -247,7 +189,7 @@ typedef struct TirtcTransportStreamMessage {
247
189
  /**
248
190
  * @brief Service observer callbacks.
249
191
  */
250
- typedef struct TirtcTransportConnServiceObserver {
192
+ typedef struct TirtcTransportConnServiceCallbacks {
251
193
  /** Called when service runtime is started. */
252
194
  void (*on_started)(TirtcTransportConnService* service, void* user_data);
253
195
  /** Called when service runtime is stopped. */
@@ -259,9 +201,9 @@ typedef struct TirtcTransportConnServiceObserver {
259
201
  void (*on_connected)(TirtcTransportConnService* service, TirtcTransportConn* connection,
260
202
  void* user_data);
261
203
  /** Called when service-level error happens. */
262
- void (*on_error)(TirtcTransportConnService* service, TirtcTransportStatus code,
263
- const char* message, void* user_data);
264
- } TirtcTransportConnServiceObserver;
204
+ void (*on_error)(TirtcTransportConnService* service, TirtcError error, const char* message,
205
+ void* user_data);
206
+ } TirtcTransportConnServiceCallbacks;
265
207
 
266
208
  /**
267
209
  * @brief Connection observer callbacks.
@@ -269,52 +211,46 @@ typedef struct TirtcTransportConnServiceObserver {
269
211
  * Callback user_data here is observer context, independent from
270
212
  * tirtc_transport_conn_set_user_data()/get_user_data().
271
213
  */
272
- typedef struct TirtcTransportConnObserver {
214
+ typedef struct TirtcTransportConnCallbacks {
273
215
  /** Called when connection state changes. */
274
216
  void (*on_state_changed)(TirtcTransportConn* connection, TirtcTransportConnState state,
275
- void* user_data);
276
- /** Called once connection is disconnected. */
277
- void (*on_disconnected)(TirtcTransportConn* connection, TirtcTransportDisconnectReason reason,
278
- void* user_data);
217
+ TirtcError error, void* user_data);
279
218
  /** Called when command payload is received. */
280
219
  void (*on_command)(TirtcTransportConn* connection, const TirtcTransportCommand* command,
281
220
  void* user_data);
282
221
  /** Called when remote requests a key frame. */
283
- void (*on_request_iframe)(TirtcTransportConn* connection, uint8_t stream_id, void* user_data);
222
+ void (*on_request_key_frame)(TirtcTransportConn* connection, uint8_t stream_id, void* user_data);
284
223
  /**
285
- * @brief Called when remote requests video stream start.
224
+ * @brief Called when remote subscribes to video stream.
286
225
  * @return 0 to accept, non-zero to reject.
287
226
  */
288
- int (*on_request_video)(TirtcTransportConn* connection, uint8_t stream_id, void* user_data);
289
- /** Called when remote requests video stream stop. */
290
- void (*on_release_video)(TirtcTransportConn* connection, uint8_t stream_id, void* user_data);
227
+ int (*on_subscribe_video)(TirtcTransportConn* connection, uint8_t stream_id, void* user_data);
228
+ /** Called when remote unsubscribes from video stream. */
229
+ void (*on_unsubscribe_video)(TirtcTransportConn* connection, uint8_t stream_id, void* user_data);
291
230
  /**
292
- * @brief Called when remote requests audio stream start.
231
+ * @brief Called when remote subscribes to audio stream.
293
232
  * @return 0 to accept, non-zero to reject.
294
233
  */
295
- int (*on_request_audio)(TirtcTransportConn* connection, uint8_t stream_id, void* user_data);
296
- /** Called when remote requests audio stream stop. */
297
- void (*on_release_audio)(TirtcTransportConn* connection, uint8_t stream_id, void* user_data);
234
+ int (*on_subscribe_audio)(TirtcTransportConn* connection, uint8_t stream_id, void* user_data);
235
+ /** Called when remote unsubscribes from audio stream. */
236
+ void (*on_unsubscribe_audio)(TirtcTransportConn* connection, uint8_t stream_id, void* user_data);
298
237
  /** Called when audio frame is received. */
299
- void (*on_audio_frame)(TirtcTransportConn* connection, const TirtcTransportAudioFrame* frame,
300
- void* user_data);
238
+ void (*on_stream_audio)(TirtcTransportConn* connection, const TirtcTransportAudioFrame* frame,
239
+ void* user_data);
301
240
  /** Called when video frame is received. */
302
- void (*on_video_frame)(TirtcTransportConn* connection, const TirtcTransportVideoFrame* frame,
303
- void* user_data);
241
+ void (*on_stream_video)(TirtcTransportConn* connection, const TirtcTransportVideoFrame* frame,
242
+ void* user_data);
304
243
  /** Called when stream message is received. */
305
244
  void (*on_stream_message)(TirtcTransportConn* connection,
306
245
  const TirtcTransportStreamMessage* message, void* user_data);
307
- /** Called on connection-level error. */
308
- void (*on_error)(TirtcTransportConn* connection, TirtcTransportStatus code, const char* message,
309
- void* user_data);
310
- } TirtcTransportConnObserver;
246
+ } TirtcTransportConnCallbacks;
311
247
 
312
248
  /**
313
249
  * @brief Initialize transport runtime.
314
250
  *
315
251
  * This function is idempotent.
316
252
  */
317
- TirtcTransportStatus tirtc_transport_init(void);
253
+ TirtcError tirtc_transport_init(void);
318
254
 
319
255
  /**
320
256
  * @brief Enable/disable transport debug mode.
@@ -325,12 +261,7 @@ TirtcTransportStatus tirtc_transport_init(void);
325
261
  * @param enabled Non-zero to enable debug mode, zero to disable.
326
262
  * @return Operation status.
327
263
  */
328
- TirtcTransportStatus tirtc_transport_enable_debug(uint8_t enabled);
329
-
330
- /**
331
- * @brief Allocate next 16-bit command sequence number.
332
- */
333
- uint16_t tirtc_transport_command_next_sequence(void);
264
+ TirtcError tirtc_transport_enable_debug(uint8_t enabled);
334
265
 
335
266
  /**
336
267
  * @brief Uninitialize transport runtime.
@@ -342,15 +273,15 @@ void tirtc_transport_uninit(void);
342
273
  /**
343
274
  * @brief Start service runtime with descriptor and service observer.
344
275
  */
345
- TirtcTransportStatus tirtc_transport_conn_service_start(
346
- const TirtcTransportConnServiceOptions* options,
347
- const TirtcTransportConnServiceObserver* observer, void* user_data,
348
- TirtcTransportConnService** out_service);
276
+ TirtcError tirtc_transport_conn_service_start(const TirtcTransportConnServiceOptions* options,
277
+ const TirtcTransportConnServiceCallbacks* callbacks,
278
+ void* user_data,
279
+ TirtcTransportConnService** out_service);
349
280
 
350
281
  /**
351
282
  * @brief Stop service runtime.
352
283
  */
353
- TirtcTransportStatus tirtc_transport_conn_service_stop(TirtcTransportConnService* service);
284
+ TirtcError tirtc_transport_conn_service_stop(TirtcTransportConnService* service);
354
285
 
355
286
  /**
356
287
  * @brief Create outgoing connection.
@@ -358,18 +289,18 @@ TirtcTransportStatus tirtc_transport_conn_service_stop(TirtcTransportConnService
358
289
  * On success, returned handle enters CONNECTING first; actual connected/disconnected
359
290
  * transition is delivered by observer callbacks.
360
291
  */
361
- TirtcTransportStatus tirtc_transport_connect(const TirtcTransportConnOptions* options,
362
- TirtcTransportConn** out_connection);
292
+ TirtcError tirtc_transport_connect(const TirtcTransportConnOptions* options,
293
+ TirtcTransportConn** out_connection);
363
294
 
364
295
  /**
365
296
  * @brief Set or replace connection observer.
366
297
  *
367
- * The implementation may synchronously replay current state/disconnected event
368
- * to the new observer according to contract.
298
+ * The implementation may synchronously replay the current state according to
299
+ * contract.
369
300
  */
370
- TirtcTransportStatus tirtc_transport_conn_set_observer(TirtcTransportConn* connection,
371
- const TirtcTransportConnObserver* observer,
372
- void* user_data);
301
+ TirtcError tirtc_transport_conn_set_callbacks(TirtcTransportConn* connection,
302
+ const TirtcTransportConnCallbacks* callbacks,
303
+ void* user_data);
373
304
 
374
305
  /**
375
306
  * @brief Attach a connection-level user context pointer.
@@ -377,8 +308,7 @@ TirtcTransportStatus tirtc_transport_conn_set_observer(TirtcTransportConn* conne
377
308
  * This is equivalent to backend connection user data mapping and is independent
378
309
  * from observer callback user_data.
379
310
  */
380
- TirtcTransportStatus tirtc_transport_conn_set_user_data(TirtcTransportConn* connection,
381
- void* user_data);
311
+ TirtcError tirtc_transport_conn_set_user_data(TirtcTransportConn* connection, void* user_data);
382
312
 
383
313
  /**
384
314
  * @brief Get connection-level user context pointer set by set_user_data.
@@ -388,15 +318,15 @@ void* tirtc_transport_conn_get_user_data(TirtcTransportConn* connection);
388
318
  /**
389
319
  * @brief Get current send-buffer used bytes for this connection.
390
320
  */
391
- TirtcTransportStatus tirtc_transport_conn_get_send_buffer_used(TirtcTransportConn* connection,
392
- size_t* out_bytes);
321
+ TirtcError tirtc_transport_conn_get_send_buffer_used(TirtcTransportConn* connection,
322
+ size_t* out_bytes);
393
323
 
394
324
  /**
395
325
  * @brief Request local disconnect.
396
326
  *
397
- * Disconnected completion is reported by on_disconnected callback.
327
+ * Disconnected completion is reported by on_state_changed callback.
398
328
  */
399
- TirtcTransportStatus tirtc_transport_disconnect(TirtcTransportConn* connection);
329
+ TirtcError tirtc_transport_disconnect(TirtcTransportConn* connection);
400
330
 
401
331
  /**
402
332
  * @brief Destroy transport connection handle.
@@ -408,15 +338,14 @@ void tirtc_transport_conn_destroy(TirtcTransportConn* connection);
408
338
  /**
409
339
  * @brief Send command payload over command channel.
410
340
  */
411
- TirtcTransportStatus tirtc_transport_send_command(TirtcTransportConn* connection,
412
- const TirtcTransportCommand* command);
341
+ TirtcError tirtc_transport_send_command(TirtcTransportConn* connection,
342
+ const TirtcTransportCommand* command);
413
343
 
414
344
  /**
415
345
  * @brief Request remote side to send a key frame for a video stream on this
416
346
  * connection.
417
347
  */
418
- TirtcTransportStatus tirtc_transport_request_iframe(TirtcTransportConn* connection,
419
- uint8_t stream_id);
348
+ TirtcError tirtc_transport_request_key_frame(TirtcTransportConn* connection, uint8_t stream_id);
420
349
 
421
350
  /**
422
351
  * @brief Request remote side to start sending a video stream on this
@@ -425,8 +354,7 @@ TirtcTransportStatus tirtc_transport_request_iframe(TirtcTransportConn* connecti
425
354
  * The request scope is limited to the supplied ::connection and ::stream_id.
426
355
  * It must not affect any other connection.
427
356
  */
428
- TirtcTransportStatus tirtc_transport_request_video(TirtcTransportConn* connection,
429
- uint8_t stream_id);
357
+ TirtcError tirtc_transport_subscribe_video(TirtcTransportConn* connection, uint8_t stream_id);
430
358
 
431
359
  /**
432
360
  * @brief Request remote side to stop sending a video stream on this
@@ -435,8 +363,7 @@ TirtcTransportStatus tirtc_transport_request_video(TirtcTransportConn* connectio
435
363
  * The release scope is limited to the supplied ::connection and ::stream_id.
436
364
  * It must not affect any other connection.
437
365
  */
438
- TirtcTransportStatus tirtc_transport_release_video(TirtcTransportConn* connection,
439
- uint8_t stream_id);
366
+ TirtcError tirtc_transport_unsubscribe_video(TirtcTransportConn* connection, uint8_t stream_id);
440
367
 
441
368
  /**
442
369
  * @brief Request remote side to start sending an audio stream on this
@@ -445,8 +372,7 @@ TirtcTransportStatus tirtc_transport_release_video(TirtcTransportConn* connectio
445
372
  * The request scope is limited to the supplied ::connection and ::stream_id.
446
373
  * It must not affect any other connection.
447
374
  */
448
- TirtcTransportStatus tirtc_transport_request_audio(TirtcTransportConn* connection,
449
- uint8_t stream_id);
375
+ TirtcError tirtc_transport_subscribe_audio(TirtcTransportConn* connection, uint8_t stream_id);
450
376
 
451
377
  /**
452
378
  * @brief Request remote side to stop sending an audio stream on this
@@ -455,26 +381,25 @@ TirtcTransportStatus tirtc_transport_request_audio(TirtcTransportConn* connectio
455
381
  * The release scope is limited to the supplied ::connection and ::stream_id.
456
382
  * It must not affect any other connection.
457
383
  */
458
- TirtcTransportStatus tirtc_transport_release_audio(TirtcTransportConn* connection,
459
- uint8_t stream_id);
384
+ TirtcError tirtc_transport_unsubscribe_audio(TirtcTransportConn* connection, uint8_t stream_id);
460
385
 
461
386
  /**
462
387
  * @brief Send typed audio frame.
463
388
  */
464
- TirtcTransportStatus tirtc_transport_send_audio_frame(TirtcTransportConn* connection,
465
- const TirtcTransportAudioFrame* frame);
389
+ TirtcError tirtc_transport_send_audio_frame(TirtcTransportConn* connection,
390
+ const TirtcTransportAudioFrame* frame);
466
391
 
467
392
  /**
468
393
  * @brief Send typed video frame.
469
394
  */
470
- TirtcTransportStatus tirtc_transport_send_video_frame(TirtcTransportConn* connection,
471
- const TirtcTransportVideoFrame* frame);
395
+ TirtcError tirtc_transport_send_video_frame(TirtcTransportConn* connection,
396
+ const TirtcTransportVideoFrame* frame);
472
397
 
473
398
  /**
474
399
  * @brief Send stream-message payload in media channel.
475
400
  */
476
- TirtcTransportStatus tirtc_transport_send_stream_message(
477
- TirtcTransportConn* connection, const TirtcTransportStreamMessage* message);
401
+ TirtcError tirtc_transport_send_stream_message(TirtcTransportConn* connection,
402
+ const TirtcTransportStreamMessage* message);
478
403
 
479
404
  #ifdef __cplusplus
480
405
  }