Last Comment Bug 639587 - nsAudioStream U8 sound format conversion incorrect
: nsAudioStream U8 sound format conversion incorrect
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Audio/Video (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on: 775319
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-07 12:52 PST by cajbir (:cajbir)
Modified: 2012-08-22 22:37 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description cajbir (:cajbir) 2011-03-07 12:52:18 PST
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.
Comment 1 Matthew Gregan [:kinetik] 2012-08-22 22:37:34 PDT
FORMAT_U8 conversion was removed from nsAudioStream in bug 775319.

Note You need to log in before you can comment on or make changes to this bug.