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

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

Issue 645923002: Add support for audio input mute detection on all platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit 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
« no previous file with comments | « no previous file | content/browser/media/capture/web_contents_audio_input_stream.h » ('j') | 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 "components/copresence/mediums/audio/audio_recorder.h" 5 #include "components/copresence/mediums/audio/audio_recorder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/aligned_memory.h" 8 #include "base/memory/aligned_memory.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "components/copresence/public/copresence_constants.h" 10 #include "components/copresence/public/copresence_constants.h"
(...skipping 29 matching lines...) Expand all
40 base::Bind(&TestAudioInputStream::SimulateRecording, 40 base::Bind(&TestAudioInputStream::SimulateRecording,
41 base::Unretained(this))); 41 base::Unretained(this)));
42 } 42 }
43 virtual void Stop() override {} 43 virtual void Stop() override {}
44 virtual void Close() override {} 44 virtual void Close() override {}
45 virtual double GetMaxVolume() override { return 1.0; } 45 virtual double GetMaxVolume() override { return 1.0; }
46 virtual void SetVolume(double volume) override {} 46 virtual void SetVolume(double volume) override {}
47 virtual double GetVolume() override { return 1.0; } 47 virtual double GetVolume() override { return 1.0; }
48 virtual void SetAutomaticGainControl(bool enabled) override {} 48 virtual void SetAutomaticGainControl(bool enabled) override {}
49 virtual bool GetAutomaticGainControl() override { return true; } 49 virtual bool GetAutomaticGainControl() override { return true; }
50 virtual bool IsMuted() override { return false; }
50 51
51 private: 52 private:
52 void SimulateRecording() { 53 void SimulateRecording() {
53 const int fpb = params_.frames_per_buffer(); 54 const int fpb = params_.frames_per_buffer();
54 for (int i = 0; i < buffer_->frames() / fpb; ++i) { 55 for (int i = 0; i < buffer_->frames() / fpb; ++i) {
55 scoped_ptr<media::AudioBus> source = media::AudioBus::Create(2, fpb); 56 scoped_ptr<media::AudioBus> source = media::AudioBus::Create(2, fpb);
56 buffer_->CopyPartialFramesTo(i * fpb, fpb, 0, source.get()); 57 buffer_->CopyPartialFramesTo(i * fpb, fpb, 0, source.get());
57 callback_->OnData(this, source.get(), fpb, 1.0); 58 callback_->OnData(this, source.get(), fpb, 1.0);
58 } 59 }
59 } 60 }
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 kDefaultChannels, kDefaultSampleRate, kDefaultBitsPerSample, kNumSamples); 244 kDefaultChannels, kDefaultSampleRate, kDefaultBitsPerSample, kNumSamples);
244 245
245 RecordAndVerifySamples(); 246 RecordAndVerifySamples();
246 247
247 DeleteRecorder(); 248 DeleteRecorder();
248 } 249 }
249 250
250 // TODO(rkc): Add tests with recording different sample rates. 251 // TODO(rkc): Add tests with recording different sample rates.
251 252
252 } // namespace copresence 253 } // namespace copresence
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/capture/web_contents_audio_input_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698