Closed Bug 639587 Opened 9 years ago Closed 7 years ago

nsAudioStream U8 sound format conversion incorrect

Categories

(Core :: Audio/Video, defect)

defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: cajbir, Unassigned)

References

Details

Found while working on bug 635649. The code to covert from U8 sound samples to S16 format is incorrect. Existing code is:

s_data[i + offset] = short(((PRInt32(buf[i]) - 128) * volume) >> 8);

For a U8 value of 255 this gives a result of 32512. It should give 32767.

Matthew Gregan suggested fixing it as part of the audio backend refactoring.
Depends on: cubeb
FORMAT_U8 conversion was removed from nsAudioStream in bug 775319.
Status: NEW → RESOLVED
Closed: 7 years ago
Depends on: 775319
No longer depends on: cubeb
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.