| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "bindings/v8/ExceptionState.h" | 35 #include "bindings/v8/ExceptionState.h" |
| 36 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
| 37 #include "platform/audio/AudioBus.h" | 37 #include "platform/audio/AudioBus.h" |
| 38 #include "platform/audio/AudioFileReader.h" | 38 #include "platform/audio/AudioFileReader.h" |
| 39 #include "modules/webaudio/AudioContext.h" | 39 #include "modules/webaudio/AudioContext.h" |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 float AudioBuffer::minAllowedSampleRate() | 43 float AudioBuffer::minAllowedSampleRate() |
| 44 { | 44 { |
| 45 return 22050; | 45 // crbug.com/344375 |
| 46 return 3000; |
| 46 } | 47 } |
| 47 | 48 |
| 48 float AudioBuffer::maxAllowedSampleRate() | 49 float AudioBuffer::maxAllowedSampleRate() |
| 49 { | 50 { |
| 50 return 96000; | 51 // Windows can support up to this rate. |
| 52 return 192000; |
| 51 } | 53 } |
| 52 | 54 |
| 53 PassRefPtr<AudioBuffer> AudioBuffer::create(unsigned numberOfChannels, size_t nu
mberOfFrames, float sampleRate) | 55 PassRefPtr<AudioBuffer> AudioBuffer::create(unsigned numberOfChannels, size_t nu
mberOfFrames, float sampleRate) |
| 54 { | 56 { |
| 55 if (sampleRate < minAllowedSampleRate() || sampleRate > maxAllowedSampleRate
() || numberOfChannels > AudioContext::maxNumberOfChannels() || !numberOfFrames) | 57 if (sampleRate < minAllowedSampleRate() || sampleRate > maxAllowedSampleRate
() || numberOfChannels > AudioContext::maxNumberOfChannels() || !numberOfFrames) |
| 56 return nullptr; | 58 return nullptr; |
| 57 | 59 |
| 58 RefPtr<AudioBuffer> buffer = adoptRef(new AudioBuffer(numberOfChannels, numb
erOfFrames, sampleRate)); | 60 RefPtr<AudioBuffer> buffer = adoptRef(new AudioBuffer(numberOfChannels, numb
erOfFrames, sampleRate)); |
| 59 | 61 |
| 60 if (!buffer->createdSuccessfully(numberOfChannels)) | 62 if (!buffer->createdSuccessfully(numberOfChannels)) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 { | 147 { |
| 146 for (unsigned i = 0; i < m_channels.size(); ++i) { | 148 for (unsigned i = 0; i < m_channels.size(); ++i) { |
| 147 if (getChannelData(i)) | 149 if (getChannelData(i)) |
| 148 getChannelData(i)->zeroRange(0, length()); | 150 getChannelData(i)->zeroRange(0, length()); |
| 149 } | 151 } |
| 150 } | 152 } |
| 151 | 153 |
| 152 } // namespace WebCore | 154 } // namespace WebCore |
| 153 | 155 |
| 154 #endif // ENABLE(WEB_AUDIO) | 156 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |