| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // Determine how many input frames we'll need. | 60 // Determine how many input frames we'll need. |
| 61 // We need to fill the buffer up to and including endIndex (so add 1) but | 61 // We need to fill the buffer up to and including endIndex (so add 1) but |
| 62 // we've already buffered m_fillIndex frames from last time. | 62 // we've already buffered m_fillIndex frames from last time. |
| 63 size_t framesNeeded = 1 + endIndex - m_fillIndex; | 63 size_t framesNeeded = 1 + endIndex - m_fillIndex; |
| 64 if (numberOfSourceFramesNeededP) | 64 if (numberOfSourceFramesNeededP) |
| 65 *numberOfSourceFramesNeededP = framesNeeded; | 65 *numberOfSourceFramesNeededP = framesNeeded; |
| 66 | 66 |
| 67 // Do bounds checking for the source buffer. | 67 // Do bounds checking for the source buffer. |
| 68 bool isGood = m_fillIndex < m_sourceBuffer.size() && | 68 bool isGood = m_fillIndex < m_sourceBuffer.size() && |
| 69 m_fillIndex + framesNeeded <= m_sourceBuffer.size(); | 69 m_fillIndex + framesNeeded <= m_sourceBuffer.size(); |
| 70 ASSERT(isGood); | 70 DCHECK(isGood); |
| 71 if (!isGood) | 71 if (!isGood) |
| 72 return 0; | 72 return 0; |
| 73 | 73 |
| 74 return m_sourceBuffer.data() + m_fillIndex; | 74 return m_sourceBuffer.data() + m_fillIndex; |
| 75 } | 75 } |
| 76 | 76 |
| 77 void AudioResamplerKernel::process(float* destination, size_t framesToProcess) { | 77 void AudioResamplerKernel::process(float* destination, size_t framesToProcess) { |
| 78 ASSERT(framesToProcess <= MaxFramesToProcess); | 78 ASSERT(framesToProcess <= MaxFramesToProcess); |
| 79 | 79 |
| 80 float* source = m_sourceBuffer.data(); | 80 float* source = m_sourceBuffer.data(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 m_fillIndex = 0; | 134 m_fillIndex = 0; |
| 135 m_lastValues[0] = 0.0f; | 135 m_lastValues[0] = 0.0f; |
| 136 m_lastValues[1] = 0.0f; | 136 m_lastValues[1] = 0.0f; |
| 137 } | 137 } |
| 138 | 138 |
| 139 double AudioResamplerKernel::rate() const { | 139 double AudioResamplerKernel::rate() const { |
| 140 return m_resampler->rate(); | 140 return m_resampler->rate(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace blink | 143 } // namespace blink |
| OLD | NEW |