Skip to content

Spec does not describe precisely AudioSinkType none #2707

Open

Description

@youennf

AudioSinkType none is currently defined as:
The audio graph will be processed without being played through an audio output device.

The following excerpt suggests that an AudioContext requires a system-level audio callback (is this an audio output device?):
The AudioContext rendering thread is driven by a system-level audio callback, that is periodically called at regular intevals.

Both definitions of underrun also seem to assume an output device:

  • audio buffer underrun is defined from the load value of a system-level audio callback.
  • an underrun frame is an audio frame played by the output device that was not provided by the AudioContext. AudioPlaybackStats is built on this definition.

With a none sink, there is no system-level audio callback, so it is unclear what drives rendering.

This matters when the context generates data for an audio MediaStreamTrack through a MediaStreamAudioDestinationNode. That track can be consumed by an RTCPeerConnection, a MediaRecorder, a media element, or another AudioContext through a MediaStreamAudioSourceNode. Each consumer expects audio paced in real time, so what the context produces needs to be well defined.

It would be good to clarify:

  1. What the clock source of a none context is. Is it real-time paced at sampleRate?
  2. What happens when rendering is late, e.g. when an AudioWorklet takes longer than its real-time budget for a render quantum:
    • Are the missed render quanta rendered later to catch up, so no samples are lost but the output arrives late and in a burst?
    • Or are they dropped, so the output has gaps?
    • How should the audio delivered to the MediaStreamTrack be timed in either case?
  3. What playbackStats reports for a none context.

We should also write WPT tests once we understand what the expected behavior is (something like RTCPeerConnection/MediaRecorder/AudioContext processing data from a none AudioWorklet).
https://w3c.github.io/mediacapture-extensions/#dom-mediastreamtrackaudiostats is probably also testable on its own. I had a quick look in https://github.com/web-platform-tests/wpt/tree/master/webaudio but did not find much.

FWIW, this issue is also describing the questions I had w.r.t. the AudioTrackGenerator API that Chrome already shipped. If we answer them for none sink ID, this would probably answer them for AudioTrackGenerator as well.
CC @guidou, @jan-ivar.

Activity

  1. added
    Needs DiscussionThe issue needs more discussion before it can be fixed.
    category: enhancementSubstantive changes that do not add new features. https://www.w3.org/policies/process/#class-3
    on Nov 2, 2026
  2. padenot commented on Nov 3, 2026

    @padenot
    Member
    1. What the clock source of a none context is. Is it real-time paced at sampleRate?

    Real-time, otherwise you cannot implement the spec, but not "paced at sampleRate". It's paced however you want, as long as you can make it work, e.g. it will be driven by a system clock. This will drift against audio clocks and it needs to work without glitching/dropping audio, the same way two AudioContext from different devices don't share a clock but need to work well together.

    • What happens when rendering is late, e.g. when an AudioWorklet takes longer than its real-time budget for a render quantum:
      • Are the missed render quanta rendered later to catch up, so no samples are lost but the output arrives late and in a burst?
      • Or are they dropped, so the output has gaps?
      • How should the audio delivered to the MediaStreamTrack be timed in either case?

    The first point, like it does today for real-time AudioContext attached to an audio device, it catches up or shifts phase. This is how audio software usually work, we don't skip an iteration, as it would break a lot of things. If dropping/resampling any correction need to happen, it happens at boundaries, as it does today, and implementation can compete on what the best way to do this is, we know not all of them do it the same way, e.g. between an AudioContext and the MediaStreamTrack coming from gUM microphone. MediaStreamTrack under-running when the consumer is real-time is opaque (as MediaStreamTrack should be).

    • What playbackStats reports for a none context.

    Precisely the same no? You have the same block duration, render duration, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs DiscussionThe issue needs more discussion before it can be fixed.category: enhancementSubstantive changes that do not add new features. https://www.w3.org/policies/process/#class-3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址