OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/copresence/chrome_whispernet_client.h" | 5 #include "chrome/browser/copresence/chrome_whispernet_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <cstdlib> | 10 #include <cstdlib> |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 sizeof(float) * saved_samples_->frames()); | 200 sizeof(float) * saved_samples_->frames()); |
201 | 201 |
202 saved_samples_index_ = 0; | 202 saved_samples_index_ = 0; |
203 converter_->Convert(converted_samples.get()); | 203 converter_->Convert(converted_samples.get()); |
204 | 204 |
205 return converted_samples; | 205 return converted_samples; |
206 } | 206 } |
207 | 207 |
208 // AudioConverter::InputCallback overrides: | 208 // AudioConverter::InputCallback overrides: |
209 double ProvideInput(media::AudioBus* dest, | 209 double ProvideInput(media::AudioBus* dest, |
210 base::TimeDelta /* buffer_delay */) override { | 210 uint32_t /* frames_delayed */) override { |
211 // Copy any saved samples we have to the output bus. | 211 // Copy any saved samples we have to the output bus. |
212 const int remaining_frames = | 212 const int remaining_frames = |
213 saved_samples_->frames() - saved_samples_index_; | 213 saved_samples_->frames() - saved_samples_index_; |
214 const int frames_to_copy = std::min(remaining_frames, dest->frames()); | 214 const int frames_to_copy = std::min(remaining_frames, dest->frames()); |
215 saved_samples_stereo_->CopyPartialFramesTo(saved_samples_index_, | 215 saved_samples_stereo_->CopyPartialFramesTo(saved_samples_index_, |
216 frames_to_copy, 0, dest); | 216 frames_to_copy, 0, dest); |
217 saved_samples_index_ += frames_to_copy; | 217 saved_samples_index_ += frames_to_copy; |
218 | 218 |
219 // Pad any remaining space with zeroes. | 219 // Pad any remaining space with zeroes. |
220 if (remaining_frames < dest->frames()) { | 220 if (remaining_frames < dest->frames()) { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 367 |
368 EncodeTokenAndSaveSamples(client_3.get(), true, kSixZeros, token_params); | 368 EncodeTokenAndSaveSamples(client_3.get(), true, kSixZeros, token_params); |
369 DecodeSamplesAndVerifyToken(client_3.get(), true, kSixZeros, token_params); | 369 DecodeSamplesAndVerifyToken(client_3.get(), true, kSixZeros, token_params); |
370 | 370 |
371 const size_t kLongTokenLengths[2] = {8, 9}; | 371 const size_t kLongTokenLengths[2] = {8, 9}; |
372 GetTokenParamsForLengths(kLongTokenLengths, token_params); | 372 GetTokenParamsForLengths(kLongTokenLengths, token_params); |
373 | 373 |
374 EncodeTokenAndSaveSamples(client_2.get(), true, kEightZeros, token_params); | 374 EncodeTokenAndSaveSamples(client_2.get(), true, kEightZeros, token_params); |
375 DecodeSamplesAndVerifyToken(client_2.get(), true, kEightZeros, token_params); | 375 DecodeSamplesAndVerifyToken(client_2.get(), true, kEightZeros, token_params); |
376 } | 376 } |
OLD | NEW |