Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#3,771 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
swift
領域
desktop

調査の方向性

AudioProbe.swift の add(sampleBuffer:) から始め、frameLength の代入と CMSampleBufferCopyPCMDataIntoAudioBufferList の呼び出しの順序を確認してください。コピーの前にフレーム長を設定し、音声を再生しながら agent-device-macos-helper audio-probe を実行します。バケットが -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分
マージ済み PR(30日)
706

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

callstack/agent-device のほかの issue

callstack/agent-device の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。