OLD | NEW |
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 "base/environment.h" | 5 #include "base/environment.h" |
6 #include "base/test/test_timeouts.h" | 6 #include "base/test/test_timeouts.h" |
7 #include "content/renderer/media/audio_hardware.h" | 7 #include "content/renderer/media/audio_hardware.h" |
8 #include "content/renderer/media/webrtc_audio_device_impl.h" | 8 #include "content/renderer/media/webrtc_audio_device_impl.h" |
9 #include "content/test/webrtc_audio_device_test.h" | 9 #include "content/test/webrtc_audio_device_test.h" |
10 #include "media/audio/audio_manager.h" | 10 #include "media/audio/audio_manager.h" |
11 #include "media/audio/audio_util.h" | 11 #include "media/audio/audio_util.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "third_party/webrtc/voice_engine/main/interface/voe_audio_processing.h" | 13 #include "third_party/webrtc/voice_engine/main/interface/voe_audio_processing.h" |
14 #include "third_party/webrtc/voice_engine/main/interface/voe_base.h" | 14 #include "third_party/webrtc/voice_engine/main/interface/voe_base.h" |
15 #include "third_party/webrtc/voice_engine/main/interface/voe_external_media.h" | 15 #include "third_party/webrtc/voice_engine/main/interface/voe_external_media.h" |
16 #include "third_party/webrtc/voice_engine/main/interface/voe_file.h" | 16 #include "third_party/webrtc/voice_engine/main/interface/voe_file.h" |
17 #include "third_party/webrtc/voice_engine/main/interface/voe_network.h" | 17 #include "third_party/webrtc/voice_engine/main/interface/voe_network.h" |
18 | 18 |
19 using testing::_; | 19 using testing::_; |
20 using testing::AnyNumber; | 20 using testing::AnyNumber; |
21 using testing::InvokeWithoutArgs; | 21 using testing::InvokeWithoutArgs; |
22 using testing::Return; | 22 using testing::Return; |
23 using testing::StrEq; | 23 using testing::StrEq; |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 ACTION_P(QuitMessageLoop, loop_or_proxy) { | |
28 loop_or_proxy->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | |
29 } | |
30 | |
31 class AudioUtil : public AudioUtilInterface { | 27 class AudioUtil : public AudioUtilInterface { |
32 public: | 28 public: |
33 AudioUtil() {} | 29 AudioUtil() {} |
34 | 30 |
35 virtual int GetAudioHardwareSampleRate() OVERRIDE { | 31 virtual int GetAudioHardwareSampleRate() OVERRIDE { |
36 return media::GetAudioHardwareSampleRate(); | 32 return media::GetAudioHardwareSampleRate(); |
37 } | 33 } |
38 virtual int GetAudioInputHardwareSampleRate( | 34 virtual int GetAudioInputHardwareSampleRate( |
39 const std::string& device_id) OVERRIDE { | 35 const std::string& device_id) OVERRIDE { |
40 return media::GetAudioInputHardwareSampleRate(device_id); | 36 return media::GetAudioInputHardwareSampleRate(device_id); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 int packet_size() const { | 156 int packet_size() const { |
161 base::AutoLock auto_lock(lock_); | 157 base::AutoLock auto_lock(lock_); |
162 return packet_size_; | 158 return packet_size_; |
163 } | 159 } |
164 | 160 |
165 int sample_rate() const { | 161 int sample_rate() const { |
166 base::AutoLock auto_lock(lock_); | 162 base::AutoLock auto_lock(lock_); |
167 return sample_rate_; | 163 return sample_rate_; |
168 } | 164 } |
169 | 165 |
170 int channels() const { | |
171 base::AutoLock auto_lock(lock_); | |
172 return channels_; | |
173 } | |
174 | |
175 private: | 166 private: |
176 base::WaitableEvent* event_; | 167 base::WaitableEvent* event_; |
177 int channel_id_; | 168 int channel_id_; |
178 webrtc::ProcessingTypes type_; | 169 webrtc::ProcessingTypes type_; |
179 int packet_size_; | 170 int packet_size_; |
180 int sample_rate_; | 171 int sample_rate_; |
181 int channels_; | 172 int channels_; |
182 mutable base::Lock lock_; | 173 mutable base::Lock lock_; |
183 DISALLOW_COPY_AND_ASSIGN(WebRTCMediaProcessImpl); | 174 DISALLOW_COPY_AND_ASSIGN(WebRTCMediaProcessImpl); |
184 }; | 175 }; |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 MessageLoop::QuitClosure(), | 511 MessageLoop::QuitClosure(), |
521 TestTimeouts::action_timeout()); | 512 TestTimeouts::action_timeout()); |
522 message_loop_.Run(); | 513 message_loop_.Run(); |
523 | 514 |
524 EXPECT_EQ(0, base->StopSend(ch)); | 515 EXPECT_EQ(0, base->StopSend(ch)); |
525 EXPECT_EQ(0, base->StopPlayout(ch)); | 516 EXPECT_EQ(0, base->StopPlayout(ch)); |
526 | 517 |
527 EXPECT_EQ(0, base->DeleteChannel(ch)); | 518 EXPECT_EQ(0, base->DeleteChannel(ch)); |
528 EXPECT_EQ(0, base->Terminate()); | 519 EXPECT_EQ(0, base->Terminate()); |
529 } | 520 } |
OLD | NEW |