Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: chrome/browser/copresence/chrome_whispernet_client_browsertest.cc

Issue 1018093002: Using AudioBus::ZeroFramesPartial() instead of manual zeroing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <cmath> 7 #include <cmath>
8 #include <cstdlib> 8 #include <cstdlib>
9 #include <string> 9 #include <string>
10 10
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 base::TimeDelta /* buffer_delay */) override { 207 base::TimeDelta /* buffer_delay */) override {
208 // Copy any saved samples we have to the output bus. 208 // Copy any saved samples we have to the output bus.
209 const int remaining_frames = 209 const int remaining_frames =
210 saved_samples_->frames() - saved_samples_index_; 210 saved_samples_->frames() - saved_samples_index_;
211 const int frames_to_copy = std::min(remaining_frames, dest->frames()); 211 const int frames_to_copy = std::min(remaining_frames, dest->frames());
212 saved_samples_stereo_->CopyPartialFramesTo(saved_samples_index_, 212 saved_samples_stereo_->CopyPartialFramesTo(saved_samples_index_,
213 frames_to_copy, 0, dest); 213 frames_to_copy, 0, dest);
214 saved_samples_index_ += frames_to_copy; 214 saved_samples_index_ += frames_to_copy;
215 215
216 // Pad any remaining space with zeroes. 216 // Pad any remaining space with zeroes.
217 for (int i = remaining_frames; i < dest->frames(); i++) { 217 if (remaining_frames < dest->frames()) {
218 for (int c = 0; c < dest->channels(); c++) 218 dest->ZeroFramesPartial(remaining_frames,
219 dest->channel(c)[i] = 0; 219 dest->frames() - remaining_frames);
220 } 220 }
221 221
222 // Return the volume level. 222 // Return the volume level.
223 return 1.0; 223 return 1.0;
224 } 224 }
225 225
226 scoped_ptr<base::RunLoop> run_loop_; 226 scoped_ptr<base::RunLoop> run_loop_;
227 bool initialized_; 227 bool initialized_;
228 228
229 std::string expected_token_; 229 std::string expected_token_;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 364
365 EncodeTokenAndSaveSamples(client_3.get(), true, kSixZeros, token_params); 365 EncodeTokenAndSaveSamples(client_3.get(), true, kSixZeros, token_params);
366 DecodeSamplesAndVerifyToken(client_3.get(), true, kSixZeros, token_params); 366 DecodeSamplesAndVerifyToken(client_3.get(), true, kSixZeros, token_params);
367 367
368 const size_t kLongTokenLengths[2] = {8, 9}; 368 const size_t kLongTokenLengths[2] = {8, 9};
369 GetTokenParamsForLengths(kLongTokenLengths, token_params); 369 GetTokenParamsForLengths(kLongTokenLengths, token_params);
370 370
371 EncodeTokenAndSaveSamples(client_2.get(), true, kEightZeros, token_params); 371 EncodeTokenAndSaveSamples(client_2.get(), true, kEightZeros, token_params);
372 DecodeSamplesAndVerifyToken(client_2.get(), true, kEightZeros, token_params); 372 DecodeSamplesAndVerifyToken(client_2.get(), true, kEightZeros, token_params);
373 } 373 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698