Bug 1274083: don't return early from rate changes if we overflow r=jmspeex

MozReview-Commit-ID: DVSp3VpiIJw
This commit is contained in:
Randell Jesup 2016-05-20 01:53:27 -04:00
Родитель b3ba4f52ec
Коммит 486d30379d
2 изменённых файлов: 8 добавлений и 2 удалений

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

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "AudioBufferSourceNode.h"
#include "nsDebug.h"
#include "mozilla/dom/AudioBufferSourceNodeBinding.h"
#include "mozilla/dom/AudioParam.h"
#include "mozilla/FloatingPoint.h"
@ -181,7 +182,10 @@ public:
if (mResamplerOutRate == aOutRate) {
return;
}
speex_resampler_set_rate(mResampler, mBufferSampleRate, aOutRate);
if (speex_resampler_set_rate(mResampler, mBufferSampleRate, aOutRate) != RESAMPLER_ERR_SUCCESS) {
NS_ASSERTION(false, "speex_resampler_set_rate failed");
return;
}
}
mResamplerOutRate = aOutRate;

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

@ -1151,7 +1151,9 @@ EXPORT int speex_resampler_set_rate_frac(SpeexResamplerState *st, spx_uint32_t r
for (i=0;i<st->nb_channels;i++)
{
if (!_muldiv_safe(st->samp_frac_num[i],st->den_rate,old_den))
return RESAMPLER_ERR_OVERFLOW;
{
st->samp_frac_num[i] = st->den_rate-1;
}
st->samp_frac_num[i]= _muldiv(st->samp_frac_num[i],st->den_rate,old_den);
/* Safety net */
if (st->samp_frac_num[i] >= st->den_rate)