Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`_ParticipantAudioInputStream` 补静音帧时`data` 长度未乘声道数,多声道配置下抛`ValueError`

Closed Beginner friendly
#7,967 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

A pull request for this has already been merged.

  • #7968 by @Hugo-DDT — merged
  • #7975 by @its-amann — closed without merging

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Read livekit/agents/voice/room_io/_input.py, especially lines 390–399 in _ParticipantAudioInputStream._forward_task, and check how the silence frame size is calculated against num_channels. Confirm the expected byte length is num_channels × samples_per_channel × 2; done when the frame can be created without ValueError for multichannel input.

Written by the indexing model from the issue text.

Description

bug
Bug Description
  • File :livekit/agents/voice/room_io/_input.py
  • Lines : 390–399(_ParticipantAudioInputStream._forward_task 方法尾部)
  • Package : livekit-agents(Python SDK)
Root Cause

当远端音频 track 断流、super()._forward_task() 主循环退出后,子类会补一帧 0.5 秒静音(让下游 VAD/STT 能正确检测到停顿)。这帧的字节数据手工构造时 只按"每样本 2 字节"计算,却漏乘了num_channels :

Expected Behavior
  • Expected : 无论num_channels 为多少,AudioFrame 的data 长度都应为num_channels × samples_per_channel × 2
  • Actual : data 长度始终为samples_per_channel × 2 ,多声道下触发构造函数校验失败
Reproduction Steps
- 配置`AgentSession` 的`RoomIO` 输入音频为多声道(`num_channels=2` 或更高)——比如`RoomInputOptions(num_channels=2)` 或自定义`VoicePipeline` 里`input_audio_options.num_channels = 2`
- 正常跑通一次对话,让远端 participant 断开 / unmute 停止发布音频
- 触发`_on_track_unsubscribed` →`_close_stream` → 新建 stream 并重启`_forward_task` (或 participant 直接断连,主循环自然结束)
- 立刻抛出`ValueError: data length must be >= num_channels * samples_per_channel * sizeof(int16)`
Operating System

Windows11

Models Used

No response

Package Versions
livekit-agents=1.8.0
Session/Room/Call IDs

No response

Proposed Solution

Additional Context

No response

Screenshots and Recordings

No response

Dominant language
Python
Stars
14.6k
Forks
3.9k
Avg merge
3d 20h
Merged PRs (30d)
193

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from livekit/agents

All issues in livekit/agents

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.