OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 void OfflineAudioDestinationNode::offlineRender() | 92 void OfflineAudioDestinationNode::offlineRender() |
93 { | 93 { |
94 ASSERT(!isMainThread()); | 94 ASSERT(!isMainThread()); |
95 ASSERT(m_renderBus.get()); | 95 ASSERT(m_renderBus.get()); |
96 if (!m_renderBus.get()) | 96 if (!m_renderBus.get()) |
97 return; | 97 return; |
98 | 98 |
| 99 bool isAudioContextInitialized = context()->isInitialized(); |
| 100 ASSERT(isAudioContextInitialized); |
| 101 if (!isAudioContextInitialized) |
| 102 return; |
| 103 |
99 bool channelsMatch = m_renderBus->numberOfChannels() == m_renderTarget->numb
erOfChannels(); | 104 bool channelsMatch = m_renderBus->numberOfChannels() == m_renderTarget->numb
erOfChannels(); |
100 ASSERT(channelsMatch); | 105 ASSERT(channelsMatch); |
101 if (!channelsMatch) | 106 if (!channelsMatch) |
102 return; | 107 return; |
103 | 108 |
104 bool isRenderBusAllocated = m_renderBus->length() >= renderQuantumSize; | 109 bool isRenderBusAllocated = m_renderBus->length() >= renderQuantumSize; |
105 ASSERT(isRenderBusAllocated); | 110 ASSERT(isRenderBusAllocated); |
106 if (!isRenderBusAllocated) | 111 if (!isRenderBusAllocated) |
107 return; | 112 return; |
108 | 113 |
109 // Synchronize with HRTFDatabaseLoader. | |
110 // The database must be loaded before we can proceed. | |
111 HRTFDatabaseLoader* loader = context()->hrtfDatabaseLoader(); | |
112 ASSERT(loader); | |
113 if (!loader) | |
114 return; | |
115 | |
116 loader->waitForLoaderThreadCompletion(); | |
117 | |
118 // Break up the render target into smaller "render quantize" sized pieces. | 114 // Break up the render target into smaller "render quantize" sized pieces. |
119 // Render until we're finished. | 115 // Render until we're finished. |
120 size_t framesToProcess = m_renderTarget->length(); | 116 size_t framesToProcess = m_renderTarget->length(); |
121 unsigned numberOfChannels = m_renderTarget->numberOfChannels(); | 117 unsigned numberOfChannels = m_renderTarget->numberOfChannels(); |
122 | 118 |
123 unsigned n = 0; | 119 unsigned n = 0; |
124 while (framesToProcess > 0) { | 120 while (framesToProcess > 0) { |
125 // Render one render quantum. | 121 // Render one render quantum. |
126 render(0, m_renderBus.get(), renderQuantumSize); | 122 render(0, m_renderBus.get(), renderQuantumSize); |
127 | 123 |
(...skipping 25 matching lines...) Expand all Loading... |
153 } | 149 } |
154 | 150 |
155 void OfflineAudioDestinationNode::notifyComplete() | 151 void OfflineAudioDestinationNode::notifyComplete() |
156 { | 152 { |
157 context()->fireCompletionEvent(); | 153 context()->fireCompletionEvent(); |
158 } | 154 } |
159 | 155 |
160 } // namespace WebCore | 156 } // namespace WebCore |
161 | 157 |
162 #endif // ENABLE(WEB_AUDIO) | 158 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |