| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 if (stageSize + stageOffset > totalResponseLength) | 97 if (stageSize + stageOffset > totalResponseLength) |
| 98 stageSize = totalResponseLength - stageOffset; | 98 stageSize = totalResponseLength - stageOffset; |
| 99 | 99 |
| 100 // This "staggers" the time when each FFT happens so they don't all happen | 100 // This "staggers" the time when each FFT happens so they don't all happen |
| 101 // at the same time | 101 // at the same time |
| 102 int renderPhase = convolverRenderPhase + i * renderSliceSize; | 102 int renderPhase = convolverRenderPhase + i * renderSliceSize; |
| 103 | 103 |
| 104 bool useDirectConvolver = !stageOffset; | 104 bool useDirectConvolver = !stageOffset; |
| 105 | 105 |
| 106 std::unique_ptr<ReverbConvolverStage> stage = | 106 std::unique_ptr<ReverbConvolverStage> stage = |
| 107 wrapUnique(new ReverbConvolverStage( | 107 WTF::wrapUnique(new ReverbConvolverStage( |
| 108 response, totalResponseLength, reverbTotalLatency, stageOffset, | 108 response, totalResponseLength, reverbTotalLatency, stageOffset, |
| 109 stageSize, fftSize, renderPhase, renderSliceSize, | 109 stageSize, fftSize, renderPhase, renderSliceSize, |
| 110 &m_accumulationBuffer, useDirectConvolver)); | 110 &m_accumulationBuffer, useDirectConvolver)); |
| 111 | 111 |
| 112 bool isBackgroundStage = false; | 112 bool isBackgroundStage = false; |
| 113 | 113 |
| 114 if (useBackgroundThreads && stageOffset > RealtimeFrameLimit) { | 114 if (useBackgroundThreads && stageOffset > RealtimeFrameLimit) { |
| 115 m_backgroundStages.append(std::move(stage)); | 115 m_backgroundStages.append(std::move(stage)); |
| 116 isBackgroundStage = true; | 116 isBackgroundStage = true; |
| 117 } else { | 117 } else { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 130 fftSize > m_maxRealtimeFFTSize) | 130 fftSize > m_maxRealtimeFFTSize) |
| 131 fftSize = m_maxRealtimeFFTSize; | 131 fftSize = m_maxRealtimeFFTSize; |
| 132 if (fftSize > m_maxFFTSize) | 132 if (fftSize > m_maxFFTSize) |
| 133 fftSize = m_maxFFTSize; | 133 fftSize = m_maxFFTSize; |
| 134 } | 134 } |
| 135 | 135 |
| 136 // Start up background thread | 136 // Start up background thread |
| 137 // FIXME: would be better to up the thread priority here. It doesn't need to | 137 // FIXME: would be better to up the thread priority here. It doesn't need to |
| 138 // be real-time, but higher than the default... | 138 // be real-time, but higher than the default... |
| 139 if (useBackgroundThreads && m_backgroundStages.size() > 0) | 139 if (useBackgroundThreads && m_backgroundStages.size() > 0) |
| 140 m_backgroundThread = wrapUnique(Platform::current()->createThread( | 140 m_backgroundThread = WTF::wrapUnique(Platform::current()->createThread( |
| 141 "Reverb convolution background thread")); | 141 "Reverb convolution background thread")); |
| 142 } | 142 } |
| 143 | 143 |
| 144 ReverbConvolver::~ReverbConvolver() { | 144 ReverbConvolver::~ReverbConvolver() { |
| 145 // Wait for background thread to stop | 145 // Wait for background thread to stop |
| 146 m_backgroundThread.reset(); | 146 m_backgroundThread.reset(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void ReverbConvolver::processInBackground() { | 149 void ReverbConvolver::processInBackground() { |
| 150 // Process all of the stages until their read indices reach the input buffer's | 150 // Process all of the stages until their read indices reach the input buffer's |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 m_accumulationBuffer.reset(); | 213 m_accumulationBuffer.reset(); |
| 214 m_inputBuffer.reset(); | 214 m_inputBuffer.reset(); |
| 215 } | 215 } |
| 216 | 216 |
| 217 size_t ReverbConvolver::latencyFrames() const { | 217 size_t ReverbConvolver::latencyFrames() const { |
| 218 return 0; | 218 return 0; |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace blink | 221 } // namespace blink |
| OLD | NEW |