Back to Chromium

Audio latency tracing page

third_party/blink/manual_tests/audio_latency.html

149.0.7827.21.6 KB
Original Source

This page is meant to serve as an example of how to use "audio.latency" tracing to measure internal audio latency. The "audio.latency" category enables code which listens for jumps in amplitude (volume) and starts or stops tracing. We start tracing right after receiving loud audio from a microphone, and stop right before sending that loud audio to speakers. The duration of the trace event (which should show up as an "AmplitudePeak" in the tracing tools) encompases the total internal latency.

Instructions:

  • [Prerequisite] Close all other tabs but this one.
  • [Prerequisite] Make sure there is a microphone plugged into the test machine, and that the surrounding environment is not too loud.
  • Open chrome://tracing and start recording a trace which includes the "audio.latency" category.
  • Click the "Initialize" button.
  • Select either the WebAudio or the HTMLAudioElement button.
  • Repeatedly clap next to the microphone a few times. Make sure to clap clearly, and to leave time between claps (0.5s-1s should be enough).
  • Stop the trace. "AmplitudePeak" events should show up under the audio service process

Note: The "audio.latency" category only expects one input and one output. Multiple IOs will result in incoherent traces. Additionally, tracing *must* be started before starting the test, or no traces will be captured. Refreshing the page after starting a trace is also not enough: one must verify that there are no InputStreams or OutputStreams alive, by navigating to the "audio" tab of chrome://media-internals. Closing all tabs and waiting 2-10s should be enough for all outstanding streams to close.

Initialize

Use WebAudioUse HTMLAudioElement