| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 bool channelCountMatches = | 87 bool channelCountMatches = |
| 88 source->numberOfChannels() == destination->numberOfChannels() && | 88 source->numberOfChannels() == destination->numberOfChannels() && |
| 89 source->numberOfChannels() == m_kernels.size(); | 89 source->numberOfChannels() == m_kernels.size(); |
| 90 DCHECK(channelCountMatches); | 90 DCHECK(channelCountMatches); |
| 91 if (!channelCountMatches) | 91 if (!channelCountMatches) |
| 92 return; | 92 return; |
| 93 | 93 |
| 94 // The audio thread can't block on this lock, so we call tryLock() instead. | 94 // The audio thread can't block on this lock, so we call tryLock() instead. |
| 95 MutexTryLocker tryLocker(m_processLock); | 95 MutexTryLocker tryLocker(m_processLock); |
| 96 if (tryLocker.locked()) { | 96 if (tryLocker.locked()) { |
| 97 // For each channel of our input, process using the corresponding WaveShaper
DSPKernel into the output channel. | 97 // For each channel of our input, process using the corresponding |
| 98 // WaveShaperDSPKernel into the output channel. |
| 98 for (unsigned i = 0; i < m_kernels.size(); ++i) | 99 for (unsigned i = 0; i < m_kernels.size(); ++i) |
| 99 m_kernels[i]->process(source->channel(i)->data(), | 100 m_kernels[i]->process(source->channel(i)->data(), |
| 100 destination->channel(i)->mutableData(), | 101 destination->channel(i)->mutableData(), |
| 101 framesToProcess); | 102 framesToProcess); |
| 102 } else { | 103 } else { |
| 103 // Too bad - the tryLock() failed. We must be in the middle of a setCurve()
call. | 104 // Too bad - the tryLock() failed. We must be in the middle of a setCurve() |
| 105 // call. |
| 104 destination->zero(); | 106 destination->zero(); |
| 105 } | 107 } |
| 106 } | 108 } |
| 107 | 109 |
| 108 } // namespace blink | 110 } // namespace blink |
| OLD | NEW |