зеркало из https://github.com/mozilla/gecko-dev.git
bug 1206362
be careful about double -> int conversion r=padenot
--HG-- extra : rebase_source : 66fd40ddd3794ac225c581bbae56445d92362e12
This commit is contained in:
Родитель
d5c41b3131
Коммит
644913284f
|
@ -715,8 +715,14 @@ AudioBufferSourceNode::SendOffsetAndDurationParametersToStream(AudioNodeStream*
|
|||
}
|
||||
|
||||
if (mDuration != std::numeric_limits<double>::min()) {
|
||||
bufferEnd = std::min(bufferEnd,
|
||||
offsetSamples + NS_lround(mDuration * rate));
|
||||
MOZ_ASSERT(mDuration >= 0.0); // provided by Start()
|
||||
MOZ_ASSERT(rate >= 0.0f); // provided by AudioBuffer::Create()
|
||||
static_assert(std::numeric_limits<double>::digits >=
|
||||
std::numeric_limits<decltype(bufferEnd)>::digits,
|
||||
"bufferEnd should be represented exactly by double");
|
||||
// + 0.5 rounds mDuration to nearest sample when assigned to bufferEnd.
|
||||
bufferEnd = std::min<double>(bufferEnd,
|
||||
offsetSamples + mDuration * rate + 0.5);
|
||||
}
|
||||
aStream->SetInt32Parameter(BUFFEREND, bufferEnd);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче