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

Side by Side Diff: content/test/webrtc_audio_device_test.cc

Issue 12387006: Pass more detailed audio hardware configuration information to the renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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 | Annotate | Revision Log
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 "content/test/webrtc_audio_device_test.h" 5 #include "content/test/webrtc_audio_device_test.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/synchronization/waitable_event.h" 12 #include "base/synchronization/waitable_event.h"
13 #include "base/test/test_timeouts.h" 13 #include "base/test/test_timeouts.h"
14 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" 14 #include "content/browser/renderer_host/media/audio_input_renderer_host.h"
15 #include "content/browser/renderer_host/media/audio_mirroring_manager.h" 15 #include "content/browser/renderer_host/media/audio_mirroring_manager.h"
16 #include "content/browser/renderer_host/media/audio_renderer_host.h" 16 #include "content/browser/renderer_host/media/audio_renderer_host.h"
17 #include "content/browser/renderer_host/media/media_stream_manager.h" 17 #include "content/browser/renderer_host/media/media_stream_manager.h"
18 #include "content/browser/renderer_host/media/mock_media_observer.h" 18 #include "content/browser/renderer_host/media/mock_media_observer.h"
19 #include "content/common/media/media_param_traits.h"
19 #include "content/common/view_messages.h" 20 #include "content/common/view_messages.h"
20 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
21 #include "content/public/common/content_paths.h" 22 #include "content/public/common/content_paths.h"
22 #include "content/public/test/mock_resource_context.h" 23 #include "content/public/test/mock_resource_context.h"
23 #include "content/public/test/test_browser_thread.h" 24 #include "content/public/test/test_browser_thread.h"
24 #include "content/renderer/media/audio_input_message_filter.h" 25 #include "content/renderer/media/audio_input_message_filter.h"
25 #include "content/renderer/media/audio_message_filter.h" 26 #include "content/renderer/media/audio_message_filter.h"
26 #include "content/renderer/media/webrtc_audio_device_impl.h" 27 #include "content/renderer/media/webrtc_audio_device_impl.h"
27 #include "content/renderer/render_process.h" 28 #include "content/renderer/render_process.h"
28 #include "content/renderer/render_thread_impl.h" 29 #include "content/renderer/render_thread_impl.h"
29 #include "content/renderer/renderer_webkitplatformsupport_impl.h" 30 #include "content/renderer/renderer_webkitplatformsupport_impl.h"
31 #include "media/audio/audio_parameters.h"
30 #include "media/base/audio_hardware_config.h" 32 #include "media/base/audio_hardware_config.h"
31 #include "net/url_request/url_request_test_util.h" 33 #include "net/url_request/url_request_test_util.h"
32 #include "testing/gmock/include/gmock/gmock.h" 34 #include "testing/gmock/include/gmock/gmock.h"
33 #include "testing/gtest/include/gtest/gtest.h" 35 #include "testing/gtest/include/gtest/gtest.h"
34 #include "third_party/webrtc/voice_engine/include/voe_audio_processing.h" 36 #include "third_party/webrtc/voice_engine/include/voe_audio_processing.h"
35 #include "third_party/webrtc/voice_engine/include/voe_base.h" 37 #include "third_party/webrtc/voice_engine/include/voe_base.h"
36 #include "third_party/webrtc/voice_engine/include/voe_file.h" 38 #include "third_party/webrtc/voice_engine/include/voe_file.h"
37 #include "third_party/webrtc/voice_engine/include/voe_network.h" 39 #include "third_party/webrtc/voice_engine/include/voe_network.h"
38 40
39 #if defined(OS_WIN) 41 #if defined(OS_WIN)
40 #include "base/win/scoped_com_initializer.h" 42 #include "base/win/scoped_com_initializer.h"
41 #endif 43 #endif
42 44
45 using media::AudioParameters;
46 using media::ChannelLayout;
43 using testing::_; 47 using testing::_;
44 using testing::InvokeWithoutArgs; 48 using testing::InvokeWithoutArgs;
45 using testing::Return; 49 using testing::Return;
46 using testing::StrEq; 50 using testing::StrEq;
47 51
48 namespace content { 52 namespace content {
49 53
50 // This class is a mock of the child process singleton which is needed 54 // This class is a mock of the child process singleton which is needed
51 // to be able to create a RenderThread object. 55 // to be able to create a RenderThread object.
52 class WebRTCMockRenderProcess : public RenderProcess { 56 class WebRTCMockRenderProcess : public RenderProcess {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 audio_render_host_->OnChannelClosing(); 259 audio_render_host_->OnChannelClosing();
256 audio_render_host_->OnFilterRemoved(); 260 audio_render_host_->OnFilterRemoved();
257 audio_input_renderer_host_->OnChannelClosing(); 261 audio_input_renderer_host_->OnChannelClosing();
258 audio_input_renderer_host_->OnFilterRemoved(); 262 audio_input_renderer_host_->OnFilterRemoved();
259 channel_.reset(); 263 channel_.reset();
260 audio_render_host_ = NULL; 264 audio_render_host_ = NULL;
261 audio_input_renderer_host_ = NULL; 265 audio_input_renderer_host_ = NULL;
262 } 266 }
263 267
264 void WebRTCAudioDeviceTest::OnGetAudioHardwareConfig( 268 void WebRTCAudioDeviceTest::OnGetAudioHardwareConfig(
265 int* output_buffer_size, int* output_sample_rate, int* input_sample_rate, 269 AudioParameters* input_params, AudioParameters* output_params) {
266 media::ChannelLayout* input_channel_layout) {
267 ASSERT_TRUE(audio_hardware_config_); 270 ASSERT_TRUE(audio_hardware_config_);
268 271 *input_params = audio_hardware_config_->GetInputConfig();
269 *output_buffer_size = audio_hardware_config_->GetOutputBufferSize(); 272 *output_params = audio_hardware_config_->GetOutputConfig();
270 *output_sample_rate = audio_hardware_config_->GetOutputSampleRate();
271
272 // TODO(henrika): add support for all available input devices.
273 *input_sample_rate = audio_hardware_config_->GetInputSampleRate();
274 *input_channel_layout = audio_hardware_config_->GetInputChannelLayout();
275 } 273 }
276 274
277 // IPC::Listener implementation. 275 // IPC::Listener implementation.
278 bool WebRTCAudioDeviceTest::OnMessageReceived(const IPC::Message& message) { 276 bool WebRTCAudioDeviceTest::OnMessageReceived(const IPC::Message& message) {
279 if (render_thread_) { 277 if (render_thread_) {
280 IPC::ChannelProxy::MessageFilter* filter = 278 IPC::ChannelProxy::MessageFilter* filter =
281 render_thread_->audio_input_message_filter(); 279 render_thread_->audio_input_message_filter();
282 if (filter->OnMessageReceived(message)) 280 if (filter->OnMessageReceived(message))
283 return true; 281 return true;
284 282
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { 357 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) {
360 return network_->ReceivedRTPPacket(channel, data, len); 358 return network_->ReceivedRTPPacket(channel, data, len);
361 } 359 }
362 360
363 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, 361 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data,
364 int len) { 362 int len) {
365 return network_->ReceivedRTCPPacket(channel, data, len); 363 return network_->ReceivedRTCPPacket(channel, data, len);
366 } 364 }
367 365
368 } // namespace content 366 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698