diff options
author | rtoy@google.com <rtoy@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 01:34:50 +0000 |
---|---|---|
committer | rtoy@google.com <rtoy@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 01:34:50 +0000 |
commit | ab358b4a63f4f3e9deb079be9718b12012cbbbb6 (patch) | |
tree | 0513e0b363a1d593d86807819fea8fa363c68e46 /media | |
parent | 0e025786c8207bd39064890a0c97023256f3171d (diff) | |
download | chromium_src-ab358b4a63f4f3e9deb079be9718b12012cbbbb6.zip chromium_src-ab358b4a63f4f3e9deb079be9718b12012cbbbb6.tar.gz chromium_src-ab358b4a63f4f3e9deb079be9718b12012cbbbb6.tar.bz2 |
Fix playing of 8-bit sample files via webaudio.
The bias for 8-bit samples was incorrectly applied.
To hear the bug, go to the url: http://www.corp.google.com/~rtoy/audio/latency.html
Press space. This should play 2 sec of an 8-bit wave file. You will hear just a click instead of a man (on one channel) and a woman (on the other channel) speaking different sentences.
Review URL: http://codereview.chromium.org/8276006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105993 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/audio/audio_util.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/media/audio/audio_util.cc b/media/audio/audio_util.cc index 120e2ed..ed29749f 100644 --- a/media/audio/audio_util.cc +++ b/media/audio/audio_util.cc @@ -177,7 +177,7 @@ bool DeinterleaveAudioChannel(void* source, uint8* source8 = static_cast<uint8*>(source) + channel_index; const float kScale = 1.0f / 128.0f; for (unsigned i = 0; i < number_of_frames; ++i) { - destination[i] = kScale * static_cast<int>(*source8 + 128); + destination[i] = kScale * (static_cast<int>(*source8) - 128); source8 += channels; } return true; |