Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#3,771 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
88/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
swift
Lĩnh vực
desktop

Hướng nghiên cứu

Bắt đầu trong AudioProbe.swift, ở add(sampleBuffer:), và kiểm tra thứ tự gán frameLength và gọi CMSampleBufferCopyPCMDataIntoAudioBufferList. Đặt độ dài khung hình trước khi sao chép, sau đó chạy agent-device-macos-helper audio-probe khi âm thanh đang phát; hoàn tất khi các bucket báo mức cao hơn -90 dBFS.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
5k
Fork
334
Merge trung bình
12 giờ 2 phút
Pull request đã merge (30 ngày)
706

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của callstack/agent-device

Tất cả issue của callstack/agent-device

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.