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 "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" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 *sample_rate = audio_util_callback_ ? | 228 *sample_rate = audio_util_callback_ ? |
229 audio_util_callback_->GetAudioHardwareSampleRate() : 0.0; | 229 audio_util_callback_->GetAudioHardwareSampleRate() : 0.0; |
230 } | 230 } |
231 | 231 |
232 void WebRTCAudioDeviceTest::OnGetHardwareInputSampleRate(double* sample_rate) { | 232 void WebRTCAudioDeviceTest::OnGetHardwareInputSampleRate(double* sample_rate) { |
233 EXPECT_TRUE(audio_util_callback_); | 233 EXPECT_TRUE(audio_util_callback_); |
234 *sample_rate = audio_util_callback_ ? | 234 *sample_rate = audio_util_callback_ ? |
235 audio_util_callback_->GetAudioInputHardwareSampleRate() : 0.0; | 235 audio_util_callback_->GetAudioInputHardwareSampleRate() : 0.0; |
236 } | 236 } |
237 | 237 |
| 238 void WebRTCAudioDeviceTest::OnGetHardwareInputChannelCount(uint32* channels) { |
| 239 EXPECT_TRUE(audio_util_callback_); |
| 240 *channels = audio_util_callback_ ? |
| 241 audio_util_callback_->GetAudioInputHardwareChannelCount() : 0; |
| 242 } |
| 243 |
238 // IPC::Channel::Listener implementation. | 244 // IPC::Channel::Listener implementation. |
239 bool WebRTCAudioDeviceTest::OnMessageReceived(const IPC::Message& message) { | 245 bool WebRTCAudioDeviceTest::OnMessageReceived(const IPC::Message& message) { |
240 if (render_thread_) { | 246 if (render_thread_) { |
241 IPC::ChannelProxy::MessageFilter* filter = | 247 IPC::ChannelProxy::MessageFilter* filter = |
242 render_thread_->audio_input_message_filter(); | 248 render_thread_->audio_input_message_filter(); |
243 if (filter->OnMessageReceived(message)) | 249 if (filter->OnMessageReceived(message)) |
244 return true; | 250 return true; |
245 | 251 |
246 filter = render_thread_->audio_message_filter(); | 252 filter = render_thread_->audio_message_filter(); |
247 if (filter->OnMessageReceived(message)) | 253 if (filter->OnMessageReceived(message)) |
(...skipping 12 matching lines...) Expand all Loading... |
260 return true; | 266 return true; |
261 } | 267 } |
262 | 268 |
263 bool handled ALLOW_UNUSED = true; | 269 bool handled ALLOW_UNUSED = true; |
264 bool message_is_ok = true; | 270 bool message_is_ok = true; |
265 IPC_BEGIN_MESSAGE_MAP_EX(WebRTCAudioDeviceTest, message, message_is_ok) | 271 IPC_BEGIN_MESSAGE_MAP_EX(WebRTCAudioDeviceTest, message, message_is_ok) |
266 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareSampleRate, | 272 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareSampleRate, |
267 OnGetHardwareSampleRate) | 273 OnGetHardwareSampleRate) |
268 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareInputSampleRate, | 274 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareInputSampleRate, |
269 OnGetHardwareInputSampleRate) | 275 OnGetHardwareInputSampleRate) |
| 276 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareInputChannelCount, |
| 277 OnGetHardwareInputChannelCount) |
270 IPC_MESSAGE_UNHANDLED(handled = false) | 278 IPC_MESSAGE_UNHANDLED(handled = false) |
271 IPC_END_MESSAGE_MAP_EX() | 279 IPC_END_MESSAGE_MAP_EX() |
272 | 280 |
273 EXPECT_TRUE(message_is_ok); | 281 EXPECT_TRUE(message_is_ok); |
274 | 282 |
275 return true; | 283 return true; |
276 } | 284 } |
277 | 285 |
278 // Posts a final task to the IO message loop and waits for completion. | 286 // Posts a final task to the IO message loop and waits for completion. |
279 void WebRTCAudioDeviceTest::WaitForIOThreadCompletion() { | 287 void WebRTCAudioDeviceTest::WaitForIOThreadCompletion() { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 WebRTCTransportImpl::~WebRTCTransportImpl() {} | 329 WebRTCTransportImpl::~WebRTCTransportImpl() {} |
322 | 330 |
323 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { | 331 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { |
324 return network_->ReceivedRTPPacket(channel, data, len); | 332 return network_->ReceivedRTPPacket(channel, data, len); |
325 } | 333 } |
326 | 334 |
327 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, | 335 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, |
328 int len) { | 336 int len) { |
329 return network_->ReceivedRTCPPacket(channel, data, len); | 337 return network_->ReceivedRTCPPacket(channel, data, len); |
330 } | 338 } |
OLD | NEW |