| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 // Create a FIFO to handle the possibility of the callback size | 120 // Create a FIFO to handle the possibility of the callback size |
| 121 // not being a multiple of the render size. If the FIFO already | 121 // not being a multiple of the render size. If the FIFO already |
| 122 // contains enough data, the data will be provided directly. | 122 // contains enough data, the data will be provided directly. |
| 123 // Otherwise, the FIFO will call the provider enough times to | 123 // Otherwise, the FIFO will call the provider enough times to |
| 124 // satisfy the request for data. | 124 // satisfy the request for data. |
| 125 m_fifo = wrapUnique(new AudioPullFIFO(*this, numberOfOutputChannels, fifoSize, | 125 m_fifo = wrapUnique(new AudioPullFIFO(*this, numberOfOutputChannels, fifoSize, |
| 126 AudioUtilities::kRenderQuantumFrames)); | 126 AudioUtilities::kRenderQuantumFrames)); |
| 127 | 127 |
| 128 // Input buffering. | 128 // Input buffering. |
| 129 m_inputFifo = wrapUnique(new AudioFIFO(numberOfInputChannels, fifoSize)); | 129 m_inputFifo = makeUnique<AudioFIFO>(numberOfInputChannels, fifoSize); |
| 130 | 130 |
| 131 // If the callback size does not match the render size, then we need to | 131 // If the callback size does not match the render size, then we need to |
| 132 // buffer some extra silence for the input. Otherwise, we can over-consume | 132 // buffer some extra silence for the input. Otherwise, we can over-consume |
| 133 // the input FIFO. | 133 // the input FIFO. |
| 134 if (m_callbackBufferSize != AudioUtilities::kRenderQuantumFrames) { | 134 if (m_callbackBufferSize != AudioUtilities::kRenderQuantumFrames) { |
| 135 // FIXME: handle multi-channel input and don't hard-code to stereo. | 135 // FIXME: handle multi-channel input and don't hard-code to stereo. |
| 136 RefPtr<AudioBus> silence = | 136 RefPtr<AudioBus> silence = |
| 137 AudioBus::create(2, AudioUtilities::kRenderQuantumFrames); | 137 AudioBus::create(2, AudioUtilities::kRenderQuantumFrames); |
| 138 m_inputFifo->push(silence.get()); | 138 m_inputFifo->push(silence.get()); |
| 139 } | 139 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 AudioBus* sourceBus = nullptr; | 199 AudioBus* sourceBus = nullptr; |
| 200 if (m_inputFifo->framesInFifo() >= framesToProcess) { | 200 if (m_inputFifo->framesInFifo() >= framesToProcess) { |
| 201 m_inputFifo->consume(m_inputBus.get(), framesToProcess); | 201 m_inputFifo->consume(m_inputBus.get(), framesToProcess); |
| 202 sourceBus = m_inputBus.get(); | 202 sourceBus = m_inputBus.get(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 m_callback.render(sourceBus, bus, framesToProcess); | 205 m_callback.render(sourceBus, bus, framesToProcess); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace blink | 208 } // namespace blink |
| OLD | NEW |