bug 1207003 fetch stream position once instead of three times r=padenot

--HG--
extra : rebase_source : b76cf41cf5eedae7f1b131703e14303e4f642560
This commit is contained in:
Karl Tomlinson 2015-09-18 14:27:03 +12:00
Родитель 49d09f7fa2
Коммит 5dc1c2c5d6
1 изменённых файлов: 4 добавлений и 4 удалений

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

@ -434,7 +434,7 @@ public:
return rate ? rate : mBufferSampleRate;
}
void UpdateSampleRateIfNeeded(uint32_t aChannels)
void UpdateSampleRateIfNeeded(uint32_t aChannels, StreamTime aStreamPosition)
{
float playbackRate;
float detune;
@ -442,12 +442,12 @@ public:
if (mPlaybackRateTimeline.HasSimpleValue()) {
playbackRate = mPlaybackRateTimeline.GetValue();
} else {
playbackRate = mPlaybackRateTimeline.GetValueAtTime(mSource->GetCurrentPosition());
playbackRate = mPlaybackRateTimeline.GetValueAtTime(aStreamPosition);
}
if (mDetuneTimeline.HasSimpleValue()) {
detune = mDetuneTimeline.GetValue();
} else {
detune = mDetuneTimeline.GetValueAtTime(mSource->GetCurrentPosition());
detune = mDetuneTimeline.GetValueAtTime(aStreamPosition);
}
if (playbackRate <= 0 || mozilla::IsNaN(playbackRate)) {
playbackRate = 1.0f;
@ -482,7 +482,7 @@ public:
uint32_t channels = mBuffer ? mBuffer->GetChannels() : 0;
UpdateSampleRateIfNeeded(channels);
UpdateSampleRateIfNeeded(channels, streamPosition);
uint32_t written = 0;
while (written < WEBAUDIO_BLOCK_SIZE) {