Bug 1382780 - part2 : separate the value of actual playback rate and media element's attribute. r=cpearce

According to [1], we should separate the value of actual playback rate and media elemenet's attribute.
But still keep a MAX and MIN threshold to control the highest and lowser playback rate for decoder.

[1] http://w3c-test.org/html/semantics/embedded-content/media-elements/playing-the-media-resource/playbackRate.html

MozReview-Commit-ID: EGCa4yrNXO6

--HG--
extra : rebase_source : d03b831eeebb3e3e3bb0759394eab0116be0f1d5
This commit is contained in:
Alastor Wu 2017-08-24 16:58:45 +08:00
Родитель 8417fdd605
Коммит 556554c6f5
1 изменённых файлов: 6 добавлений и 2 удалений

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

@ -6723,7 +6723,11 @@ HTMLMediaElement::SetPlaybackRate(double aPlaybackRate, ErrorResult& aRv)
return;
}
mPlaybackRate = ClampPlaybackRate(aPlaybackRate);
if (mPlaybackRate == aPlaybackRate) {
return;
}
mPlaybackRate = aPlaybackRate;
if (mPlaybackRate != 0.0 &&
(mPlaybackRate > THRESHOLD_HIGH_PLAYBACKRATE_AUDIO ||
@ -6734,7 +6738,7 @@ HTMLMediaElement::SetPlaybackRate(double aPlaybackRate, ErrorResult& aRv)
}
if (mDecoder) {
mDecoder->SetPlaybackRate(mPlaybackRate);
mDecoder->SetPlaybackRate(ClampPlaybackRate(mPlaybackRate));
}
DispatchAsyncEvent(NS_LITERAL_STRING("ratechange"));
}