| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 float AudioDestination::hardwareSampleRate() | 141 float AudioDestination::hardwareSampleRate() |
| 142 { | 142 { |
| 143 return static_cast<float>(Platform::current()->audioHardwareSampleRate()); | 143 return static_cast<float>(Platform::current()->audioHardwareSampleRate()); |
| 144 } | 144 } |
| 145 | 145 |
| 146 unsigned long AudioDestination::maxChannelCount() | 146 unsigned long AudioDestination::maxChannelCount() |
| 147 { | 147 { |
| 148 return static_cast<float>(Platform::current()->audioHardwareOutputChannels()
); | 148 return static_cast<float>(Platform::current()->audioHardwareOutputChannels()
); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void AudioDestination::render(const WebVector<float*>& sourceData, const WebVect
or<float*>& audioData, size_t numberOfFrames) | 151 void AudioDestination::render(const WebVector<float*>& sourceData, const WebVect
or<float*>& audioData, size_t numberOfFrames, const WebAudioTimestamp& timestamp
) |
| 152 { | 152 { |
| 153 m_outputTimestamp = timestamp; |
| 153 bool isNumberOfChannelsGood = audioData.size() == m_numberOfOutputChannels; | 154 bool isNumberOfChannelsGood = audioData.size() == m_numberOfOutputChannels; |
| 154 if (!isNumberOfChannelsGood) { | 155 if (!isNumberOfChannelsGood) { |
| 155 ASSERT_NOT_REACHED(); | 156 ASSERT_NOT_REACHED(); |
| 156 return; | 157 return; |
| 157 } | 158 } |
| 158 | 159 |
| 159 bool isBufferSizeGood = numberOfFrames == m_callbackBufferSize; | 160 bool isBufferSizeGood = numberOfFrames == m_callbackBufferSize; |
| 160 if (!isBufferSizeGood) { | 161 if (!isBufferSizeGood) { |
| 161 ASSERT_NOT_REACHED(); | 162 ASSERT_NOT_REACHED(); |
| 162 return; | 163 return; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 178 } | 179 } |
| 179 | 180 |
| 180 void AudioDestination::provideInput(AudioBus* bus, size_t framesToProcess) | 181 void AudioDestination::provideInput(AudioBus* bus, size_t framesToProcess) |
| 181 { | 182 { |
| 182 AudioBus* sourceBus = nullptr; | 183 AudioBus* sourceBus = nullptr; |
| 183 if (m_inputFifo->framesInFifo() >= framesToProcess) { | 184 if (m_inputFifo->framesInFifo() >= framesToProcess) { |
| 184 m_inputFifo->consume(m_inputBus.get(), framesToProcess); | 185 m_inputFifo->consume(m_inputBus.get(), framesToProcess); |
| 185 sourceBus = m_inputBus.get(); | 186 sourceBus = m_inputBus.get(); |
| 186 } | 187 } |
| 187 | 188 |
| 188 m_callback.render(sourceBus, bus, framesToProcess); | 189 m_callback.render(sourceBus, bus, framesToProcess, m_outputTimestamp); |
| 189 } | 190 } |
| 190 | 191 |
| 191 } // namespace blink | 192 } // namespace blink |
| 192 | 193 |
| OLD | NEW |