feat: ship Wave 5-6 multi-surface hygiene, optimization, and bug fixes
This commit is contained in:
parent
01ef3293cf
commit
66b6b45ba9
399 changed files with 17828 additions and 11330 deletions
|
|
@ -12,6 +12,7 @@ import { getSoxPath } from '../utils/paths'
|
|||
import type { AudioDevice } from '@d3ro/core/types'
|
||||
import { AUDIO_FORMAT, TIMING } from '@d3ro/core/constants'
|
||||
import { D3ROError, ErrorCode } from '@d3ro/core/errors'
|
||||
import { secureWipeAudioChunks, secureZeroBuffer } from '@d3ro/core/utils/secure-memory'
|
||||
|
||||
const logger = getLogger('AudioCaptureService')
|
||||
|
||||
|
|
@ -522,15 +523,22 @@ class AudioCaptureService extends EventEmitter {
|
|||
if (rms > peakRms) peakRms = rms
|
||||
})
|
||||
|
||||
proc.on('error', (err) => {
|
||||
reject(new D3ROError(ErrorCode.AudioCaptureStartFailed, `SoX 실행 실패: ${err.message}`))
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
let settled = false
|
||||
const durationTimer = setTimeout(() => {
|
||||
proc.kill()
|
||||
}, durationMs)
|
||||
|
||||
proc.on('error', (err) => {
|
||||
if (settled) return
|
||||
settled = true
|
||||
clearTimeout(durationTimer)
|
||||
reject(new D3ROError(ErrorCode.AudioCaptureStartFailed, `SoX 실행 실패: ${err.message}`))
|
||||
})
|
||||
|
||||
proc.on('close', () => {
|
||||
if (settled) return
|
||||
settled = true
|
||||
clearTimeout(durationTimer)
|
||||
if (buffers.length === 0) {
|
||||
resolve({ averageLevel: 0, peakLevel: 0, hasAudio: false })
|
||||
return
|
||||
|
|
@ -645,8 +653,9 @@ class AudioCaptureService extends EventEmitter {
|
|||
}
|
||||
}
|
||||
|
||||
secureZeroBuffer(this._residualBuffer)
|
||||
secureWipeAudioChunks(this._levelAccumulator)
|
||||
this._residualBuffer = Buffer.alloc(0)
|
||||
this._levelAccumulator = []
|
||||
}
|
||||
|
||||
// EventEmitter 타입 오버라이드
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue