зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1614019 - Removed negative value from the valid range r=padenot,webidl,smaug
The condition in the if is changed because the minus operation could overflow. The declaration of sampleRate has been moved to its next use because its first value was never used. Differential Revision: https://phabricator.services.mozilla.com/D81550
This commit is contained in:
Родитель
7b8b40e29b
Коммит
23717c88b4
|
@ -261,17 +261,18 @@ already_AddRefed<AudioContext> AudioContext::Constructor(
|
|||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
float sampleRate = MediaTrackGraph::REQUEST_DEFAULT_SAMPLE_RATE;
|
||||
if (aOptions.mSampleRate > 0 &&
|
||||
(aOptions.mSampleRate - WebAudioUtils::MinSampleRate < 0.0 ||
|
||||
WebAudioUtils::MaxSampleRate - aOptions.mSampleRate < 0.0)) {
|
||||
if (aOptions.mSampleRate.WasPassed() &&
|
||||
(aOptions.mSampleRate.Value() < WebAudioUtils::MinSampleRate ||
|
||||
aOptions.mSampleRate.Value() > WebAudioUtils::MaxSampleRate)) {
|
||||
aRv.ThrowNotSupportedError(nsPrintfCString(
|
||||
"Sample rate %g is not in the range [%u, %u]", aOptions.mSampleRate,
|
||||
WebAudioUtils::MinSampleRate, WebAudioUtils::MaxSampleRate));
|
||||
"Sample rate %g is not in the range [%u, %u]",
|
||||
aOptions.mSampleRate.Value(), WebAudioUtils::MinSampleRate,
|
||||
WebAudioUtils::MaxSampleRate));
|
||||
return nullptr;
|
||||
}
|
||||
sampleRate = aOptions.mSampleRate;
|
||||
float sampleRate = aOptions.mSampleRate.WasPassed()
|
||||
? aOptions.mSampleRate.Value()
|
||||
: MediaTrackGraph::REQUEST_DEFAULT_SAMPLE_RATE;
|
||||
|
||||
RefPtr<AudioContext> object =
|
||||
new AudioContext(window, false, 2, 0, sampleRate);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
dictionary AudioContextOptions {
|
||||
float sampleRate = 0;
|
||||
float sampleRate;
|
||||
};
|
||||
|
||||
dictionary AudioTimestamp {
|
||||
|
|
Загрузка…
Ссылка в новой задаче