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

Side by Side Diff: components/copresence/mediums/audio/audio_player_unittest.cc

Issue 481193003: Remove AudioBuffersState usage in Chromium (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix audio muter build buster. Created 6 years, 2 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 | Annotate | Revision Log
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 "components/copresence/mediums/audio/audio_player.h" 5 #include "components/copresence/mediums/audio/audio_player.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "components/copresence/public/copresence_constants.h" 9 #include "components/copresence/public/copresence_constants.h"
10 #include "components/copresence/test/audio_test_support.h" 10 #include "components/copresence/test/audio_test_support.h"
(...skipping 30 matching lines...) Expand all
41 virtual void GetVolume(double* volume) OVERRIDE {} 41 virtual void GetVolume(double* volume) OVERRIDE {}
42 virtual void Close() OVERRIDE {} 42 virtual void Close() OVERRIDE {}
43 43
44 private: 44 private:
45 void GatherPlayedSamples() { 45 void GatherPlayedSamples() {
46 int frames = 0, total_frames = 0; 46 int frames = 0, total_frames = 0;
47 do { 47 do {
48 // Call back into the player to get samples that it wants us to play. 48 // Call back into the player to get samples that it wants us to play.
49 scoped_ptr<media::AudioBus> dest = 49 scoped_ptr<media::AudioBus> dest =
50 media::AudioBus::Create(1, default_frame_count_); 50 media::AudioBus::Create(1, default_frame_count_);
51 frames = callback_->OnMoreData(dest.get(), media::AudioBuffersState()); 51 frames = callback_->OnMoreData(dest.get(), 0);
52 total_frames += frames; 52 total_frames += frames;
53 // Send the samples given to us by the player to the gather callback. 53 // Send the samples given to us by the player to the gather callback.
54 caller_loop_->PostTask( 54 caller_loop_->PostTask(
55 FROM_HERE, base::Bind(gather_callback_, base::Passed(&dest), frames)); 55 FROM_HERE, base::Bind(gather_callback_, base::Passed(&dest), frames));
56 } while (frames && total_frames < max_frame_count_); 56 } while (frames && total_frames < max_frame_count_);
57 } 57 }
58 58
59 int default_frame_count_; 59 int default_frame_count_;
60 int max_frame_count_; 60 int max_frame_count_;
61 GatherSamplesCallback gather_callback_; 61 GatherSamplesCallback gather_callback_;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 TEST_F(AudioPlayerTest, PlayingEndToEnd) { 180 TEST_F(AudioPlayerTest, PlayingEndToEnd) {
181 const int kNumSamples = kDefaultFrameCount * 10; 181 const int kNumSamples = kDefaultFrameCount * 10;
182 CreatePlayer(); 182 CreatePlayer();
183 183
184 PlayAndVerifySamples(CreateRandomAudioRefCounted(0x1337, 1, kNumSamples)); 184 PlayAndVerifySamples(CreateRandomAudioRefCounted(0x1337, 1, kNumSamples));
185 185
186 DeletePlayer(); 186 DeletePlayer();
187 } 187 }
188 188
189 } // namespace copresence 189 } // namespace copresence
OLDNEW
« no previous file with comments | « components/copresence/mediums/audio/audio_player.cc ('k') | content/browser/media/capture/web_contents_audio_muter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698