tirtc-devtools-cli 0.3.1 → 0.3.3

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 (48) hide show
  1. package/dist/cli/src/index.js +4 -0
  2. package/dist/cli/src/role_driver.d.ts +4 -0
  3. package/dist/cli/src/role_driver.js +42 -0
  4. package/dist/cli/src/role_live_log.js +1 -1
  5. package/package.json +1 -1
  6. package/vendor/devtools/driver/linux-x64/devtools_driver_probe +0 -0
  7. package/vendor/devtools/driver/macos-arm64/devtools_driver_probe +0 -0
  8. package/vendor/runtime/linux-x64/include/tirtc/audio.h +46 -3
  9. package/vendor/runtime/linux-x64/include/tirtc/audio_codec.h +6 -0
  10. package/vendor/runtime/linux-x64/include/tirtc/audio_format.h +20 -0
  11. package/vendor/runtime/linux-x64/include/tirtc/audio_frame.h +3 -4
  12. package/vendor/runtime/linux-x64/include/tirtc/audio_io.h +2 -3
  13. package/vendor/runtime/linux-x64/include/tirtc/audio_processing.h +1 -0
  14. package/vendor/runtime/linux-x64/include/tirtc/av.h +1 -0
  15. package/vendor/runtime/linux-x64/include/tirtc/media_codec.h +1 -0
  16. package/vendor/runtime/linux-x64/include/tirtc/media_downlink.h +19 -0
  17. package/vendor/runtime/linux-x64/include/tirtc/media_uplink.h +2 -1
  18. package/vendor/runtime/linux-x64/lib/libTiRTC.a +0 -0
  19. package/vendor/runtime/linux-x64/lib/libmatrix_runtime_audio.a +0 -0
  20. package/vendor/runtime/linux-x64/lib/libmatrix_runtime_facade.a +0 -0
  21. package/vendor/runtime/linux-x64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  22. package/vendor/runtime/linux-x64/lib/libmatrix_runtime_media.a +0 -0
  23. package/vendor/runtime/linux-x64/lib/libmatrix_runtime_transport.a +0 -0
  24. package/vendor/runtime/linux-x64/lib/libmatrix_runtime_video.a +0 -0
  25. package/vendor/runtime/linux-x64/lib/libmbedtls.a +0 -0
  26. package/vendor/runtime/linux-x64/lib/libusrsctp.a +0 -0
  27. package/vendor/runtime/linux-x64/lib/libwebrtc.a +0 -0
  28. package/vendor/runtime/linux-x64/manifest.txt +21 -17
  29. package/vendor/runtime/macos-arm64/include/tirtc/audio.h +46 -3
  30. package/vendor/runtime/macos-arm64/include/tirtc/audio_codec.h +6 -0
  31. package/vendor/runtime/macos-arm64/include/tirtc/audio_format.h +20 -0
  32. package/vendor/runtime/macos-arm64/include/tirtc/audio_frame.h +3 -4
  33. package/vendor/runtime/macos-arm64/include/tirtc/audio_io.h +2 -3
  34. package/vendor/runtime/macos-arm64/include/tirtc/audio_processing.h +1 -0
  35. package/vendor/runtime/macos-arm64/include/tirtc/av.h +1 -0
  36. package/vendor/runtime/macos-arm64/include/tirtc/media_codec.h +1 -0
  37. package/vendor/runtime/macos-arm64/include/tirtc/media_downlink.h +19 -0
  38. package/vendor/runtime/macos-arm64/include/tirtc/media_uplink.h +2 -1
  39. package/vendor/runtime/macos-arm64/lib/libTiRTC.a +0 -0
  40. package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_audio.a +0 -0
  41. package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
  42. package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_foundation_http.a +0 -0
  43. package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  44. package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
  45. package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
  46. package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
  47. package/vendor/runtime/macos-arm64/manifest.txt +19 -18
  48. package/vendor/runtime/script/prepare_runtime_media_dataset.sh +198 -95
@@ -125,6 +125,10 @@ device.command('start')
125
125
  .option('--endpoint <url>', 'TiRTC endpoint;不传时读取 TIRTC_ENDPOINT')
126
126
  .option('--source <path>', 'prepared asset root、manifest_path 或 encoded track;MP4 先运行 assets prepare')
127
127
  .option('--video-codec <codec>', 'h264|h265|mjpeg', 'h264')
128
+ .option('--audio-codec <codec>', 'g711a|aac', 'g711a')
129
+ .option('--audio-sample-rate <hz>', '8000|16000', '8000')
130
+ .option('--audio-channels <count>', '1|2', '1')
131
+ .option('--exit-after-first-session', '首个 client 会话完成后主动正常退出并写出 summary')
128
132
  .option('--duration-ms <ms>', '可选自动结束时长;默认持续运行直到用户结束进程')
129
133
  .option('--connect-timeout-ms <ms>', 'service ready 最大等待')
130
134
  .option('--first-packet-timeout-ms <ms>', '首包最大等待')
@@ -8,6 +8,10 @@ type DeviceCommandOptions = {
8
8
  endpoint?: string;
9
9
  source?: string;
10
10
  videoCodec?: string;
11
+ audioCodec?: string;
12
+ audioSampleRate?: string;
13
+ audioChannels?: string;
14
+ exitAfterFirstSession?: boolean;
11
15
  durationMs?: string;
12
16
  connectTimeoutMs?: string;
13
17
  firstPacketTimeoutMs?: string;
@@ -39,6 +39,9 @@ function rolePreflightError(reasonCode, detail) {
39
39
  function roleUsageError(message) {
40
40
  return new RoleCommandError('invalid_request', 'config', usageExitCode, message);
41
41
  }
42
+ function roleUsageReasonError(reasonCode, message) {
43
+ return new RoleCommandError(reasonCode, 'config', usageExitCode, reasonCode + ': ' + message);
44
+ }
42
45
  function pathExists(filePath) {
43
46
  return fs_1.default.existsSync(filePath);
44
47
  }
@@ -270,6 +273,27 @@ function codecOrDefault(raw) {
270
273
  }
271
274
  return codec;
272
275
  }
276
+ function audioCodecOrDefault(raw) {
277
+ const codec = raw?.trim() || 'g711a';
278
+ if (codec !== 'g711a' && codec !== 'aac') {
279
+ throw roleUsageReasonError('audio_codec_unsupported', 'audio-codec must be g711a or aac');
280
+ }
281
+ return codec;
282
+ }
283
+ function audioSampleRateOrDefault(raw) {
284
+ const sampleRate = raw === undefined ? 8000 : Number(raw);
285
+ if (sampleRate !== 8000 && sampleRate !== 16000) {
286
+ throw roleUsageReasonError('audio_format_unsupported', 'audio-sample-rate must be 8000 or 16000');
287
+ }
288
+ return sampleRate;
289
+ }
290
+ function audioChannelsOrDefault(raw) {
291
+ const channels = raw === undefined ? 1 : Number(raw);
292
+ if (channels !== 1 && channels !== 2) {
293
+ throw roleUsageReasonError('audio_format_unsupported', 'audio-channels must be 1 or 2');
294
+ }
295
+ return channels;
296
+ }
273
297
  function consumerOrDefault(raw) {
274
298
  const consumer = raw?.trim() || 'frame_dump';
275
299
  if (consumer !== 'frame_dump' && consumer !== 'packet_dump') {
@@ -302,6 +326,9 @@ function printEnvelope(options, code, message, data) {
302
326
  }
303
327
  function buildDeviceRequest(roots, artifactRoot, options) {
304
328
  const codec = codecOrDefault(options.videoCodec);
329
+ const audioCodec = audioCodecOrDefault(options.audioCodec);
330
+ const audioSampleRateHz = audioSampleRateOrDefault(options.audioSampleRate);
331
+ const audioChannels = audioChannelsOrDefault(options.audioChannels);
305
332
  const executionId = 'cli-device-' + codec + '-' + executionSuffix();
306
333
  const caseId = 'devtools-cli-device.' + codec;
307
334
  const deviceIdentity = resolveDeviceIdentity(options);
@@ -328,9 +355,15 @@ function buildDeviceRequest(roots, artifactRoot, options) {
328
355
  media: {
329
356
  source: { kind: 'encoded_asset', path: options.source ?? resolveAssetRoot(roots) },
330
357
  video: { codec },
358
+ audio: {
359
+ codec: audioCodec,
360
+ sample_rate_hz: audioSampleRateHz,
361
+ channels: audioChannels,
362
+ },
331
363
  },
332
364
  output: { consumer: 'frame_dump', video: { frame_limit: defaultFrameLimit } },
333
365
  run: {
366
+ exit_after_first_session: options.exitAfterFirstSession === true,
334
367
  duration_ms: parseOptionalPositiveInt(options.durationMs, '--duration-ms'),
335
368
  connect_timeout_ms: parsePositiveInt(options.connectTimeoutMs, defaultConnectTimeoutMs, '--connect-timeout-ms'),
336
369
  first_packet_timeout_ms: parsePositiveInt(options.firstPacketTimeoutMs, defaultFirstPacketTimeoutMs, '--first-packet-timeout-ms'),
@@ -372,11 +405,15 @@ function buildClientRequest(roots, artifactRoot, options) {
372
405
  const executionId = 'cli-client-' + executionSuffix();
373
406
  const identityOverride = Boolean(bootstrap && (options.targetDeviceId || options.token));
374
407
  const videoCodec = codecOrDefault(bootstrap?.video_codec);
408
+ const audioCodec = audioCodecOrDefault(bootstrap?.audio_codec);
409
+ const audioSampleRateHz = audioSampleRateOrDefault(bootstrap?.audio_sample_rate_hz ?? bootstrap?.sample_rate_hz);
410
+ const audioChannels = audioChannelsOrDefault(bootstrap?.audio_channels ?? bootstrap?.channels);
375
411
  return {
376
412
  schema_version: 1,
377
413
  execution_id: executionId,
378
414
  case_id: 'devtools-cli-client',
379
415
  role: 'client',
416
+ require_audio: bootstrap?.require_audio ?? true,
380
417
  endpoint,
381
418
  identity: {
382
419
  device_id: targetDeviceId,
@@ -392,6 +429,11 @@ function buildClientRequest(roots, artifactRoot, options) {
392
429
  media: {
393
430
  source: { kind: 'encoded_asset', path: resolveAssetRoot(roots) },
394
431
  video: { codec: videoCodec },
432
+ audio: {
433
+ codec: audioCodec,
434
+ sample_rate_hz: audioSampleRateHz,
435
+ channels: audioChannels,
436
+ },
395
437
  },
396
438
  output: {
397
439
  consumer: consumerOrDefault(options.consumer),
@@ -166,7 +166,7 @@ function startRoleLiveLog(options) {
166
166
  const parts = ['audio input started'];
167
167
  appendField(parts, 'session', sessionIndex(payload));
168
168
  appendField(parts, 'stream_id', payloadNumber(payload, 'stream_id'));
169
- appendField(parts, 'codec', payloadString(payload, 'codec'));
169
+ appendField(parts, 'codec', payloadString(payload, 'audio_codec') ?? payloadString(payload, 'codec'));
170
170
  appendField(parts, 'sample_rate_hz', payloadNumber(payload, 'sample_rate_hz'));
171
171
  log(parts.join(' '));
172
172
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tirtc-devtools-cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "private": false,
5
5
  "main": "dist/cli/src/index.js",
6
6
  "types": "dist/cli/src/index.d.ts",
@@ -42,7 +42,11 @@ typedef enum TirtcAudioOutputState {
42
42
  } TirtcAudioOutputState;
43
43
 
44
44
  typedef struct TirtcAudioInputOptions {
45
- TirtcAudioSampleRate sample_rate;
45
+ TirtcMediaCodec codec;
46
+
47
+ uint32_t sample_rate_hz;
48
+
49
+ uint32_t channels;
46
50
 
47
51
  TirtcAudioAecMode aec_mode;
48
52
 
@@ -61,9 +65,27 @@ typedef struct TirtcAudioInputOptions {
61
65
  typedef struct TirtcAudioEncodedInputOptions {
62
66
  TirtcMediaCodec codec;
63
67
 
64
- TirtcAudioSampleRate sample_rate;
68
+ uint32_t sample_rate_hz;
69
+
70
+ uint32_t channels;
65
71
  } TirtcAudioEncodedInputOptions;
66
72
 
73
+ typedef struct TirtcAudioEncodedInputFrame {
74
+ TirtcMediaCodec codec;
75
+
76
+ uint32_t sample_rate_hz;
77
+
78
+ uint32_t channels;
79
+
80
+ uint32_t samples_per_channel;
81
+
82
+ int64_t pts_us;
83
+
84
+ const void* data;
85
+
86
+ size_t data_bytes;
87
+ } TirtcAudioEncodedInputFrame;
88
+
67
89
  typedef struct TirtcAudioOutputOptions {
68
90
  uint32_t volume_percent;
69
91
 
@@ -91,6 +113,22 @@ typedef struct TirtcPendingDurationMetrics {
91
113
  uint64_t decoded_duration_ms;
92
114
  } TirtcPendingDurationMetrics;
93
115
 
116
+ typedef struct TirtcOutputLatencyStageMetrics {
117
+ uint64_t latest_ms;
118
+ uint64_t average_ms;
119
+ uint64_t peak_ms;
120
+ uint64_t sample_count;
121
+ uint64_t unavailable_count;
122
+ } TirtcOutputLatencyStageMetrics;
123
+
124
+ typedef struct TirtcOutputLocalLatencyMetrics {
125
+ uint32_t window_duration_ms;
126
+ TirtcOutputLatencyStageMetrics total;
127
+ TirtcOutputLatencyStageMetrics buffer;
128
+ TirtcOutputLatencyStageMetrics decode_or_ready;
129
+ TirtcOutputLatencyStageMetrics output;
130
+ } TirtcOutputLocalLatencyMetrics;
131
+
94
132
  typedef struct TirtcAudioOutputMetricsSnapshot {
95
133
  TirtcOutputStutterMetrics stutter;
96
134
  TirtcPendingDurationMetrics pending;
@@ -98,6 +136,7 @@ typedef struct TirtcAudioOutputMetricsSnapshot {
98
136
  double input_packet_rate;
99
137
  double render_callback_rate;
100
138
  uint32_t rate_window_duration_ms;
139
+ TirtcOutputLocalLatencyMetrics local_latency;
101
140
  } TirtcAudioOutputMetricsSnapshot;
102
141
 
103
142
  /**
@@ -109,6 +148,10 @@ typedef struct TirtcAudioOutputMetricsSnapshot {
109
148
  */
110
149
  typedef struct TirtcAudioOutputDebugSnapshot {
111
150
  TirtcMediaCodec codec;
151
+
152
+ uint32_t sample_rate_hz;
153
+
154
+ uint32_t channels;
112
155
  } TirtcAudioOutputDebugSnapshot;
113
156
 
114
157
  /**
@@ -195,7 +238,7 @@ TirtcError tirtc_audio_encoded_input_attach(TirtcAudioEncodedInput* input, Tirtc
195
238
  TirtcError tirtc_audio_encoded_input_detach(TirtcAudioEncodedInput* input, TirtcConn* connection);
196
239
 
197
240
  TirtcError tirtc_audio_encoded_input_submit_frame(TirtcAudioEncodedInput* input,
198
- const TirtcAudioEncodedFrame* frame);
241
+ const TirtcAudioEncodedInputFrame* frame);
199
242
 
200
243
  void tirtc_audio_encoded_input_destroy(TirtcAudioEncodedInput* input);
201
244
 
@@ -16,6 +16,12 @@ TirtcError tirtc_audio_g711a_encode(const TirtcAudioPcmFrame* pcm_frame, void* o
16
16
  TirtcError tirtc_audio_g711a_decode(const TirtcAudioEncodedFrame* in_frame, void* out_buffer,
17
17
  size_t out_buffer_capacity, TirtcAudioPcmFrame* out_frame);
18
18
 
19
+ TirtcError tirtc_audio_aac_encode(const TirtcAudioPcmFrame* pcm_frame, void* out_buffer,
20
+ size_t out_buffer_capacity, TirtcAudioEncodedFrame* out_frame);
21
+
22
+ TirtcError tirtc_audio_aac_decode(const TirtcAudioEncodedFrame* in_frame, void* out_buffer,
23
+ size_t out_buffer_capacity, TirtcAudioPcmFrame* out_frame);
24
+
19
25
  #ifdef __cplusplus
20
26
  }
21
27
  #endif
@@ -0,0 +1,20 @@
1
+ #ifndef TIRTC_MEDIA_CONTRACT_AUDIO_FORMAT_H_
2
+ #define TIRTC_MEDIA_CONTRACT_AUDIO_FORMAT_H_
3
+
4
+ #include <stdint.h>
5
+
6
+ #ifdef __cplusplus
7
+ extern "C" {
8
+ #endif
9
+
10
+ typedef struct TirtcAudioFormat {
11
+ uint32_t sample_rate_hz;
12
+ uint32_t channels;
13
+ uint32_t bits_per_sample;
14
+ } TirtcAudioFormat;
15
+
16
+ #ifdef __cplusplus
17
+ }
18
+ #endif
19
+
20
+ #endif // TIRTC_MEDIA_CONTRACT_AUDIO_FORMAT_H_
@@ -4,7 +4,7 @@
4
4
  #include <stddef.h>
5
5
  #include <stdint.h>
6
6
 
7
- #include "tirtc/audio_sample_rate.h"
7
+ #include "tirtc/audio_format.h"
8
8
  #include "tirtc/media_codec.h"
9
9
 
10
10
  #ifdef __cplusplus
@@ -12,17 +12,16 @@ extern "C" {
12
12
  #endif
13
13
 
14
14
  typedef struct TirtcAudioPcmFrame {
15
- TirtcAudioSampleRate sample_rate;
15
+ TirtcAudioFormat format;
16
16
  uint32_t samples_per_channel;
17
17
  int64_t pts_us;
18
- /* Mutable PCM payload for capture, processing, and render-fill paths. */
19
18
  void* data;
20
19
  size_t data_bytes;
21
20
  } TirtcAudioPcmFrame;
22
21
 
23
22
  typedef struct TirtcAudioEncodedFrame {
24
23
  TirtcMediaCodec codec;
25
- TirtcAudioSampleRate sample_rate;
24
+ TirtcAudioFormat format;
26
25
  uint32_t samples_per_channel;
27
26
  int64_t pts_us;
28
27
  const void* data;
@@ -14,8 +14,7 @@ typedef struct TirtcAudioAin TirtcAudioAin;
14
14
  typedef struct TirtcAudioAout TirtcAudioAout;
15
15
 
16
16
  typedef struct TirtcAudioIoConfig {
17
- TirtcAudioSampleRate sample_rate;
18
- /* AIN uses fixed 10 ms mono blocks; AOUT may use larger callback-sized multiples. */
17
+ TirtcAudioFormat format;
19
18
  uint32_t samples_per_buffer;
20
19
  } TirtcAudioIoConfig;
21
20
 
@@ -29,7 +28,7 @@ typedef void (*TirtcAudioAinOnFrameFn)(TirtcAudioAin* ain, const TirtcAudioPcmFr
29
28
  void* user_data);
30
29
 
31
30
  /*
32
- * AOUT pre-fills sample_rate, samples_per_channel, data, and data_bytes before
31
+ * AOUT pre-fills format, samples_per_channel, data, and data_bytes before
33
32
  * calling render. The callback contract expects a non-negative rendered PCM
34
33
  * byte count. Backends defensively clamp negative returns to zero and zero-fill
35
34
  * any remaining buffer space.
@@ -2,6 +2,7 @@
2
2
  #define TIRTC_AUDIO_PROCESSING_H_
3
3
 
4
4
  #include "tirtc/audio_frame.h"
5
+ #include "tirtc/audio_sample_rate.h"
5
6
  #include "tirtc/error.h"
6
7
 
7
8
  #ifdef __cplusplus
@@ -51,6 +51,7 @@ typedef struct TirtcVideoOutputMetricsSnapshot {
51
51
  double decoded_fps;
52
52
  double render_fps;
53
53
  uint32_t rate_window_duration_ms;
54
+ TirtcOutputLocalLatencyMetrics local_latency;
54
55
  } TirtcVideoOutputMetricsSnapshot;
55
56
 
56
57
  /**
@@ -8,6 +8,7 @@ extern "C" {
8
8
  typedef enum TirtcMediaCodec {
9
9
  TIRTC_MEDIA_CODEC_NONE = 0,
10
10
  TIRTC_MEDIA_CODEC_AUDIO_G711A = 1,
11
+ TIRTC_MEDIA_CODEC_AUDIO_AAC = 2,
11
12
  /* Reserved shared identifiers; concrete video implementations live outside media-contract. */
12
13
  TIRTC_MEDIA_CODEC_VIDEO_H264 = 65,
13
14
  TIRTC_MEDIA_CODEC_VIDEO_H265 = 66,
@@ -66,6 +66,22 @@ typedef struct TirtcMediaDownlinkPendingMetricsSnapshot {
66
66
  uint64_t decoded_pending_duration_ms;
67
67
  } TirtcMediaDownlinkPendingMetricsSnapshot;
68
68
 
69
+ typedef struct TirtcMediaDownlinkLatencyStageMetricsSnapshot {
70
+ uint64_t latest_ms;
71
+ uint64_t average_ms;
72
+ uint64_t peak_ms;
73
+ uint64_t sample_count;
74
+ uint64_t unavailable_count;
75
+ } TirtcMediaDownlinkLatencyStageMetricsSnapshot;
76
+
77
+ typedef struct TirtcMediaDownlinkLocalLatencyMetricsSnapshot {
78
+ uint32_t window_duration_ms;
79
+ TirtcMediaDownlinkLatencyStageMetricsSnapshot total;
80
+ TirtcMediaDownlinkLatencyStageMetricsSnapshot buffer;
81
+ TirtcMediaDownlinkLatencyStageMetricsSnapshot decode_or_ready;
82
+ TirtcMediaDownlinkLatencyStageMetricsSnapshot output;
83
+ } TirtcMediaDownlinkLocalLatencyMetricsSnapshot;
84
+
69
85
  typedef struct TirtcMediaDownlinkAudioMetricsSnapshot {
70
86
  TirtcMediaDownlinkStutterMetricsSnapshot stutter;
71
87
  TirtcMediaDownlinkPendingMetricsSnapshot pending;
@@ -73,6 +89,7 @@ typedef struct TirtcMediaDownlinkAudioMetricsSnapshot {
73
89
  double input_packet_rate;
74
90
  double render_callback_rate;
75
91
  uint32_t rate_window_duration_ms;
92
+ TirtcMediaDownlinkLocalLatencyMetricsSnapshot local_latency;
76
93
  } TirtcMediaDownlinkAudioMetricsSnapshot;
77
94
 
78
95
  typedef struct TirtcMediaDownlinkVideoStartupMetricsSnapshot {
@@ -93,6 +110,7 @@ typedef struct TirtcMediaDownlinkVideoMetricsSnapshot {
93
110
  double decoded_fps;
94
111
  double render_fps;
95
112
  uint32_t rate_window_duration_ms;
113
+ TirtcMediaDownlinkLocalLatencyMetricsSnapshot local_latency;
96
114
  } TirtcMediaDownlinkVideoMetricsSnapshot;
97
115
 
98
116
  /**
@@ -103,6 +121,7 @@ typedef struct TirtcMediaDownlinkVideoMetricsSnapshot {
103
121
  */
104
122
  typedef struct TirtcMediaDownlinkAudioDebugSnapshot {
105
123
  TirtcMediaCodec codec;
124
+ TirtcAudioFormat format;
106
125
  } TirtcMediaDownlinkAudioDebugSnapshot;
107
126
 
108
127
  /**
@@ -29,7 +29,8 @@ typedef enum TirtcMediaUplinkState {
29
29
  } TirtcMediaUplinkState;
30
30
 
31
31
  typedef struct TirtcMediaUplinkAudioOptions {
32
- TirtcAudioSampleRate sample_rate;
32
+ TirtcMediaCodec codec;
33
+ TirtcAudioFormat format;
33
34
  TirtcAudioAecMode aec_mode;
34
35
  TirtcAudioAgcLevel agc_level;
35
36
  TirtcAudioAnsLevel ans_level;
@@ -1,26 +1,27 @@
1
1
  platform=linux-x64
2
2
  profile=full
3
- staged_at_utc=2026-05-09T08:58:54Z
3
+ staged_at_utc=2026-05-13T16:55:41Z
4
4
  source_sdk=/Users/allenfeng/Development/Repositories/tirtc-nexus/tirtc-matrix/.build/sdk/linux-x64
5
5
 
6
- 92ac54ea714e5a7da536d3d63b955a9e30faf9560ebe670034a79f3ea69c21cb include/tirtc/audio.h
7
- 6d972ccfe150a3b4f2d7f18fa92b3ade9210c1c8bb754d061ac6b7997b59e2cb include/tirtc/audio_codec.h
8
- 7bacbdb2d8bb10d6444036a8fef42f2a8e3ea34dfc38e165ee678d61f189db41 include/tirtc/audio_frame.h
9
- fb8ea35263167c33487bd3aa503c26ed2dfbf97877f7bda92c10065cd5c97c13 include/tirtc/audio_io.h
6
+ 04c3139f26d53aa2fb0a586a21ffb481a001c01e0412cd3414a952c9a9d336ba include/tirtc/audio.h
7
+ ce7ccffa054250a2dab0e2128e4701a66c7168e50e8c470dcff3bf609ff0959c include/tirtc/audio_codec.h
8
+ 0b463d8adfcf45acb3f95fe3e2d94b37a26aaf37d293eb2b18274ddcb161f767 include/tirtc/audio_format.h
9
+ 7cac5b8c0cef28526ee00800fa8b0d1e60897ab971a0801899cb0333c9189fde include/tirtc/audio_frame.h
10
+ 6daadba731521c01a3cf11c5d8b2ef797238737c939e2da3045fc83ad89af04a include/tirtc/audio_io.h
10
11
  c2e1f31dcc75be461c577d18b1cebe32774f212d51cb4dd2a5b5a9bfe62b693e include/tirtc/audio_io_android.h
11
12
  878bb18220ac62304ec95807f31e83e050c8dac14811f873454f9b045028694a include/tirtc/audio_io_apple.h
12
13
  0569eb1d043ee7fa8d45ca43143eca1a22e4c4bf1507ca7e045e010a3ecbc288 include/tirtc/audio_io_harmony.h
13
14
  51cbc911fe9f9834046f0e0a1a7cdd814a8e194a615894a8b4d11f9e5f095610 include/tirtc/audio_io_windows.h
14
- 21f60729117260a44af22c1af986ef17d22673b102b7b7a035f492d0665cce16 include/tirtc/audio_processing.h
15
+ 5acfd19fdcd8c9d96e4aee7c6f1d33a9211c0a5b0c0ab56d96e1b4dee48f3aa9 include/tirtc/audio_processing.h
15
16
  0ca7c3c630b1242f51a0fd8154097c0a332b4c816a5707090e4381719852998c include/tirtc/audio_sample_rate.h
16
- f40ce007241e4aa6ef2e2bcd589060636ef0e9859a9102c8b955d348f4f7eabc include/tirtc/av.h
17
+ 07ca1b210a6e334c1474f25446477681472154568ecf74557cb3dc9b3a730662 include/tirtc/av.h
17
18
  b3e110ce04057d3be696b120d1abeaf6141711a1c63ca7f9bdf65ed5ec6e16d7 include/tirtc/error.h
18
19
  ae805545a9515edc9b94262e72ad2c7b7d649288166f4daeb450d8a55e82ae0b include/tirtc/foundation/build_info.h
19
20
  7cf8b372a3d48d4de4a65a04c7f102281a7b42cebb9ec247853d3c53afb63b6a include/tirtc/http.h
20
21
  70bbf93b84d9d1a85f376d9986de570c1f658319e1e5ab6d621f7a4d41033f5c include/tirtc/logging.h
21
- 7e2f7f81afe37e22f5414d9db32438edd948ff775230c3a0a17ff9ac1a0b560e include/tirtc/media_codec.h
22
- 43c0ac9173b6259a1b1379eac780f4892a0a72572801ac9eb8516c0bdb4913c3 include/tirtc/media_downlink.h
23
- e64191a39004165cdcd11b2ca824af34d4bfe02f7ec3c3101fa9291f56488c30 include/tirtc/media_uplink.h
22
+ 1419ac3fb5237d1d820bd30a6845b98aab3553463eb64e73623b64c663665f16 include/tirtc/media_codec.h
23
+ df11627da9bfbb87cb32582701f638d2a0ff5b6b77b49a3a3bab7509c62f0613 include/tirtc/media_downlink.h
24
+ 9376af63fde915753146969291f0fefe2da6df28f7aa6310f7787048165150dc include/tirtc/media_uplink.h
24
25
  57be6941026e7dd173e8779b2bb868532d65e41f7917aad476a31ac25c1cd6c3 include/tirtc/transport.h
25
26
  fba7954919606e507b6a074440440903665217959699da89ca9dd206772c0ef0 include/tirtc/trp.h
26
27
  92b3db6e2cb02265ad5db01881edce9d4e095b1dadf449dce5d8bb5362957e33 include/tirtc/video_codec.h
@@ -31,15 +32,18 @@ f22127424d5978ab0644209b6c25c24e19e320dd2fbda6634e6344597ff7e2be include/tirtc/
31
32
  cae0bbeb884e5466a56da15182c78cc22baab6c743f349a58d3595f623333585 include/tirtc/video_io_harmony.h
32
33
  65b5d24fe3a6bc2a299a2220148a153ba4eb0955a49c1c3baabf1fdfed8aabdd include/tirtc/video_io_windows.h
33
34
  8cd6b66bea14890a665cc317f8572429b2c3e4463773f8b77c1e4dc30a4a8747 include/tirtc/video_processing.h
34
- ceb7cdd45efae57e5bd53d4177cb20c4a0cb9917fcdd23127b050d69c8b919ac lib/libTiRTC.a
35
+ 82653324cc9b6ea732ba8a4818175b8f99a5748ac0fa89f7e5c5e366a7f9e142 lib/libTiRTC.a
35
36
  b1f4135025cb8e8520a14268d831b9998920a4239f84bb6b409d0e4909fd5bee lib/libcrypto.a
36
- 296ba0b5efa9d2ac49e3bf278c5d467b31436e73fbc608b736e974bcf9759bde lib/libmatrix_runtime_audio.a
37
- 8552aba878ffb4c242e4af589784fafbdd938291663af750aaa94d902cba72ce lib/libmatrix_runtime_facade.a
37
+ 8a3b5da754707a9c6fbb73ab6176cdb12bc8af22d3a660249cb1812d501fb615 lib/libmatrix_runtime_audio.a
38
+ 76a97c258a718c79846aadc91a389a5bf411de95bb43c0bd9b8a3ed3a2e8fa58 lib/libmatrix_runtime_facade.a
38
39
  ec7bbf8e8744c6645a441a28e24e0645906152cc987d6fcca16af3c3badba940 lib/libmatrix_runtime_foundation_http.a
39
- b4f225727bf9c829c3329054112ab56477f1cc5729be1eb4952a85b649ba0a8a lib/libmatrix_runtime_foundation_logging.a
40
- 031927b01cee74366cf2662559c2ddfe8476531c4af7c549f311503d4da6f424 lib/libmatrix_runtime_media.a
41
- 4942f5c742a6013e35708f6dd1e5b8ca702454990f1785e82d734aaea6ab114d lib/libmatrix_runtime_transport.a
42
- 774e8ae6c5e96ff5976bf440bc259044157c51e0b1dab0e77e5e087b7d059f01 lib/libmatrix_runtime_video.a
40
+ a5759ecf8887d249209ba358a548e6878373a6854991299725d5fd4ed77ed2ed lib/libmatrix_runtime_foundation_logging.a
41
+ df52cb3856c179698761357ef40c063dcdb86fa67c0be186f64dcc9c634c36b4 lib/libmatrix_runtime_media.a
42
+ 177e9ca89640bca3ae49a164e820b7e33c0d22d14dcd7458c358e74a47ffbd70 lib/libmatrix_runtime_transport.a
43
+ e00ea11ed72e1a2414251ec9f5b3dea46ed440a5fe30f8d45ae64e60b1d0ac19 lib/libmatrix_runtime_video.a
44
+ 4b4b3170a775282fe2107f615539c985b4df43315572796faba23886aab62b1d lib/libmbedtls.a
43
45
  511d521f7972df3993e5976d6e2dbcad7a6fbce9be15071274d0cbd9d51157f5 lib/libssl.a
46
+ c3adc781b817481c5546e4a9bdd863dd192d204b3502a0de44a730793d4f6e64 lib/libusrsctp.a
47
+ 787f0d1f44f6f755305d1387172668a480c0ba9fdfdfb06af100351f957f6e38 lib/libwebrtc.a
44
48
  a67ec9034848ef24a1b17671e444daa62a8f9e6b8319a1e932593908720ff2a1 lib/libwebrtc_apm.a
45
49
  700e455255897e3cffab13ca593a6e4d9d11383ae609215cbbd6043a63d47161 lib/libxlog.a
@@ -42,7 +42,11 @@ typedef enum TirtcAudioOutputState {
42
42
  } TirtcAudioOutputState;
43
43
 
44
44
  typedef struct TirtcAudioInputOptions {
45
- TirtcAudioSampleRate sample_rate;
45
+ TirtcMediaCodec codec;
46
+
47
+ uint32_t sample_rate_hz;
48
+
49
+ uint32_t channels;
46
50
 
47
51
  TirtcAudioAecMode aec_mode;
48
52
 
@@ -61,9 +65,27 @@ typedef struct TirtcAudioInputOptions {
61
65
  typedef struct TirtcAudioEncodedInputOptions {
62
66
  TirtcMediaCodec codec;
63
67
 
64
- TirtcAudioSampleRate sample_rate;
68
+ uint32_t sample_rate_hz;
69
+
70
+ uint32_t channels;
65
71
  } TirtcAudioEncodedInputOptions;
66
72
 
73
+ typedef struct TirtcAudioEncodedInputFrame {
74
+ TirtcMediaCodec codec;
75
+
76
+ uint32_t sample_rate_hz;
77
+
78
+ uint32_t channels;
79
+
80
+ uint32_t samples_per_channel;
81
+
82
+ int64_t pts_us;
83
+
84
+ const void* data;
85
+
86
+ size_t data_bytes;
87
+ } TirtcAudioEncodedInputFrame;
88
+
67
89
  typedef struct TirtcAudioOutputOptions {
68
90
  uint32_t volume_percent;
69
91
 
@@ -91,6 +113,22 @@ typedef struct TirtcPendingDurationMetrics {
91
113
  uint64_t decoded_duration_ms;
92
114
  } TirtcPendingDurationMetrics;
93
115
 
116
+ typedef struct TirtcOutputLatencyStageMetrics {
117
+ uint64_t latest_ms;
118
+ uint64_t average_ms;
119
+ uint64_t peak_ms;
120
+ uint64_t sample_count;
121
+ uint64_t unavailable_count;
122
+ } TirtcOutputLatencyStageMetrics;
123
+
124
+ typedef struct TirtcOutputLocalLatencyMetrics {
125
+ uint32_t window_duration_ms;
126
+ TirtcOutputLatencyStageMetrics total;
127
+ TirtcOutputLatencyStageMetrics buffer;
128
+ TirtcOutputLatencyStageMetrics decode_or_ready;
129
+ TirtcOutputLatencyStageMetrics output;
130
+ } TirtcOutputLocalLatencyMetrics;
131
+
94
132
  typedef struct TirtcAudioOutputMetricsSnapshot {
95
133
  TirtcOutputStutterMetrics stutter;
96
134
  TirtcPendingDurationMetrics pending;
@@ -98,6 +136,7 @@ typedef struct TirtcAudioOutputMetricsSnapshot {
98
136
  double input_packet_rate;
99
137
  double render_callback_rate;
100
138
  uint32_t rate_window_duration_ms;
139
+ TirtcOutputLocalLatencyMetrics local_latency;
101
140
  } TirtcAudioOutputMetricsSnapshot;
102
141
 
103
142
  /**
@@ -109,6 +148,10 @@ typedef struct TirtcAudioOutputMetricsSnapshot {
109
148
  */
110
149
  typedef struct TirtcAudioOutputDebugSnapshot {
111
150
  TirtcMediaCodec codec;
151
+
152
+ uint32_t sample_rate_hz;
153
+
154
+ uint32_t channels;
112
155
  } TirtcAudioOutputDebugSnapshot;
113
156
 
114
157
  /**
@@ -195,7 +238,7 @@ TirtcError tirtc_audio_encoded_input_attach(TirtcAudioEncodedInput* input, Tirtc
195
238
  TirtcError tirtc_audio_encoded_input_detach(TirtcAudioEncodedInput* input, TirtcConn* connection);
196
239
 
197
240
  TirtcError tirtc_audio_encoded_input_submit_frame(TirtcAudioEncodedInput* input,
198
- const TirtcAudioEncodedFrame* frame);
241
+ const TirtcAudioEncodedInputFrame* frame);
199
242
 
200
243
  void tirtc_audio_encoded_input_destroy(TirtcAudioEncodedInput* input);
201
244
 
@@ -16,6 +16,12 @@ TirtcError tirtc_audio_g711a_encode(const TirtcAudioPcmFrame* pcm_frame, void* o
16
16
  TirtcError tirtc_audio_g711a_decode(const TirtcAudioEncodedFrame* in_frame, void* out_buffer,
17
17
  size_t out_buffer_capacity, TirtcAudioPcmFrame* out_frame);
18
18
 
19
+ TirtcError tirtc_audio_aac_encode(const TirtcAudioPcmFrame* pcm_frame, void* out_buffer,
20
+ size_t out_buffer_capacity, TirtcAudioEncodedFrame* out_frame);
21
+
22
+ TirtcError tirtc_audio_aac_decode(const TirtcAudioEncodedFrame* in_frame, void* out_buffer,
23
+ size_t out_buffer_capacity, TirtcAudioPcmFrame* out_frame);
24
+
19
25
  #ifdef __cplusplus
20
26
  }
21
27
  #endif
@@ -0,0 +1,20 @@
1
+ #ifndef TIRTC_MEDIA_CONTRACT_AUDIO_FORMAT_H_
2
+ #define TIRTC_MEDIA_CONTRACT_AUDIO_FORMAT_H_
3
+
4
+ #include <stdint.h>
5
+
6
+ #ifdef __cplusplus
7
+ extern "C" {
8
+ #endif
9
+
10
+ typedef struct TirtcAudioFormat {
11
+ uint32_t sample_rate_hz;
12
+ uint32_t channels;
13
+ uint32_t bits_per_sample;
14
+ } TirtcAudioFormat;
15
+
16
+ #ifdef __cplusplus
17
+ }
18
+ #endif
19
+
20
+ #endif // TIRTC_MEDIA_CONTRACT_AUDIO_FORMAT_H_
@@ -4,7 +4,7 @@
4
4
  #include <stddef.h>
5
5
  #include <stdint.h>
6
6
 
7
- #include "tirtc/audio_sample_rate.h"
7
+ #include "tirtc/audio_format.h"
8
8
  #include "tirtc/media_codec.h"
9
9
 
10
10
  #ifdef __cplusplus
@@ -12,17 +12,16 @@ extern "C" {
12
12
  #endif
13
13
 
14
14
  typedef struct TirtcAudioPcmFrame {
15
- TirtcAudioSampleRate sample_rate;
15
+ TirtcAudioFormat format;
16
16
  uint32_t samples_per_channel;
17
17
  int64_t pts_us;
18
- /* Mutable PCM payload for capture, processing, and render-fill paths. */
19
18
  void* data;
20
19
  size_t data_bytes;
21
20
  } TirtcAudioPcmFrame;
22
21
 
23
22
  typedef struct TirtcAudioEncodedFrame {
24
23
  TirtcMediaCodec codec;
25
- TirtcAudioSampleRate sample_rate;
24
+ TirtcAudioFormat format;
26
25
  uint32_t samples_per_channel;
27
26
  int64_t pts_us;
28
27
  const void* data;
@@ -14,8 +14,7 @@ typedef struct TirtcAudioAin TirtcAudioAin;
14
14
  typedef struct TirtcAudioAout TirtcAudioAout;
15
15
 
16
16
  typedef struct TirtcAudioIoConfig {
17
- TirtcAudioSampleRate sample_rate;
18
- /* AIN uses fixed 10 ms mono blocks; AOUT may use larger callback-sized multiples. */
17
+ TirtcAudioFormat format;
19
18
  uint32_t samples_per_buffer;
20
19
  } TirtcAudioIoConfig;
21
20
 
@@ -29,7 +28,7 @@ typedef void (*TirtcAudioAinOnFrameFn)(TirtcAudioAin* ain, const TirtcAudioPcmFr
29
28
  void* user_data);
30
29
 
31
30
  /*
32
- * AOUT pre-fills sample_rate, samples_per_channel, data, and data_bytes before
31
+ * AOUT pre-fills format, samples_per_channel, data, and data_bytes before
33
32
  * calling render. The callback contract expects a non-negative rendered PCM
34
33
  * byte count. Backends defensively clamp negative returns to zero and zero-fill
35
34
  * any remaining buffer space.
@@ -2,6 +2,7 @@
2
2
  #define TIRTC_AUDIO_PROCESSING_H_
3
3
 
4
4
  #include "tirtc/audio_frame.h"
5
+ #include "tirtc/audio_sample_rate.h"
5
6
  #include "tirtc/error.h"
6
7
 
7
8
  #ifdef __cplusplus
@@ -51,6 +51,7 @@ typedef struct TirtcVideoOutputMetricsSnapshot {
51
51
  double decoded_fps;
52
52
  double render_fps;
53
53
  uint32_t rate_window_duration_ms;
54
+ TirtcOutputLocalLatencyMetrics local_latency;
54
55
  } TirtcVideoOutputMetricsSnapshot;
55
56
 
56
57
  /**
@@ -8,6 +8,7 @@ extern "C" {
8
8
  typedef enum TirtcMediaCodec {
9
9
  TIRTC_MEDIA_CODEC_NONE = 0,
10
10
  TIRTC_MEDIA_CODEC_AUDIO_G711A = 1,
11
+ TIRTC_MEDIA_CODEC_AUDIO_AAC = 2,
11
12
  /* Reserved shared identifiers; concrete video implementations live outside media-contract. */
12
13
  TIRTC_MEDIA_CODEC_VIDEO_H264 = 65,
13
14
  TIRTC_MEDIA_CODEC_VIDEO_H265 = 66,
@@ -66,6 +66,22 @@ typedef struct TirtcMediaDownlinkPendingMetricsSnapshot {
66
66
  uint64_t decoded_pending_duration_ms;
67
67
  } TirtcMediaDownlinkPendingMetricsSnapshot;
68
68
 
69
+ typedef struct TirtcMediaDownlinkLatencyStageMetricsSnapshot {
70
+ uint64_t latest_ms;
71
+ uint64_t average_ms;
72
+ uint64_t peak_ms;
73
+ uint64_t sample_count;
74
+ uint64_t unavailable_count;
75
+ } TirtcMediaDownlinkLatencyStageMetricsSnapshot;
76
+
77
+ typedef struct TirtcMediaDownlinkLocalLatencyMetricsSnapshot {
78
+ uint32_t window_duration_ms;
79
+ TirtcMediaDownlinkLatencyStageMetricsSnapshot total;
80
+ TirtcMediaDownlinkLatencyStageMetricsSnapshot buffer;
81
+ TirtcMediaDownlinkLatencyStageMetricsSnapshot decode_or_ready;
82
+ TirtcMediaDownlinkLatencyStageMetricsSnapshot output;
83
+ } TirtcMediaDownlinkLocalLatencyMetricsSnapshot;
84
+
69
85
  typedef struct TirtcMediaDownlinkAudioMetricsSnapshot {
70
86
  TirtcMediaDownlinkStutterMetricsSnapshot stutter;
71
87
  TirtcMediaDownlinkPendingMetricsSnapshot pending;
@@ -73,6 +89,7 @@ typedef struct TirtcMediaDownlinkAudioMetricsSnapshot {
73
89
  double input_packet_rate;
74
90
  double render_callback_rate;
75
91
  uint32_t rate_window_duration_ms;
92
+ TirtcMediaDownlinkLocalLatencyMetricsSnapshot local_latency;
76
93
  } TirtcMediaDownlinkAudioMetricsSnapshot;
77
94
 
78
95
  typedef struct TirtcMediaDownlinkVideoStartupMetricsSnapshot {
@@ -93,6 +110,7 @@ typedef struct TirtcMediaDownlinkVideoMetricsSnapshot {
93
110
  double decoded_fps;
94
111
  double render_fps;
95
112
  uint32_t rate_window_duration_ms;
113
+ TirtcMediaDownlinkLocalLatencyMetricsSnapshot local_latency;
96
114
  } TirtcMediaDownlinkVideoMetricsSnapshot;
97
115
 
98
116
  /**
@@ -103,6 +121,7 @@ typedef struct TirtcMediaDownlinkVideoMetricsSnapshot {
103
121
  */
104
122
  typedef struct TirtcMediaDownlinkAudioDebugSnapshot {
105
123
  TirtcMediaCodec codec;
124
+ TirtcAudioFormat format;
106
125
  } TirtcMediaDownlinkAudioDebugSnapshot;
107
126
 
108
127
  /**
@@ -29,7 +29,8 @@ typedef enum TirtcMediaUplinkState {
29
29
  } TirtcMediaUplinkState;
30
30
 
31
31
  typedef struct TirtcMediaUplinkAudioOptions {
32
- TirtcAudioSampleRate sample_rate;
32
+ TirtcMediaCodec codec;
33
+ TirtcAudioFormat format;
33
34
  TirtcAudioAecMode aec_mode;
34
35
  TirtcAudioAgcLevel agc_level;
35
36
  TirtcAudioAnsLevel ans_level;
@@ -1,26 +1,27 @@
1
1
  platform=macos-arm64
2
2
  profile=full
3
- staged_at_utc=2026-05-09T08:57:10Z
3
+ staged_at_utc=2026-05-13T16:53:41Z
4
4
  source_sdk=/Users/allenfeng/Development/Repositories/tirtc-nexus/tirtc-matrix/.build/sdk/macos-arm64
5
5
 
6
- 92ac54ea714e5a7da536d3d63b955a9e30faf9560ebe670034a79f3ea69c21cb include/tirtc/audio.h
7
- 6d972ccfe150a3b4f2d7f18fa92b3ade9210c1c8bb754d061ac6b7997b59e2cb include/tirtc/audio_codec.h
8
- 7bacbdb2d8bb10d6444036a8fef42f2a8e3ea34dfc38e165ee678d61f189db41 include/tirtc/audio_frame.h
9
- fb8ea35263167c33487bd3aa503c26ed2dfbf97877f7bda92c10065cd5c97c13 include/tirtc/audio_io.h
6
+ 04c3139f26d53aa2fb0a586a21ffb481a001c01e0412cd3414a952c9a9d336ba include/tirtc/audio.h
7
+ ce7ccffa054250a2dab0e2128e4701a66c7168e50e8c470dcff3bf609ff0959c include/tirtc/audio_codec.h
8
+ 0b463d8adfcf45acb3f95fe3e2d94b37a26aaf37d293eb2b18274ddcb161f767 include/tirtc/audio_format.h
9
+ 7cac5b8c0cef28526ee00800fa8b0d1e60897ab971a0801899cb0333c9189fde include/tirtc/audio_frame.h
10
+ 6daadba731521c01a3cf11c5d8b2ef797238737c939e2da3045fc83ad89af04a include/tirtc/audio_io.h
10
11
  c2e1f31dcc75be461c577d18b1cebe32774f212d51cb4dd2a5b5a9bfe62b693e include/tirtc/audio_io_android.h
11
12
  878bb18220ac62304ec95807f31e83e050c8dac14811f873454f9b045028694a include/tirtc/audio_io_apple.h
12
13
  0569eb1d043ee7fa8d45ca43143eca1a22e4c4bf1507ca7e045e010a3ecbc288 include/tirtc/audio_io_harmony.h
13
14
  51cbc911fe9f9834046f0e0a1a7cdd814a8e194a615894a8b4d11f9e5f095610 include/tirtc/audio_io_windows.h
14
- 21f60729117260a44af22c1af986ef17d22673b102b7b7a035f492d0665cce16 include/tirtc/audio_processing.h
15
+ 5acfd19fdcd8c9d96e4aee7c6f1d33a9211c0a5b0c0ab56d96e1b4dee48f3aa9 include/tirtc/audio_processing.h
15
16
  0ca7c3c630b1242f51a0fd8154097c0a332b4c816a5707090e4381719852998c include/tirtc/audio_sample_rate.h
16
- f40ce007241e4aa6ef2e2bcd589060636ef0e9859a9102c8b955d348f4f7eabc include/tirtc/av.h
17
+ 07ca1b210a6e334c1474f25446477681472154568ecf74557cb3dc9b3a730662 include/tirtc/av.h
17
18
  b3e110ce04057d3be696b120d1abeaf6141711a1c63ca7f9bdf65ed5ec6e16d7 include/tirtc/error.h
18
19
  ae805545a9515edc9b94262e72ad2c7b7d649288166f4daeb450d8a55e82ae0b include/tirtc/foundation/build_info.h
19
20
  7cf8b372a3d48d4de4a65a04c7f102281a7b42cebb9ec247853d3c53afb63b6a include/tirtc/http.h
20
21
  70bbf93b84d9d1a85f376d9986de570c1f658319e1e5ab6d621f7a4d41033f5c include/tirtc/logging.h
21
- 7e2f7f81afe37e22f5414d9db32438edd948ff775230c3a0a17ff9ac1a0b560e include/tirtc/media_codec.h
22
- 43c0ac9173b6259a1b1379eac780f4892a0a72572801ac9eb8516c0bdb4913c3 include/tirtc/media_downlink.h
23
- e64191a39004165cdcd11b2ca824af34d4bfe02f7ec3c3101fa9291f56488c30 include/tirtc/media_uplink.h
22
+ 1419ac3fb5237d1d820bd30a6845b98aab3553463eb64e73623b64c663665f16 include/tirtc/media_codec.h
23
+ df11627da9bfbb87cb32582701f638d2a0ff5b6b77b49a3a3bab7509c62f0613 include/tirtc/media_downlink.h
24
+ 9376af63fde915753146969291f0fefe2da6df28f7aa6310f7787048165150dc include/tirtc/media_uplink.h
24
25
  57be6941026e7dd173e8779b2bb868532d65e41f7917aad476a31ac25c1cd6c3 include/tirtc/transport.h
25
26
  fba7954919606e507b6a074440440903665217959699da89ca9dd206772c0ef0 include/tirtc/trp.h
26
27
  92b3db6e2cb02265ad5db01881edce9d4e095b1dadf449dce5d8bb5362957e33 include/tirtc/video_codec.h
@@ -32,16 +33,16 @@ cae0bbeb884e5466a56da15182c78cc22baab6c743f349a58d3595f623333585 include/tirtc/
32
33
  65b5d24fe3a6bc2a299a2220148a153ba4eb0955a49c1c3baabf1fdfed8aabdd include/tirtc/video_io_windows.h
33
34
  8cd6b66bea14890a665cc317f8572429b2c3e4463773f8b77c1e4dc30a4a8747 include/tirtc/video_processing.h
34
35
  5052a464a34508f117fec46aa6b836871014229d4290d7d8caac862e0165ae8f lib/libTGTRP.a
35
- 8db86d6714264047e8fd4086ddd7315722d675749719e6175f89eb5a636b48a1 lib/libTiRTC.a
36
+ 41d64a3a9dd5cd4f51d45be501e8df2161a59847bb599b218ac55194673189f9 lib/libTiRTC.a
36
37
  b39daee6a3d39bf0ca20c45084601133c4198de8dca848dcff6dd9c70ae99016 lib/libcrypto.a
37
38
  c052857ef315e3d61db9c862cad10709a3a6b2487dc41799cbe4d74a805de875 lib/libcrypto.dylib
38
- e2cc6ebe4b3efd602dd454c32cf5a56f7cecddff52ba51a09307434a102a3134 lib/libmatrix_runtime_audio.a
39
- 86952647a2ee67457e5e0129270bbcc130bc1c3055674bd1256996e63d1d396d lib/libmatrix_runtime_facade.a
40
- 88c8067852e3a334f6d7b741d36ffe4d5dc5a639b50a5566178485f2e3a62d51 lib/libmatrix_runtime_foundation_http.a
41
- 5928ccfe2717594f66aba6b43d3b3d394634d2d742d5a79ccd86d17ab56adf6c lib/libmatrix_runtime_foundation_logging.a
42
- a1a7c04dff1601fee215bf71b99a1b2725b74171b7182ab807b4f40ba96a5554 lib/libmatrix_runtime_media.a
43
- 8adcf9d35a21d86392336389e361d6c75554ba1cdd6afde74e9e748adff34b77 lib/libmatrix_runtime_transport.a
44
- 9e8db21a0c02d407799a9acc80042af2de38bc2b9509914df6d0bd63cae1a945 lib/libmatrix_runtime_video.a
39
+ 3316e224dda38d03604c68a3904efddb13909dfc50d682c24a3252679646ffc9 lib/libmatrix_runtime_audio.a
40
+ 50b5deab7ecfeb7cbf5fe9ab6f91a6d163ebcf518c6e3beb0096a33db1833640 lib/libmatrix_runtime_facade.a
41
+ a7a3f8e4adac588583db2dc6179aec86ae73e93cb65a85d14933dd7b2724fb3f lib/libmatrix_runtime_foundation_http.a
42
+ e602bd53bebb54f5e612fccade3add7abd418e235c41974b532739f3218c5fe1 lib/libmatrix_runtime_foundation_logging.a
43
+ 74e1b90aedaf84c7679c65278804a27fa5fd8d8101d05dfed9782728a15719cd lib/libmatrix_runtime_media.a
44
+ 16a2dc91c75f99fa9cef357cefe89cf0fdfef682de0524d18b08e6d8e86875cf lib/libmatrix_runtime_transport.a
45
+ c236e578105e2bf1551902f763426ec53a8ae1e40d44833e2ba7b16afc64d00b lib/libmatrix_runtime_video.a
45
46
  c11c65d373a127028350c41fa58cd2d1223f2b5d70a84e13b115d90daaba25ca lib/libssl.a
46
47
  ef1c1104bbdd2528ed7b958fb7252bd6249875f92300b0c9577d6c4bd6c0d88a lib/libssl.dylib
47
48
  e14e846e43d64e240fa0e5745bf4e702b79d0f2442e7f768beb990610735c71b lib/libtgrtc.dylib
@@ -133,19 +133,19 @@ require_cmd "$FFPROBE_BIN"
133
133
  SOURCE_ABS="$(cd "$(dirname "$SOURCE")" && pwd)/$(basename "$SOURCE")"
134
134
  SOURCE_FILE_NAME="$(basename "$SOURCE_ABS")"
135
135
 
136
- readonly k_schema_version=2
137
- readonly k_tool_version="runtime_local_assets_prepare_v5"
136
+ readonly k_schema_version=3
137
+ readonly k_tool_version="runtime_local_assets_prepare_v6"
138
138
  readonly k_video_max_width=1280
139
139
  readonly k_video_max_height=720
140
140
  readonly k_video_fps=15
141
141
  readonly k_audio_sample_rate_hz=8000
142
142
  readonly k_audio_sample_rate_16k_hz=16000
143
- readonly k_audio_channels=1
144
143
  readonly k_audio_packet_duration_ms=40
144
+ readonly k_audio_bits_per_sample=16
145
+ readonly k_aac_packet_samples_per_channel=1024
145
146
  readonly k_mjpeg_packet_duration_ms=80
146
147
  readonly k_mjpeg_extract_interval_seconds=10
147
148
  readonly k_loop_policy="continuous_pts"
148
- readonly k_audio_codec="g711a"
149
149
  readonly k_output_audio_format="pcm_s16"
150
150
  readonly k_output_video_format="rgba8888"
151
151
 
@@ -253,10 +253,6 @@ VIDEO_H265_PATH="$ASSETS_DIR/video/video.h265"
253
253
  VIDEO_H265_PACKET_INDEX_PATH="$ASSETS_DIR/video/video_h265_packets.csv"
254
254
  VIDEO_MJPEG_PATH="$ASSETS_DIR/video/video.mjpeg"
255
255
  VIDEO_MJPEG_PACKET_INDEX_PATH="$ASSETS_DIR/video/video_mjpeg_packets.csv"
256
- AUDIO_PATH="$ASSETS_DIR/audio/audio.g711a"
257
- AUDIO_PACKET_INDEX_PATH="$ASSETS_DIR/audio/audio_packets.csv"
258
- AUDIO_16K_PATH="$ASSETS_DIR/audio/audio_16k.g711a"
259
- AUDIO_16K_PACKET_INDEX_PATH="$ASSETS_DIR/audio/audio_16k_packets.csv"
260
256
 
261
257
  video_encode_args=(
262
258
  -vf "fps=${k_video_fps},scale=${TARGET_VIDEO_WIDTH}:${TARGET_VIDEO_HEIGHT}:flags=lanczos"
@@ -335,26 +331,6 @@ if ! find "$mjpeg_frame_dir" -type f -name 'frame_*.jpg' | grep -q .; then
335
331
  "$mjpeg_frame_dir/frame_000001.jpg"
336
332
  fi
337
333
 
338
- progress "encoding 8k g711a audio track"
339
- "$FFMPEG_BIN" -hide_banner -loglevel error -y \
340
- -i "$SOURCE_ABS" \
341
- -vn \
342
- -ac ${k_audio_channels} \
343
- -ar ${k_audio_sample_rate_hz} \
344
- -c:a pcm_alaw \
345
- -f alaw \
346
- "$AUDIO_PATH"
347
-
348
- progress "encoding 16k g711a audio track"
349
- "$FFMPEG_BIN" -hide_banner -loglevel error -y \
350
- -i "$SOURCE_ABS" \
351
- -vn \
352
- -ac ${k_audio_channels} \
353
- -ar ${k_audio_sample_rate_16k_hz} \
354
- -c:a pcm_alaw \
355
- -f alaw \
356
- "$AUDIO_16K_PATH"
357
-
358
334
  progress "indexing h264 video packets"
359
335
  VIDEO_PACKET_INDEX_PATH="$VIDEO_H264_PACKET_INDEX_PATH" \
360
336
  VIDEO_PATH="$VIDEO_H264_PATH" \
@@ -607,16 +583,35 @@ for (let index = 0; index < packetCount; index += 1) {
607
583
  fs.writeFileSync(indexPath, `${lines.join('\n')}\n`, 'utf8');
608
584
  NODE
609
585
 
610
- progress "indexing 8k g711a audio packets"
611
- AUDIO_BYTES="$(wc -c < "$AUDIO_PATH" | tr -d '[:space:]')"
612
- AUDIO_PACKET_BYTES=$((k_audio_sample_rate_hz * k_audio_packet_duration_ms / 1000))
613
- [[ "$AUDIO_PACKET_BYTES" -gt 0 ]] || fail "invalid audio packet bytes"
614
- AUDIO_REMAINDER=$((AUDIO_BYTES % AUDIO_PACKET_BYTES))
615
- if [[ "$AUDIO_REMAINDER" -ne 0 ]]; then
616
- AUDIO_ALIGNED_BYTES=$((AUDIO_BYTES - AUDIO_REMAINDER))
617
- [[ "$AUDIO_ALIGNED_BYTES" -gt 0 ]] || fail "audio output is too short for one full packet"
618
- echo "[prepare_runtime_media_dataset] trim trailing audio bytes to packet boundary: removed=${AUDIO_REMAINDER}" >&2
619
- AUDIO_PATH="$AUDIO_PATH" AUDIO_ALIGNED_BYTES="$AUDIO_ALIGNED_BYTES" node <<'NODE'
586
+ encode_g711a_track() {
587
+ local sample_rate="$1"
588
+ local channels="$2"
589
+ local key="$3"
590
+ local output_path="$ASSETS_DIR/audio/${key}.g711a"
591
+ local index_path="$ASSETS_DIR/audio/${key}.csv"
592
+
593
+ progress "encoding ${key} audio track"
594
+ "$FFMPEG_BIN" -hide_banner -loglevel error -y \
595
+ -i "$SOURCE_ABS" \
596
+ -vn \
597
+ -ac "$channels" \
598
+ -ar "$sample_rate" \
599
+ -c:a pcm_alaw \
600
+ -f alaw \
601
+ "$output_path"
602
+
603
+ progress "indexing ${key} audio packets"
604
+ local audio_bytes
605
+ audio_bytes="$(wc -c < "$output_path" | tr -d '[:space:]')"
606
+ local samples_per_packet=$((sample_rate * k_audio_packet_duration_ms / 1000))
607
+ local packet_bytes=$((samples_per_packet * channels))
608
+ [[ "$packet_bytes" -gt 0 ]] || fail "invalid audio packet bytes"
609
+ local remainder=$((audio_bytes % packet_bytes))
610
+ if [[ "$remainder" -ne 0 ]]; then
611
+ local aligned_bytes=$((audio_bytes - remainder))
612
+ [[ "$aligned_bytes" -gt 0 ]] || fail "${key} audio output is too short for one full packet"
613
+ echo "[prepare_runtime_media_dataset] trim trailing ${key} bytes to packet boundary: removed=${remainder}" >&2
614
+ AUDIO_PATH="$output_path" AUDIO_ALIGNED_BYTES="$aligned_bytes" node <<'NODE'
620
615
  const fs = require('fs');
621
616
  const audioPath = process.env.AUDIO_PATH;
622
617
  const alignedBytes = Number(process.env.AUDIO_ALIGNED_BYTES || '0');
@@ -625,51 +620,93 @@ if (!audioPath || !Number.isFinite(alignedBytes) || alignedBytes <= 0) {
625
620
  }
626
621
  fs.truncateSync(audioPath, alignedBytes);
627
622
  NODE
628
- AUDIO_BYTES="$AUDIO_ALIGNED_BYTES"
629
- fi
630
- AUDIO_PACKET_COUNT=$((AUDIO_BYTES / AUDIO_PACKET_BYTES))
631
- [[ "$AUDIO_PACKET_COUNT" -gt 0 ]] || fail "generated audio packets are empty"
632
-
633
- {
634
- echo "pts_us,offset,size"
635
- for ((i = 0; i < AUDIO_PACKET_COUNT; i += 1)); do
636
- pts_us=$((i * k_audio_packet_duration_ms * 1000))
637
- offset=$((i * AUDIO_PACKET_BYTES))
638
- echo "${pts_us},${offset},${AUDIO_PACKET_BYTES}"
639
- done
640
- } > "$AUDIO_PACKET_INDEX_PATH"
641
-
642
- progress "indexing 16k g711a audio packets"
643
- AUDIO_16K_BYTES="$(wc -c < "$AUDIO_16K_PATH" | tr -d '[:space:]')"
644
- AUDIO_16K_PACKET_BYTES=$((k_audio_sample_rate_16k_hz * k_audio_packet_duration_ms / 1000))
645
- [[ "$AUDIO_16K_PACKET_BYTES" -gt 0 ]] || fail "invalid 16k audio packet bytes"
646
- AUDIO_16K_REMAINDER=$((AUDIO_16K_BYTES % AUDIO_16K_PACKET_BYTES))
647
- if [[ "$AUDIO_16K_REMAINDER" -ne 0 ]]; then
648
- AUDIO_16K_ALIGNED_BYTES=$((AUDIO_16K_BYTES - AUDIO_16K_REMAINDER))
649
- [[ "$AUDIO_16K_ALIGNED_BYTES" -gt 0 ]] || fail "16k audio output is too short for one full packet"
650
- echo "[prepare_runtime_media_dataset] trim trailing 16k audio bytes to packet boundary: removed=${AUDIO_16K_REMAINDER}" >&2
651
- AUDIO_PATH="$AUDIO_16K_PATH" AUDIO_ALIGNED_BYTES="$AUDIO_16K_ALIGNED_BYTES" node <<'NODE'
623
+ audio_bytes="$aligned_bytes"
624
+ fi
625
+ local packet_count=$((audio_bytes / packet_bytes))
626
+ [[ "$packet_count" -gt 0 ]] || fail "generated ${key} audio packets are empty"
627
+
628
+ {
629
+ echo "pts_us,offset,size,samples_per_channel"
630
+ for ((i = 0; i < packet_count; i += 1)); do
631
+ pts_us=$((i * k_audio_packet_duration_ms * 1000))
632
+ offset=$((i * packet_bytes))
633
+ echo "${pts_us},${offset},${packet_bytes},${samples_per_packet}"
634
+ done
635
+ } > "$index_path"
636
+ }
637
+
638
+ encode_aac_track() {
639
+ local sample_rate="$1"
640
+ local channels="$2"
641
+ local key="$3"
642
+ local adts_path="$ASSETS_DIR/audio/${key}.adts"
643
+ local output_path="$ASSETS_DIR/audio/${key}.aac"
644
+ local index_path="$ASSETS_DIR/audio/${key}.csv"
645
+
646
+ progress "encoding ${key} audio track"
647
+ "$FFMPEG_BIN" -hide_banner -loglevel error -y \
648
+ -i "$SOURCE_ABS" \
649
+ -vn \
650
+ -ac "$channels" \
651
+ -ar "$sample_rate" \
652
+ -c:a aac \
653
+ -profile:a aac_low \
654
+ -f adts \
655
+ "$adts_path"
656
+
657
+ progress "indexing ${key} audio packets"
658
+ ADTS_PATH="$adts_path" OUTPUT_PATH="$output_path" INDEX_PATH="$index_path" SAMPLE_RATE="$sample_rate" AAC_PACKET_SAMPLES_PER_CHANNEL="$k_aac_packet_samples_per_channel" node <<'NODE'
652
659
  const fs = require('fs');
653
- const audioPath = process.env.AUDIO_PATH;
654
- const alignedBytes = Number(process.env.AUDIO_ALIGNED_BYTES || '0');
655
- if (!audioPath || !Number.isFinite(alignedBytes) || alignedBytes <= 0) {
656
- throw new Error('audio trim env is incomplete');
660
+ const adtsPath = process.env.ADTS_PATH;
661
+ const outputPath = process.env.OUTPUT_PATH;
662
+ const indexPath = process.env.INDEX_PATH;
663
+ const sampleRate = Number(process.env.SAMPLE_RATE || '0');
664
+ if (!adtsPath || !outputPath || !indexPath || !Number.isFinite(sampleRate) || sampleRate <= 0) {
665
+ throw new Error('aac packet index env is incomplete');
666
+ }
667
+ const data = fs.readFileSync(adtsPath);
668
+ const chunks = [];
669
+ const rows = ['pts_us,offset,size,samples_per_channel'];
670
+ let cursor = 0;
671
+ let outputOffset = 0;
672
+ let packetIndex = 0;
673
+ const samplesPerChannel = Number(process.env.AAC_PACKET_SAMPLES_PER_CHANNEL || '1024');
674
+ if (!Number.isFinite(samplesPerChannel) || samplesPerChannel <= 0) {
675
+ throw new Error('aac packet samples env is invalid');
676
+ }
677
+ while (cursor + 7 <= data.length) {
678
+ if (data[cursor] !== 0xff || (data[cursor + 1] & 0xf0) !== 0xf0) {
679
+ throw new Error(`aac adts sync missing at offset ${cursor}`);
680
+ }
681
+ const protectionAbsent = data[cursor + 1] & 0x01;
682
+ const headerBytes = protectionAbsent ? 7 : 9;
683
+ const frameLength = ((data[cursor + 3] & 0x03) << 11) | (data[cursor + 4] << 3) | ((data[cursor + 5] & 0xe0) >> 5);
684
+ if (frameLength <= headerBytes || cursor + frameLength > data.length) {
685
+ throw new Error(`aac adts invalid frame length at offset ${cursor}`);
686
+ }
687
+ const payload = data.subarray(cursor + headerBytes, cursor + frameLength);
688
+ const ptsUs = Math.round(packetIndex * samplesPerChannel * 1_000_000 / sampleRate);
689
+ rows.push(`${ptsUs},${outputOffset},${payload.length},${samplesPerChannel}`);
690
+ chunks.push(payload);
691
+ outputOffset += payload.length;
692
+ packetIndex += 1;
693
+ cursor += frameLength;
657
694
  }
658
- fs.truncateSync(audioPath, alignedBytes);
695
+ if (packetIndex === 0 || outputOffset === 0) {
696
+ throw new Error('aac packet index is empty');
697
+ }
698
+ fs.writeFileSync(outputPath, Buffer.concat(chunks));
699
+ fs.writeFileSync(indexPath, `${rows.join('\n')}\n`, 'utf8');
700
+ fs.rmSync(adtsPath, {force: true});
659
701
  NODE
660
- AUDIO_16K_BYTES="$AUDIO_16K_ALIGNED_BYTES"
661
- fi
662
- AUDIO_16K_PACKET_COUNT=$((AUDIO_16K_BYTES / AUDIO_16K_PACKET_BYTES))
663
- [[ "$AUDIO_16K_PACKET_COUNT" -gt 0 ]] || fail "generated 16k audio packets are empty"
702
+ }
664
703
 
665
- {
666
- echo "pts_us,offset,size"
667
- for ((i = 0; i < AUDIO_16K_PACKET_COUNT; i += 1)); do
668
- pts_us=$((i * k_audio_packet_duration_ms * 1000))
669
- offset=$((i * AUDIO_16K_PACKET_BYTES))
670
- echo "${pts_us},${offset},${AUDIO_16K_PACKET_BYTES}"
704
+ for sample_rate in "$k_audio_sample_rate_hz" "$k_audio_sample_rate_16k_hz"; do
705
+ for channels in 1 2; do
706
+ encode_g711a_track "$sample_rate" "$channels" "g711a_${sample_rate}_${channels}ch_s16"
707
+ encode_aac_track "$sample_rate" "$channels" "aac_${sample_rate}_${channels}ch_s16"
671
708
  done
672
- } > "$AUDIO_16K_PACKET_INDEX_PATH"
709
+ done
673
710
 
674
711
  progress "writing prepared media manifest"
675
712
  cat > "$MANIFEST_PATH" <<JSON
@@ -690,12 +727,14 @@ cat > "$MANIFEST_PATH" <<JSON
690
727
  "bitrate_kbps": ${TARGET_VIDEO_BITRATE_KBPS}
691
728
  },
692
729
  "audio": {
693
- "path": "audio/audio.g711a",
694
- "packet_index_path": "audio/audio_packets.csv",
695
- "codec": "${k_audio_codec}",
730
+ "path": "audio/g711a_8000_1ch_s16.g711a",
731
+ "packet_index_path": "audio/g711a_8000_1ch_s16.csv",
732
+ "codec": "g711a",
696
733
  "sample_rate_hz": ${k_audio_sample_rate_hz},
697
- "channels": ${k_audio_channels},
698
- "packet_duration_ms": ${k_audio_packet_duration_ms}
734
+ "channels": 1,
735
+ "bits_per_sample": ${k_audio_bits_per_sample},
736
+ "packet_duration_ms": ${k_audio_packet_duration_ms},
737
+ "packet_samples_per_channel": $((k_audio_sample_rate_hz * k_audio_packet_duration_ms / 1000))
699
738
  },
700
739
  "output": {
701
740
  "audio_format": "${k_output_audio_format}",
@@ -731,21 +770,85 @@ cat > "$MANIFEST_PATH" <<JSON
731
770
  }
732
771
  },
733
772
  "audio_tracks": {
734
- "g711a_8k": {
735
- "path": "audio/audio.g711a",
736
- "packet_index_path": "audio/audio_packets.csv",
737
- "codec": "${k_audio_codec}",
773
+ "g711a_8000_1ch_s16": {
774
+ "path": "audio/g711a_8000_1ch_s16.g711a",
775
+ "packet_index_path": "audio/g711a_8000_1ch_s16.csv",
776
+ "codec": "g711a",
777
+ "sample_rate_hz": ${k_audio_sample_rate_hz},
778
+ "channels": 1,
779
+ "bits_per_sample": ${k_audio_bits_per_sample},
780
+ "packet_duration_ms": ${k_audio_packet_duration_ms},
781
+ "packet_samples_per_channel": $((k_audio_sample_rate_hz * k_audio_packet_duration_ms / 1000))
782
+ },
783
+ "g711a_8000_2ch_s16": {
784
+ "path": "audio/g711a_8000_2ch_s16.g711a",
785
+ "packet_index_path": "audio/g711a_8000_2ch_s16.csv",
786
+ "codec": "g711a",
738
787
  "sample_rate_hz": ${k_audio_sample_rate_hz},
739
- "channels": ${k_audio_channels},
740
- "packet_duration_ms": ${k_audio_packet_duration_ms}
788
+ "channels": 2,
789
+ "bits_per_sample": ${k_audio_bits_per_sample},
790
+ "packet_duration_ms": ${k_audio_packet_duration_ms},
791
+ "packet_samples_per_channel": $((k_audio_sample_rate_hz * k_audio_packet_duration_ms / 1000))
792
+ },
793
+ "g711a_16000_1ch_s16": {
794
+ "path": "audio/g711a_16000_1ch_s16.g711a",
795
+ "packet_index_path": "audio/g711a_16000_1ch_s16.csv",
796
+ "codec": "g711a",
797
+ "sample_rate_hz": ${k_audio_sample_rate_16k_hz},
798
+ "channels": 1,
799
+ "bits_per_sample": ${k_audio_bits_per_sample},
800
+ "packet_duration_ms": ${k_audio_packet_duration_ms},
801
+ "packet_samples_per_channel": $((k_audio_sample_rate_16k_hz * k_audio_packet_duration_ms / 1000))
802
+ },
803
+ "g711a_16000_2ch_s16": {
804
+ "path": "audio/g711a_16000_2ch_s16.g711a",
805
+ "packet_index_path": "audio/g711a_16000_2ch_s16.csv",
806
+ "codec": "g711a",
807
+ "sample_rate_hz": ${k_audio_sample_rate_16k_hz},
808
+ "channels": 2,
809
+ "bits_per_sample": ${k_audio_bits_per_sample},
810
+ "packet_duration_ms": ${k_audio_packet_duration_ms},
811
+ "packet_samples_per_channel": $((k_audio_sample_rate_16k_hz * k_audio_packet_duration_ms / 1000))
812
+ },
813
+ "aac_8000_1ch_s16": {
814
+ "path": "audio/aac_8000_1ch_s16.aac",
815
+ "packet_index_path": "audio/aac_8000_1ch_s16.csv",
816
+ "codec": "aac",
817
+ "sample_rate_hz": ${k_audio_sample_rate_hz},
818
+ "channels": 1,
819
+ "bits_per_sample": ${k_audio_bits_per_sample},
820
+ "packet_duration_ms": $((k_aac_packet_samples_per_channel * 1000 / k_audio_sample_rate_hz)),
821
+ "packet_samples_per_channel": ${k_aac_packet_samples_per_channel}
822
+ },
823
+ "aac_8000_2ch_s16": {
824
+ "path": "audio/aac_8000_2ch_s16.aac",
825
+ "packet_index_path": "audio/aac_8000_2ch_s16.csv",
826
+ "codec": "aac",
827
+ "sample_rate_hz": ${k_audio_sample_rate_hz},
828
+ "channels": 2,
829
+ "bits_per_sample": ${k_audio_bits_per_sample},
830
+ "packet_duration_ms": $((k_aac_packet_samples_per_channel * 1000 / k_audio_sample_rate_hz)),
831
+ "packet_samples_per_channel": ${k_aac_packet_samples_per_channel}
832
+ },
833
+ "aac_16000_1ch_s16": {
834
+ "path": "audio/aac_16000_1ch_s16.aac",
835
+ "packet_index_path": "audio/aac_16000_1ch_s16.csv",
836
+ "codec": "aac",
837
+ "sample_rate_hz": ${k_audio_sample_rate_16k_hz},
838
+ "channels": 1,
839
+ "bits_per_sample": ${k_audio_bits_per_sample},
840
+ "packet_duration_ms": $((k_aac_packet_samples_per_channel * 1000 / k_audio_sample_rate_16k_hz)),
841
+ "packet_samples_per_channel": ${k_aac_packet_samples_per_channel}
741
842
  },
742
- "g711a_16k": {
743
- "path": "audio/audio_16k.g711a",
744
- "packet_index_path": "audio/audio_16k_packets.csv",
745
- "codec": "${k_audio_codec}",
843
+ "aac_16000_2ch_s16": {
844
+ "path": "audio/aac_16000_2ch_s16.aac",
845
+ "packet_index_path": "audio/aac_16000_2ch_s16.csv",
846
+ "codec": "aac",
746
847
  "sample_rate_hz": ${k_audio_sample_rate_16k_hz},
747
- "channels": ${k_audio_channels},
748
- "packet_duration_ms": ${k_audio_packet_duration_ms}
848
+ "channels": 2,
849
+ "bits_per_sample": ${k_audio_bits_per_sample},
850
+ "packet_duration_ms": $((k_aac_packet_samples_per_channel * 1000 / k_audio_sample_rate_16k_hz)),
851
+ "packet_samples_per_channel": ${k_aac_packet_samples_per_channel}
749
852
  }
750
853
  },
751
854
  "loop_policy": "${k_loop_policy}"