| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 // One int16_t and one float ChannelBuffer that are kept in sync. The sync is | 147 // One int16_t and one float ChannelBuffer that are kept in sync. The sync is |
| 148 // broken when someone requests write access to either ChannelBuffer, and | 148 // broken when someone requests write access to either ChannelBuffer, and |
| 149 // reestablished when someone requests the outdated ChannelBuffer. It is | 149 // reestablished when someone requests the outdated ChannelBuffer. It is |
| 150 // therefore safe to use the return value of ibuf_const() and fbuf_const() | 150 // therefore safe to use the return value of ibuf_const() and fbuf_const() |
| 151 // until the next call to ibuf() or fbuf(), and the return value of ibuf() and | 151 // until the next call to ibuf() or fbuf(), and the return value of ibuf() and |
| 152 // fbuf() until the next call to any of the other functions. | 152 // fbuf() until the next call to any of the other functions. |
| 153 class IFChannelBuffer { | 153 class IFChannelBuffer { |
| 154 public: | 154 public: |
| 155 IFChannelBuffer(size_t num_frames, size_t num_channels, size_t num_bands = 1); | 155 IFChannelBuffer(size_t num_frames, size_t num_channels, size_t num_bands = 1); |
| 156 ~IFChannelBuffer(); |
| 156 | 157 |
| 157 ChannelBuffer<int16_t>* ibuf(); | 158 ChannelBuffer<int16_t>* ibuf(); |
| 158 ChannelBuffer<float>* fbuf(); | 159 ChannelBuffer<float>* fbuf(); |
| 159 const ChannelBuffer<int16_t>* ibuf_const() const; | 160 const ChannelBuffer<int16_t>* ibuf_const() const; |
| 160 const ChannelBuffer<float>* fbuf_const() const; | 161 const ChannelBuffer<float>* fbuf_const() const; |
| 161 | 162 |
| 162 size_t num_frames() const { return ibuf_.num_frames(); } | 163 size_t num_frames() const { return ibuf_.num_frames(); } |
| 163 size_t num_frames_per_band() const { return ibuf_.num_frames_per_band(); } | 164 size_t num_frames_per_band() const { return ibuf_.num_frames_per_band(); } |
| 164 size_t num_channels() const { | 165 size_t num_channels() const { |
| 165 return ivalid_ ? ibuf_.num_channels() : fbuf_.num_channels(); | 166 return ivalid_ ? ibuf_.num_channels() : fbuf_.num_channels(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 176 | 177 |
| 177 mutable bool ivalid_; | 178 mutable bool ivalid_; |
| 178 mutable ChannelBuffer<int16_t> ibuf_; | 179 mutable ChannelBuffer<int16_t> ibuf_; |
| 179 mutable bool fvalid_; | 180 mutable bool fvalid_; |
| 180 mutable ChannelBuffer<float> fbuf_; | 181 mutable ChannelBuffer<float> fbuf_; |
| 181 }; | 182 }; |
| 182 | 183 |
| 183 } // namespace webrtc | 184 } // namespace webrtc |
| 184 | 185 |
| 185 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_CHANNEL_BUFFER_H_ | 186 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_CHANNEL_BUFFER_H_ |
| OLD | NEW |