Update audioStartTime and audioEndTime to be relative to start of aud… - #203
Open
alan33d wants to merge 4 commits into
Open
Update audioStartTime and audioEndTime to be relative to start of aud…#203alan33d wants to merge 4 commits into
alan33d wants to merge 4 commits into
Conversation
…io stream We want to switch to stream-Relative (0-based) impl. since: - In Web Audio and Media APIs (HTMLMediaElement.currentTime, AudioContext.currentTime, WebCodecs VideoFrame.timestamp), media timelines are always 0-based offsets relative to stream start, not the time origin. - Immune to inter-process jitter since SODA and audio capture run in a separate utility/browser process. Translating stream offsets to the renderer's timeOrigin relies on estimating when IPC AudioStarted() arrived, which introduces IPC latency jitter. Stream-relative offsets are not prune to this and aligns with the raw audio frames. - If SpeechRecognition is used with a pre-recorded MediaStreamTrack, a 0-based stream offset reflects the actual position in the audio track regardless of when the webpage was loaded. - Being relative to performance.timeOrigin doesn't make sense in general for the Web Speech API because it assumes that the audio source is live. Since a SpeechRecognizer can also be created for a prerecorded media stream I think the timestamps on the speech recognition events should be relative to the position in that media stream. See https://crbug.com/542330168 for more details.
Added a section on converting stream timestamps to document time origin and provided a live translation latency example with code.
reillyeon
approved these changes
Aug 12, 2026
Added separator before security section and closed example section for live transcription measurements.
michaelwasserman
left a comment
There was a problem hiding this comment.
Drive by review: lgtm with a nit, fwiw. I implemented the suggested timestamp offsetting in my demo, and it seems to work well. https://michaelwasserman.github.io/web-speech-demos/speech_latency.html
alan33d
marked this pull request as ready for review
August 13, 2026 00:19
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We want to switch to stream-Relative (0-based) impl. since:
See https://crbug.com/542330168 for more details.