| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // Since WebAudio renders in 128-frame blocks, the small buffer sizes (144 | 93 // Since WebAudio renders in 128-frame blocks, the small buffer sizes (144 |
| 94 // for a Galaxy Nexus), cause significant processing jitter. Sometimes | 94 // for a Galaxy Nexus), cause significant processing jitter. Sometimes |
| 95 // multiple blocks will processed, but other times will not be since the FIFO | 95 // multiple blocks will processed, but other times will not be since the FIFO |
| 96 // can satisfy the request. By using a larger callbackBufferSize, we smooth | 96 // can satisfy the request. By using a larger callbackBufferSize, we smooth |
| 97 // out the jitter. | 97 // out the jitter. |
| 98 const size_t kSmallBufferSize = 1024; | 98 const size_t kSmallBufferSize = 1024; |
| 99 const size_t kDefaultCallbackBufferSize = 2048; | 99 const size_t kDefaultCallbackBufferSize = 2048; |
| 100 | 100 |
| 101 if (m_callbackBufferSize <= kSmallBufferSize) | 101 if (m_callbackBufferSize <= kSmallBufferSize) |
| 102 m_callbackBufferSize = kDefaultCallbackBufferSize; | 102 m_callbackBufferSize = kDefaultCallbackBufferSize; |
| 103 |
| 104 LOG(INFO) << "audioHardwareBufferSize = " << recommendedHardwareBufferSize; |
| 105 LOG(INFO) << "callbackBufferSize = " << m_callbackBufferSize; |
| 103 #endif | 106 #endif |
| 104 | 107 |
| 105 // Quick exit if the requested size is too large. | 108 // Quick exit if the requested size is too large. |
| 106 DCHECK_LE(m_callbackBufferSize + AudioUtilities::kRenderQuantumFrames, | 109 DCHECK_LE(m_callbackBufferSize + AudioUtilities::kRenderQuantumFrames, |
| 107 fifoSize); | 110 fifoSize); |
| 108 if (m_callbackBufferSize + AudioUtilities::kRenderQuantumFrames > fifoSize) | 111 if (m_callbackBufferSize + AudioUtilities::kRenderQuantumFrames > fifoSize) |
| 109 return; | 112 return; |
| 110 | 113 |
| 111 m_audioDevice = WTF::wrapUnique(Platform::current()->createAudioDevice( | 114 m_audioDevice = WTF::wrapUnique(Platform::current()->createAudioDevice( |
| 112 m_callbackBufferSize, numberOfInputChannels, numberOfOutputChannels, | 115 m_callbackBufferSize, numberOfInputChannels, numberOfOutputChannels, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 AudioBus* sourceBus = nullptr; | 203 AudioBus* sourceBus = nullptr; |
| 201 if (m_inputFifo->framesInFifo() >= framesToProcess) { | 204 if (m_inputFifo->framesInFifo() >= framesToProcess) { |
| 202 m_inputFifo->consume(m_inputBus.get(), framesToProcess); | 205 m_inputFifo->consume(m_inputBus.get(), framesToProcess); |
| 203 sourceBus = m_inputBus.get(); | 206 sourceBus = m_inputBus.get(); |
| 204 } | 207 } |
| 205 | 208 |
| 206 m_callback.render(sourceBus, bus, framesToProcess); | 209 m_callback.render(sourceBus, bus, framesToProcess); |
| 207 } | 210 } |
| 208 | 211 |
| 209 } // namespace blink | 212 } // namespace blink |
| OLD | NEW |