зеркало из https://github.com/mozilla/gecko-dev.git
Bug 469628 - Playing 8-bit Wave files can block writing to the audio backend - r=doublec sr=roc
This commit is contained in:
Родитель
1b324bbec5
Коммит
6efa8eee37
|
@ -537,8 +537,9 @@ nsWaveStateMachine::Run()
|
||||||
// completely fill the audio backend's buffers with data. This
|
// completely fill the audio backend's buffers with data. This
|
||||||
// allows us plenty of time to wake up and refill the buffers
|
// allows us plenty of time to wake up and refill the buffers
|
||||||
// without an underrun occurring.
|
// without an underrun occurring.
|
||||||
|
PRUint32 sampleSize = mSampleFormat == nsAudioStream::FORMAT_U8 ? 1 : 2;
|
||||||
PRUint32 len = RoundDownToSample(NS_MIN(mStream->Available(),
|
PRUint32 len = RoundDownToSample(NS_MIN(mStream->Available(),
|
||||||
PRUint32(mAudioStream->Available() * sizeof(short))));
|
PRUint32(mAudioStream->Available() * sampleSize)));
|
||||||
if (len) {
|
if (len) {
|
||||||
nsAutoArrayPtr<char> buf(new char[len]);
|
nsAutoArrayPtr<char> buf(new char[len]);
|
||||||
PRUint32 got = 0;
|
PRUint32 got = 0;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче