| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/webaudio/ConstantSourceNode.h" | 5 #include "modules/webaudio/ConstantSourceNode.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionMessages.h" | 7 #include "bindings/core/v8/ExceptionMessages.h" |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
| 10 #include "modules/webaudio/AudioNodeOutput.h" | 10 #include "modules/webaudio/AudioNodeOutput.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // The audio thread can't block on this lock, so we call tryLock() instead. | 51 // The audio thread can't block on this lock, so we call tryLock() instead. |
| 52 MutexTryLocker tryLocker(m_processLock); | 52 MutexTryLocker tryLocker(m_processLock); |
| 53 if (!tryLocker.locked()) { | 53 if (!tryLocker.locked()) { |
| 54 // Too bad - the tryLock() failed. | 54 // Too bad - the tryLock() failed. |
| 55 outputBus->zero(); | 55 outputBus->zero(); |
| 56 return; | 56 return; |
| 57 } | 57 } |
| 58 | 58 |
| 59 size_t quantumFrameOffset; | 59 size_t quantumFrameOffset; |
| 60 size_t nonSilentFramesToProcess; | 60 size_t nonSilentFramesToProcess; |
| 61 double startFrameOffset; | |
| 62 | 61 |
| 63 // Figure out where in the current rendering quantum that the source is | 62 // Figure out where in the current rendering quantum that the source is |
| 64 // active and for how many frames. | 63 // active and for how many frames. |
| 65 updateSchedulingInfo(framesToProcess, outputBus, quantumFrameOffset, | 64 updateSchedulingInfo(framesToProcess, outputBus, quantumFrameOffset, |
| 66 nonSilentFramesToProcess, startFrameOffset); | 65 nonSilentFramesToProcess); |
| 67 | 66 |
| 68 if (!nonSilentFramesToProcess) { | 67 if (!nonSilentFramesToProcess) { |
| 69 outputBus->zero(); | 68 outputBus->zero(); |
| 70 return; | 69 return; |
| 71 } | 70 } |
| 72 | 71 |
| 73 if (m_offset->hasSampleAccurateValues()) { | 72 if (m_offset->hasSampleAccurateValues()) { |
| 74 DCHECK_LE(framesToProcess, m_sampleAccurateValues.size()); | 73 DCHECK_LE(framesToProcess, m_sampleAccurateValues.size()); |
| 75 if (framesToProcess <= m_sampleAccurateValues.size()) { | 74 if (framesToProcess <= m_sampleAccurateValues.size()) { |
| 76 float* offsets = m_sampleAccurateValues.data(); | 75 float* offsets = m_sampleAccurateValues.data(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 146 |
| 148 ConstantSourceHandler& ConstantSourceNode::constantSourceHandler() const { | 147 ConstantSourceHandler& ConstantSourceNode::constantSourceHandler() const { |
| 149 return static_cast<ConstantSourceHandler&>(handler()); | 148 return static_cast<ConstantSourceHandler&>(handler()); |
| 150 } | 149 } |
| 151 | 150 |
| 152 AudioParam* ConstantSourceNode::offset() { | 151 AudioParam* ConstantSourceNode::offset() { |
| 153 return m_offset; | 152 return m_offset; |
| 154 } | 153 } |
| 155 | 154 |
| 156 } // namespace blink | 155 } // namespace blink |
| OLD | NEW |