Skip to content

Commit caf5e16

Browse files
authored
Update audioStartTime and audioEndTime to be relative to start of audio 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.
1 parent 7cc1f35 commit caf5e16

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

explainers/speech-recognition-result-timestamps.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ We propose extending the `SpeechRecognitionResult` interface to include optional
1717

1818
```webidl
1919
partial interface SpeechRecognitionResult {
20-
// Start timestamp of the audio segment in milliseconds (relative to time origin)
20+
// Start timestamp of the audio segment in milliseconds (relative to the start of the audio stream)
2121
readonly attribute DOMHighResTimeStamp? audioStartTime;
2222
23-
// End timestamp of the audio segment in milliseconds (relative to time origin)
23+
// End timestamp of the audio segment in milliseconds (relative to the start of the audio stream)
2424
readonly attribute DOMHighResTimeStamp? audioEndTime;
2525
};
2626
```

0 commit comments

Comments
 (0)