Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

macOS helper audio-probe always reports -90 dBFS: AVAudioPCMBuffer frameLength set after the copy

未关闭 适合新手
#3,771 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
swift
领域
desktop

调研方向

从 AudioProbe.swift 中的 add(sampleBuffer:) 开始,检查 frameLength 赋值和调用 CMSampleBufferCopyPCMDataIntoAudioBufferList 的顺序。在复制之前设置帧长度,然后在播放声音时运行 agent-device-macos-helper audio-probe;当各个 bucket 报告的电平高于 -90 dBFS 时即为完成。

由索引模型根据 Issue 内容生成。

描述

bug ready-for-agent

What happens

agent-device-macos-helper audio-probe reports every bucket at -90 dBFS while sound is playing. Seen on macOS 26/27, agent-device 0.21.15 through 0.21.28 (latest on npm at the time of writing). The ScreenCaptureKit audio session starts and buffers arrive, but no sample is ever counted.

Cause

In AudioProbe.swift, add(sampleBuffer:) calls CMSampleBufferCopyPCMDataIntoAudioBufferList while the new AVAudioPCMBuffer still has frameLength 0, so every mDataByteSize in its mutableAudioBufferList is 0. The call returns OSStatus -12731 on every buffer, the guard returns, and nothing is added. The pcmBuffer.frameLength = frameCount line comes after the copy:

guard frameCount > 0,
  let pcmBuffer = AVAudioPCMBuffer(pcmFormat: format, frameCapacity: frameCount)
else {
  return
}
let status = CMSampleBufferCopyPCMDataIntoAudioBufferList(
  sampleBuffer,
  at: 0,
  frameCount: Int32(frameCount),
  into: pcmBuffer.mutableAudioBufferList
)
guard status == noErr else {
  return
}
pcmBuffer.frameLength = frameCount

Fix

Set pcmBuffer.frameLength = frameCount before the copy (or read the sample buffer with CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer).

Evidence

A standalone probe using the same ScreenCaptureKit stream (display filter, 48 kHz stereo) while a system sound played:

  • helper's copy order: status -12731 frames 960 byteSizesBefore [0, 0] on 155 of 155 buffers
  • reading the sample buffer directly: peak 0.48 (-6.3 dBFS) for the same audio
  • the helper at the same moment: [-90,-90,-90,-90,-90]

Happy to open a PR if wanted.

主要语言
TypeScript
星标
5k
派生
334
平均合并
12 小时 2 分钟
30 天内合并 PR
706

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

callstack/agent-device 的其他 Issue

查看 callstack/agent-device 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。