| 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 * | 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 m_framesInFifo += sourceLength; | 118 m_framesInFifo += sourceLength; |
| 119 ASSERT(m_framesInFifo <= m_fifoLength); | 119 ASSERT(m_framesInFifo <= m_fifoLength); |
| 120 m_writeIndex = updateIndex(m_writeIndex, sourceLength); | 120 m_writeIndex = updateIndex(m_writeIndex, sourceLength); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void AudioFIFO::findWrapLengths(size_t index, | 123 void AudioFIFO::findWrapLengths(size_t index, |
| 124 size_t size, | 124 size_t size, |
| 125 size_t& part1Length, | 125 size_t& part1Length, |
| 126 size_t& part2Length) { | 126 size_t& part2Length) { |
| 127 ASSERT_WITH_SECURITY_IMPLICATION(index < m_fifoLength && | 127 SECURITY_DCHECK(index < m_fifoLength && size <= m_fifoLength); |
| 128 size <= m_fifoLength); | |
| 129 if (index < m_fifoLength && size <= m_fifoLength) { | 128 if (index < m_fifoLength && size <= m_fifoLength) { |
| 130 if (index + size > m_fifoLength) { | 129 if (index + size > m_fifoLength) { |
| 131 // Need to wrap. Figure out the length of each piece. | 130 // Need to wrap. Figure out the length of each piece. |
| 132 part1Length = m_fifoLength - index; | 131 part1Length = m_fifoLength - index; |
| 133 part2Length = size - part1Length; | 132 part2Length = size - part1Length; |
| 134 } else { | 133 } else { |
| 135 // No wrap needed. | 134 // No wrap needed. |
| 136 part1Length = size; | 135 part1Length = size; |
| 137 part2Length = 0; | 136 part2Length = 0; |
| 138 } | 137 } |
| 139 } else { | 138 } else { |
| 140 // Invalid values for index or size. Set the part lengths to zero so nothing | 139 // Invalid values for index or size. Set the part lengths to zero so nothing |
| 141 // is copied. | 140 // is copied. |
| 142 part1Length = 0; | 141 part1Length = 0; |
| 143 part2Length = 0; | 142 part2Length = 0; |
| 144 } | 143 } |
| 145 } | 144 } |
| 146 | 145 |
| 147 } // namespace blink | 146 } // namespace blink |
| OLD | NEW |