Bug 1446346 If an AudioContext hasn't been started, do not bother clamping/jittering the CurrentTime r=padenot

This will resolve several intermittments that were occuring because we would
occasionally get unlucky and have a jitter midpoint of 0, making an unstarted
AudioContext report a CurrentTime of 100us (or 1ms - whatever our clamp value
was.)

MozReview-Commit-ID: 45zXLbB93wP

--HG--
extra : rebase_source : 23ea5964dc49543c2b4ca45890c4c08456e75c73
This commit is contained in:
Tom Ritter 2018-04-11 11:34:57 -05:00
Родитель 7bd6a55b97
Коммит 1e46fe37dc
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -667,6 +667,12 @@ double
AudioContext::CurrentTime()
{
MediaStream* stream = Destination()->Stream();
if (!mIsStarted &&
stream->StreamTimeToSeconds(stream->GetCurrentTime()) == 0) {
return 0;
}
// The value of a MediaStream's CurrentTime will always advance forward; it will never
// reset (even if one rewinds a video.) Therefore we can use a single Random Seed
// initialized at the same time as the object.