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

Side by Side Diff: media/audio/fake_audio_input_stream.cc

Issue 2919793002: Detect AudioInputStream muting and propagate to MediaStreamAudioSource. (Closed)
Patch Set: Reworked test again, to make tsan2 happy. Created 3 years, 6 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 | « media/audio/fake_audio_input_stream.h ('k') | media/base/audio_capturer_source.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/audio/fake_audio_input_stream.h" 5 #include "media/audio/fake_audio_input_stream.h"
6 6
7 #include "base/atomicops.h"
7 #include "base/bind.h" 8 #include "base/bind.h"
8 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 10 #include "base/command_line.h"
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
11 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
12 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
13 #include "base/strings/string_split.h" 14 #include "base/strings/string_split.h"
14 #include "base/time/time.h" 15 #include "base/time/time.h"
15 #include "media/audio/audio_manager_base.h" 16 #include "media/audio/audio_manager_base.h"
16 #include "media/audio/simple_sources.h" 17 #include "media/audio/simple_sources.h"
17 #include "media/base/audio_bus.h" 18 #include "media/base/audio_bus.h"
18 #include "media/base/media_switches.h" 19 #include "media/base/media_switches.h"
19 20
20 namespace media { 21 namespace media {
21 22
23 namespace {
24 base::subtle::AtomicWord g_fake_input_streams_are_muted = 0;
25 }
26
22 AudioInputStream* FakeAudioInputStream::MakeFakeStream( 27 AudioInputStream* FakeAudioInputStream::MakeFakeStream(
23 AudioManagerBase* manager, 28 AudioManagerBase* manager,
24 const AudioParameters& params) { 29 const AudioParameters& params) {
25 return new FakeAudioInputStream(manager, params); 30 return new FakeAudioInputStream(manager, params);
26 } 31 }
27 32
28 FakeAudioInputStream::FakeAudioInputStream(AudioManagerBase* manager, 33 FakeAudioInputStream::FakeAudioInputStream(AudioManagerBase* manager,
29 const AudioParameters& params) 34 const AudioParameters& params)
30 : audio_manager_(manager), 35 : audio_manager_(manager),
31 callback_(NULL), 36 callback_(NULL),
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); 79 DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread());
75 } 80 }
76 81
77 double FakeAudioInputStream::GetVolume() { 82 double FakeAudioInputStream::GetVolume() {
78 DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); 83 DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread());
79 return 1.0; 84 return 1.0;
80 } 85 }
81 86
82 bool FakeAudioInputStream::IsMuted() { 87 bool FakeAudioInputStream::IsMuted() {
83 DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); 88 DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread());
84 return false; 89 return base::subtle::NoBarrier_Load(&g_fake_input_streams_are_muted) != 0;
85 } 90 }
86 91
87 bool FakeAudioInputStream::SetAutomaticGainControl(bool enabled) { 92 bool FakeAudioInputStream::SetAutomaticGainControl(bool enabled) {
88 return false; 93 return false;
89 } 94 }
90 95
91 bool FakeAudioInputStream::GetAutomaticGainControl() { 96 bool FakeAudioInputStream::GetAutomaticGainControl() {
92 return false; 97 return false;
93 } 98 }
94 99
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 134 }
130 return base::MakeUnique<FileSource>(params_, path_to_wav_file, looping); 135 return base::MakeUnique<FileSource>(params_, path_to_wav_file, looping);
131 } 136 }
132 return base::MakeUnique<BeepingSource>(params_); 137 return base::MakeUnique<BeepingSource>(params_);
133 } 138 }
134 139
135 void FakeAudioInputStream::BeepOnce() { 140 void FakeAudioInputStream::BeepOnce() {
136 BeepingSource::BeepOnce(); 141 BeepingSource::BeepOnce();
137 } 142 }
138 143
144 void FakeAudioInputStream::SetGlobalMutedState(bool is_muted) {
145 base::subtle::NoBarrier_Store(&g_fake_input_streams_are_muted,
146 (is_muted ? 1 : 0));
147 }
148
139 } // namespace media 149 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/fake_audio_input_stream.h ('k') | media/base/audio_capturer_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698