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; |
61 | 62 |
62 // Figure out where in the current rendering quantum that the source is | 63 // Figure out where in the current rendering quantum that the source is |
63 // active and for how many frames. | 64 // active and for how many frames. |
64 updateSchedulingInfo(framesToProcess, outputBus, quantumFrameOffset, | 65 updateSchedulingInfo(framesToProcess, outputBus, quantumFrameOffset, |
65 nonSilentFramesToProcess); | 66 nonSilentFramesToProcess, startFrameOffset); |
66 | 67 |
67 if (!nonSilentFramesToProcess) { | 68 if (!nonSilentFramesToProcess) { |
68 outputBus->zero(); | 69 outputBus->zero(); |
69 return; | 70 return; |
70 } | 71 } |
71 | 72 |
72 if (m_offset->hasSampleAccurateValues()) { | 73 if (m_offset->hasSampleAccurateValues()) { |
73 DCHECK_LE(framesToProcess, m_sampleAccurateValues.size()); | 74 DCHECK_LE(framesToProcess, m_sampleAccurateValues.size()); |
74 if (framesToProcess <= m_sampleAccurateValues.size()) { | 75 if (framesToProcess <= m_sampleAccurateValues.size()) { |
75 float* offsets = m_sampleAccurateValues.data(); | 76 float* offsets = m_sampleAccurateValues.data(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 147 |
147 ConstantSourceHandler& ConstantSourceNode::constantSourceHandler() const { | 148 ConstantSourceHandler& ConstantSourceNode::constantSourceHandler() const { |
148 return static_cast<ConstantSourceHandler&>(handler()); | 149 return static_cast<ConstantSourceHandler&>(handler()); |
149 } | 150 } |
150 | 151 |
151 AudioParam* ConstantSourceNode::offset() { | 152 AudioParam* ConstantSourceNode::offset() { |
152 return m_offset; | 153 return m_offset; |
153 } | 154 } |
154 | 155 |
155 } // namespace blink | 156 } // namespace blink |
OLD | NEW |