cai
2026-08-08 386bc138d82933123189fdbc8d856a1fae5feccf
tools/validate-turn-stream-fixture.mjs
@@ -30,6 +30,7 @@
let traceId = null
let turnId = null
const supportedAudioFormats = new Set(['pcm_s16le', 'mp3', 'mpeg', 'wav'])
const supportedPcmSampleRates = new Set([16000, 48000])
function fail(message) {
  console.error(`turn stream fixture invalid: ${message}`)
@@ -100,8 +101,8 @@
      fail(`${chunk.format} payload must be non-empty`)
    }
    if (chunk.format === 'pcm_s16le') {
      if (chunk.sampleRate !== 48000 || chunk.channels !== 1) {
        fail('pcm_s16le chunk must be 48000Hz mono')
      if (!supportedPcmSampleRates.has(chunk.sampleRate) || chunk.channels !== 1) {
        fail('pcm_s16le chunk must be 16000Hz or 48000Hz mono')
      }
      if (payload.length % 2 !== 0) {
        fail('pcm_s16le payload must be 16-bit aligned')