| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 AudioDestination::AudioDestination(AudioIOCallback& callback, const String& inpu
tDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, floa
t sampleRate, const PassRefPtr<SecurityOrigin>& securityOrigin) | 51 AudioDestination::AudioDestination(AudioIOCallback& callback, const String& inpu
tDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, floa
t sampleRate, const PassRefPtr<SecurityOrigin>& securityOrigin) |
| 52 : m_callback(callback) | 52 : m_callback(callback) |
| 53 , m_numberOfOutputChannels(numberOfOutputChannels) | 53 , m_numberOfOutputChannels(numberOfOutputChannels) |
| 54 , m_inputBus(AudioBus::create(numberOfInputChannels, renderBufferSize)) | 54 , m_inputBus(AudioBus::create(numberOfInputChannels, renderBufferSize)) |
| 55 , m_renderBus(AudioBus::create(numberOfOutputChannels, renderBufferSize, fal
se)) | 55 , m_renderBus(AudioBus::create(numberOfOutputChannels, renderBufferSize, fal
se)) |
| 56 , m_sampleRate(sampleRate) | 56 , m_sampleRate(sampleRate) |
| 57 , m_isPlaying(false) | 57 , m_isPlaying(false) |
| 58 { | 58 { |
| 59 // Histogram for audioHardwareBufferSize | 59 // Histogram for audioHardwareBufferSize |
| 60 DEFINE_STATIC_LOCAL(SparseHistogram, hardwareBufferSizeHistogram, | 60 DEFINE_STATIC_LOCAL(SparseHistogram, hardwareBufferSizeHistogram, |
| 61 ("WebAudio.AudioDestination.HardwareBuffersize")); | 61 ("WebAudio.AudioDestination.HardwareBufferSize")); |
| 62 // Histogram for the actual callback size used. Typically, this is the same
as | 62 // Histogram for the actual callback size used. Typically, this is the same
as |
| 63 // audioHardwareBufferSize, but can be adjusted depending on some heuristics
below. | 63 // audioHardwareBufferSize, but can be adjusted depending on some heuristics
below. |
| 64 DEFINE_STATIC_LOCAL(SparseHistogram, callbackBufferSizeHistogram, | 64 DEFINE_STATIC_LOCAL(SparseHistogram, callbackBufferSizeHistogram, |
| 65 ("WebAudio.AudioDestination.CallbackBufferSize")); | 65 ("WebAudio.AudioDestination.CallbackBufferSize")); |
| 66 | 66 |
| 67 // Use the optimal buffer size recommended by the audio backend. | 67 // Use the optimal buffer size recommended by the audio backend. |
| 68 size_t recommendedHardwareBufferSize = Platform::current()->audioHardwareBuf
ferSize(); | 68 size_t recommendedHardwareBufferSize = Platform::current()->audioHardwareBuf
ferSize(); |
| 69 m_callbackBufferSize = recommendedHardwareBufferSize; | 69 m_callbackBufferSize = recommendedHardwareBufferSize; |
| 70 | 70 |
| 71 #if OS(ANDROID) | 71 #if OS(ANDROID) |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 if (m_inputFifo->framesInFifo() >= framesToProcess) { | 181 if (m_inputFifo->framesInFifo() >= framesToProcess) { |
| 182 m_inputFifo->consume(m_inputBus.get(), framesToProcess); | 182 m_inputFifo->consume(m_inputBus.get(), framesToProcess); |
| 183 sourceBus = m_inputBus.get(); | 183 sourceBus = m_inputBus.get(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 m_callback.render(sourceBus, bus, framesToProcess); | 186 m_callback.render(sourceBus, bus, framesToProcess); |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace blink | 189 } // namespace blink |
| 190 | 190 |
| OLD | NEW |