| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/audio/PushPullFIFO.h" | 5 #include "platform/audio/PushPullFIFO.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "platform/audio/AudioUtilities.h" | 8 #include "platform/audio/AudioUtilities.h" |
| 9 #include "platform/wtf/PtrUtil.h" | 9 #include "platform/wtf/PtrUtil.h" |
| 10 | 10 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 // The following checks are in place to catch the inexplicable crash. | 94 // The following checks are in place to catch the inexplicable crash. |
| 95 // (crbug.com/692423) | 95 // (crbug.com/692423) |
| 96 if (frames_requested > output_bus->length()) { | 96 if (frames_requested > output_bus->length()) { |
| 97 LOG(WARNING) << "[WebAudio/PushPullFIFO::pull <" << static_cast<void*>(this) | 97 LOG(WARNING) << "[WebAudio/PushPullFIFO::pull <" << static_cast<void*>(this) |
| 98 << ">] framesRequested > outputBus->length() (" | 98 << ">] framesRequested > outputBus->length() (" |
| 99 << frames_requested << " > " << output_bus->length() << ")"; | 99 << frames_requested << " > " << output_bus->length() << ")"; |
| 100 } | 100 } |
| 101 if (frames_requested > fifo_length_) { | 101 if (frames_requested > fifo_length_) { |
| 102 LOG(WARNING) << "[WebAudio/PushPullFIFO::pull <" << static_cast<void*>(this) | 102 LOG(WARNING) << "[WebAudio/PushPullFIFO::pull <" << static_cast<void*>(this) |
| 103 << ">] framesRequested > m_fifoLength (" << frames_requested | 103 << ">] framesRequested > fifo_length_ (" << frames_requested |
| 104 << " > " << fifo_length_ << ")"; | 104 << " > " << fifo_length_ << ")"; |
| 105 } | 105 } |
| 106 if (index_read_ >= fifo_length_) { | 106 if (index_read_ >= fifo_length_) { |
| 107 LOG(WARNING) << "[WebAudio/PushPullFIFO::pull <" << static_cast<void*>(this) | 107 LOG(WARNING) << "[WebAudio/PushPullFIFO::pull <" << static_cast<void*>(this) |
| 108 << ">] m_indexRead >= m_fifoLength (" << index_read_ | 108 << ">] index_read_ >= fifo_length_ (" << index_read_ |
| 109 << " >= " << fifo_length_ << ")"; | 109 << " >= " << fifo_length_ << ")"; |
| 110 } | 110 } |
| 111 #endif | 111 #endif |
| 112 | 112 |
| 113 CHECK(output_bus); | 113 CHECK(output_bus); |
| 114 SECURITY_CHECK(frames_requested <= output_bus->length()); | 114 SECURITY_CHECK(frames_requested <= output_bus->length()); |
| 115 SECURITY_CHECK(frames_requested <= fifo_length_); | 115 SECURITY_CHECK(frames_requested <= fifo_length_); |
| 116 SECURITY_CHECK(index_read_ < fifo_length_); | 116 SECURITY_CHECK(index_read_ < fifo_length_); |
| 117 | 117 |
| 118 const size_t remainder = fifo_length_ - index_read_; | 118 const size_t remainder = fifo_length_ - index_read_; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 ? frames_requested - frames_available_ | 169 ? frames_requested - frames_available_ |
| 170 : 0; | 170 : 0; |
| 171 } | 171 } |
| 172 | 172 |
| 173 const PushPullFIFOStateForTest PushPullFIFO::GetStateForTest() const { | 173 const PushPullFIFOStateForTest PushPullFIFO::GetStateForTest() const { |
| 174 return {length(), NumberOfChannels(), frames_available_, index_read_, | 174 return {length(), NumberOfChannels(), frames_available_, index_read_, |
| 175 index_write_, overflow_count_, underflow_count_}; | 175 index_write_, overflow_count_, underflow_count_}; |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace blink | 178 } // namespace blink |
| OLD | NEW |