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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 { | 48 { |
49 // Safe to call the uninitialize() because it's final. | 49 // Safe to call the uninitialize() because it's final. |
50 uninitialize(); | 50 uninitialize(); |
51 } | 51 } |
52 | 52 |
53 void AudioBasicProcessorHandler::initialize() | 53 void AudioBasicProcessorHandler::initialize() |
54 { | 54 { |
55 if (isInitialized()) | 55 if (isInitialized()) |
56 return; | 56 return; |
57 | 57 |
58 ASSERT(processor()); | 58 DCHECK(processor()); |
59 processor()->initialize(); | 59 processor()->initialize(); |
60 | 60 |
61 AudioHandler::initialize(); | 61 AudioHandler::initialize(); |
62 } | 62 } |
63 | 63 |
64 void AudioBasicProcessorHandler::uninitialize() | 64 void AudioBasicProcessorHandler::uninitialize() |
65 { | 65 { |
66 if (!isInitialized()) | 66 if (!isInitialized()) |
67 return; | 67 return; |
68 | 68 |
69 ASSERT(processor()); | 69 DCHECK(processor()); |
70 processor()->uninitialize(); | 70 processor()->uninitialize(); |
71 | 71 |
72 AudioHandler::uninitialize(); | 72 AudioHandler::uninitialize(); |
73 } | 73 } |
74 | 74 |
75 void AudioBasicProcessorHandler::process(size_t framesToProcess) | 75 void AudioBasicProcessorHandler::process(size_t framesToProcess) |
76 { | 76 { |
77 AudioBus* destinationBus = output(0).bus(); | 77 AudioBus* destinationBus = output(0).bus(); |
78 | 78 |
79 if (!isInitialized() || !processor() || processor()->numberOfChannels() != n
umberOfChannels()) { | 79 if (!isInitialized() || !processor() || processor()->numberOfChannels() != n
umberOfChannels()) { |
(...skipping 14 matching lines...) Expand all Loading... |
94 { | 94 { |
95 // Render input stream - suggest to the input to render directly into output
bus for in-place processing in process() if possible. | 95 // Render input stream - suggest to the input to render directly into output
bus for in-place processing in process() if possible. |
96 input(0).pull(output(0).bus(), framesToProcess); | 96 input(0).pull(output(0).bus(), framesToProcess); |
97 } | 97 } |
98 | 98 |
99 // As soon as we know the channel count of our input, we can lazily initialize. | 99 // As soon as we know the channel count of our input, we can lazily initialize. |
100 // Sometimes this may be called more than once with different channel counts, in
which case we must safely | 100 // Sometimes this may be called more than once with different channel counts, in
which case we must safely |
101 // uninitialize and then re-initialize with the new channel count. | 101 // uninitialize and then re-initialize with the new channel count. |
102 void AudioBasicProcessorHandler::checkNumberOfChannelsForInput(AudioNodeInput* i
nput) | 102 void AudioBasicProcessorHandler::checkNumberOfChannelsForInput(AudioNodeInput* i
nput) |
103 { | 103 { |
104 ASSERT(context()->isAudioThread()); | 104 DCHECK(context()->isAudioThread()); |
105 ASSERT(context()->isGraphOwner()); | 105 ASSERT(context()->isGraphOwner()); |
106 | 106 |
107 ASSERT(input == &this->input(0)); | 107 DCHECK_EQ(input, &this->input(0)); |
108 if (input != &this->input(0)) | 108 if (input != &this->input(0)) |
109 return; | 109 return; |
110 | 110 |
111 ASSERT(processor()); | 111 DCHECK(processor()); |
112 if (!processor()) | 112 if (!processor()) |
113 return; | 113 return; |
114 | 114 |
115 unsigned numberOfChannels = input->numberOfChannels(); | 115 unsigned numberOfChannels = input->numberOfChannels(); |
116 | 116 |
117 if (isInitialized() && numberOfChannels != output(0).numberOfChannels()) { | 117 if (isInitialized() && numberOfChannels != output(0).numberOfChannels()) { |
118 // We're already initialized but the channel count has changed. | 118 // We're already initialized but the channel count has changed. |
119 uninitialize(); | 119 uninitialize(); |
120 } | 120 } |
121 | 121 |
(...skipping 19 matching lines...) Expand all Loading... |
141 return m_processor->tailTime(); | 141 return m_processor->tailTime(); |
142 } | 142 } |
143 | 143 |
144 double AudioBasicProcessorHandler::latencyTime() const | 144 double AudioBasicProcessorHandler::latencyTime() const |
145 { | 145 { |
146 return m_processor->latencyTime(); | 146 return m_processor->latencyTime(); |
147 } | 147 } |
148 | 148 |
149 } // namespace blink | 149 } // namespace blink |
150 | 150 |
OLD | NEW |