| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // If the end time is somewhere in the middle of this time quantum, then zer
o out the | 110 // If the end time is somewhere in the middle of this time quantum, then zer
o out the |
| 111 // frames from the end time to the very end of the quantum. | 111 // frames from the end time to the very end of the quantum. |
| 112 if (m_endTime != UnknownTime && endFrame >= quantumStartFrame && endFrame <
quantumEndFrame) { | 112 if (m_endTime != UnknownTime && endFrame >= quantumStartFrame && endFrame <
quantumEndFrame) { |
| 113 size_t zeroStartFrame = endFrame - quantumStartFrame; | 113 size_t zeroStartFrame = endFrame - quantumStartFrame; |
| 114 size_t framesToZero = quantumFrameSize - zeroStartFrame; | 114 size_t framesToZero = quantumFrameSize - zeroStartFrame; |
| 115 | 115 |
| 116 bool isSafe = zeroStartFrame < quantumFrameSize && framesToZero <= quant
umFrameSize && zeroStartFrame + framesToZero <= quantumFrameSize; | 116 bool isSafe = zeroStartFrame < quantumFrameSize && framesToZero <= quant
umFrameSize && zeroStartFrame + framesToZero <= quantumFrameSize; |
| 117 ASSERT(isSafe); | 117 ASSERT(isSafe); |
| 118 | 118 |
| 119 if (isSafe) { | 119 if (isSafe) { |
| 120 nonSilentFramesToProcess -= framesToZero; | 120 if (framesToZero > nonSilentFramesToProcess) |
| 121 nonSilentFramesToProcess = 0; |
| 122 else |
| 123 nonSilentFramesToProcess -= framesToZero; |
| 124 |
| 121 for (unsigned i = 0; i < outputBus->numberOfChannels(); ++i) | 125 for (unsigned i = 0; i < outputBus->numberOfChannels(); ++i) |
| 122 memset(outputBus->channel(i)->mutableData() + zeroStartFrame, 0,
sizeof(float) * framesToZero); | 126 memset(outputBus->channel(i)->mutableData() + zeroStartFrame, 0,
sizeof(float) * framesToZero); |
| 123 } | 127 } |
| 124 | 128 |
| 125 finish(); | 129 finish(); |
| 126 } | 130 } |
| 127 | 131 |
| 128 return; | 132 return; |
| 129 } | 133 } |
| 130 | 134 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // Let the context dereference this AudioNode. | 170 // Let the context dereference this AudioNode. |
| 167 context()->notifyNodeFinishedProcessing(this); | 171 context()->notifyNodeFinishedProcessing(this); |
| 168 m_playbackState = FINISHED_STATE; | 172 m_playbackState = FINISHED_STATE; |
| 169 context()->decrementActiveSourceCount(); | 173 context()->decrementActiveSourceCount(); |
| 170 } | 174 } |
| 171 } | 175 } |
| 172 | 176 |
| 173 } // namespace WebCore | 177 } // namespace WebCore |
| 174 | 178 |
| 175 #endif // ENABLE(WEB_AUDIO) | 179 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |