Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This CL adds a new way to measure (estimate) end-to-end audio latency. It adds the AmplitudePeakDetector class, which listens for jumps in audio signal amplitude; when it detects a peak, it runs a callback, which we use to start or stop trace events. We use one AmplitudePeakDetector right after microphone input and one right before speaker output. By having the trace start after detecting a peak from the microphone, and stop before playing out the peak, we can measure how long it took for the signal to propagate. To actually measure latency using this technique, one should start a trace recording the `audio.latency` category. Then, one should open a test page which sets up an input via getUserMedia() and plays out that audio via any method (e.g. using WebAudio's MediaStreamAudioSourceNode or an audio element's srcObject). Then, one should clap in front of the microphone to produce audio peaks, or use any other method to generate clear, alternating loud and quiet audio input. Notes: - This method does not currently support having multiple inputs or multiple outputs. The test page should have exactly one input and output, and should be the only tab running in the browser at that time. - The peak detection threshold is roughly -6dbFS. One could adjust the microphone's gain if the peaks are never detected, or trigger too easily. Change-Id: I3a11069dc8f4843da09e625237d2f8a003428514 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4317311 Reviewed-by: Olga Sharonova <olka@chromium.org> Commit-Queue: Thomas Guilbert <tguilbert@chromium.org> Reviewed-by: Siddhartha S <ssid@chromium.org> Reviewed-by: Dale Curtis <dalecurtis@chromium.org> Cr-Commit-Position: refs/heads/main@{#1117871}
- Loading branch information
1 parent
241af0c
commit d7a274b
Showing
15 changed files
with
452 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.