early-window-29567
11/13/2025, 4:55 PMsend_lesson_data() tool
4. SIMULTANEOUSLY: TTS is generating audio and the audio capture system is actively reading frames
5. send_lesson_data publishes to data channel
6. CRASH POINT: FFI tries to capture audio frame but the handle has become invalid during the data channel operation
7. Error: livekit_ffi::cabi - failed to handle request CaptureAudioFrame: InvalidRequest("handle not found")
8. Process becomes unresponsive and is killed
So what I have done is add a delay so the daa is sent once the voice stops but there's not guarantee the voice will stop before the delay and prevent the crahs from happening. There has to be a solution righttall-airline-16756
11/13/2025, 4:55 PMtall-airline-16756
11/13/2025, 4:56 PMqueue_size_ms) can give the audio frames more room to be handled properly, reducing the chance of capture issues.
• Consistent Timestamps: Make sure that audio frames have consistent capture timestamps to keep everything in sync.
Trying out these steps should help reduce the race condition and make your system more stable. If you’d like, I’m happy to walk you through any of these or answer any questions you have!
Sources: Resolving "InvalidState - failed to capture frame" errors in AudioSource | Debugging Audio/Video Sync Issues in LiveKit Publishing | livekit-plugins/livekit-plugins-bithuman/livekit/plugins/bithuman/avatar.py | Camera & microphone | LiveKit docs