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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 205 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
206 audio_render_host_->OnChannelClosing(); | 206 audio_render_host_->OnChannelClosing(); |
207 audio_render_host_->OnFilterRemoved(); | 207 audio_render_host_->OnFilterRemoved(); |
208 audio_input_renderer_host_->OnChannelClosing(); | 208 audio_input_renderer_host_->OnChannelClosing(); |
209 audio_input_renderer_host_->OnFilterRemoved(); | 209 audio_input_renderer_host_->OnFilterRemoved(); |
210 channel_.reset(); | 210 channel_.reset(); |
211 audio_render_host_ = NULL; | 211 audio_render_host_ = NULL; |
212 audio_input_renderer_host_ = NULL; | 212 audio_input_renderer_host_ = NULL; |
213 } | 213 } |
214 | 214 |
215 void WebRTCAudioDeviceTest::OnGetHardwareSampleRate(double* sample_rate) { | 215 void WebRTCAudioDeviceTest::OnGetHardwareSampleRate(int* sample_rate) { |
216 EXPECT_TRUE(audio_util_callback_); | 216 EXPECT_TRUE(audio_util_callback_); |
217 *sample_rate = audio_util_callback_ ? | 217 *sample_rate = audio_util_callback_ ? |
218 audio_util_callback_->GetAudioHardwareSampleRate() : 0.0; | 218 audio_util_callback_->GetAudioHardwareSampleRate() : 0; |
219 } | 219 } |
220 | 220 |
221 void WebRTCAudioDeviceTest::OnGetHardwareInputSampleRate(double* sample_rate) { | 221 void WebRTCAudioDeviceTest::OnGetHardwareInputSampleRate(int* sample_rate) { |
222 EXPECT_TRUE(audio_util_callback_); | 222 EXPECT_TRUE(audio_util_callback_); |
223 *sample_rate = audio_util_callback_ ? | 223 *sample_rate = audio_util_callback_ ? |
224 audio_util_callback_->GetAudioInputHardwareSampleRate( | 224 audio_util_callback_->GetAudioInputHardwareSampleRate( |
225 AudioManagerBase::kDefaultDeviceId) : 0.0; | |
226 } | |
227 | |
228 void WebRTCAudioDeviceTest::OnGetHardwareInputChannelCount(uint32* channels) { | |
229 EXPECT_TRUE(audio_util_callback_); | |
230 *channels = audio_util_callback_ ? | |
231 audio_util_callback_->GetAudioInputHardwareChannelCount( | |
232 AudioManagerBase::kDefaultDeviceId) : 0; | 225 AudioManagerBase::kDefaultDeviceId) : 0; |
233 } | 226 } |
234 | 227 |
| 228 void WebRTCAudioDeviceTest::OnGetHardwareInputChannelLayout( |
| 229 ChannelLayout* layout) { |
| 230 EXPECT_TRUE(audio_util_callback_); |
| 231 *layout = audio_util_callback_ ? |
| 232 audio_util_callback_->GetAudioInputHardwareChannelLayout( |
| 233 AudioManagerBase::kDefaultDeviceId) : CHANNEL_LAYOUT_NONE; |
| 234 } |
| 235 |
235 // IPC::Channel::Listener implementation. | 236 // IPC::Channel::Listener implementation. |
236 bool WebRTCAudioDeviceTest::OnMessageReceived(const IPC::Message& message) { | 237 bool WebRTCAudioDeviceTest::OnMessageReceived(const IPC::Message& message) { |
237 if (render_thread_) { | 238 if (render_thread_) { |
238 IPC::ChannelProxy::MessageFilter* filter = | 239 IPC::ChannelProxy::MessageFilter* filter = |
239 render_thread_->audio_input_message_filter(); | 240 render_thread_->audio_input_message_filter(); |
240 if (filter->OnMessageReceived(message)) | 241 if (filter->OnMessageReceived(message)) |
241 return true; | 242 return true; |
242 | 243 |
243 filter = render_thread_->audio_message_filter(); | 244 filter = render_thread_->audio_message_filter(); |
244 if (filter->OnMessageReceived(message)) | 245 if (filter->OnMessageReceived(message)) |
(...skipping 12 matching lines...) Expand all Loading... |
257 return true; | 258 return true; |
258 } | 259 } |
259 | 260 |
260 bool handled ALLOW_UNUSED = true; | 261 bool handled ALLOW_UNUSED = true; |
261 bool message_is_ok = true; | 262 bool message_is_ok = true; |
262 IPC_BEGIN_MESSAGE_MAP_EX(WebRTCAudioDeviceTest, message, message_is_ok) | 263 IPC_BEGIN_MESSAGE_MAP_EX(WebRTCAudioDeviceTest, message, message_is_ok) |
263 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareSampleRate, | 264 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareSampleRate, |
264 OnGetHardwareSampleRate) | 265 OnGetHardwareSampleRate) |
265 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareInputSampleRate, | 266 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareInputSampleRate, |
266 OnGetHardwareInputSampleRate) | 267 OnGetHardwareInputSampleRate) |
267 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareInputChannelCount, | 268 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareInputChannelLayout, |
268 OnGetHardwareInputChannelCount) | 269 OnGetHardwareInputChannelLayout) |
269 IPC_MESSAGE_UNHANDLED(handled = false) | 270 IPC_MESSAGE_UNHANDLED(handled = false) |
270 IPC_END_MESSAGE_MAP_EX() | 271 IPC_END_MESSAGE_MAP_EX() |
271 | 272 |
272 EXPECT_TRUE(message_is_ok); | 273 EXPECT_TRUE(message_is_ok); |
273 | 274 |
274 return true; | 275 return true; |
275 } | 276 } |
276 | 277 |
277 // Posts a final task to the IO message loop and waits for completion. | 278 // Posts a final task to the IO message loop and waits for completion. |
278 void WebRTCAudioDeviceTest::WaitForIOThreadCompletion() { | 279 void WebRTCAudioDeviceTest::WaitForIOThreadCompletion() { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 WebRTCTransportImpl::~WebRTCTransportImpl() {} | 321 WebRTCTransportImpl::~WebRTCTransportImpl() {} |
321 | 322 |
322 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { | 323 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { |
323 return network_->ReceivedRTPPacket(channel, data, len); | 324 return network_->ReceivedRTPPacket(channel, data, len); |
324 } | 325 } |
325 | 326 |
326 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, | 327 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, |
327 int len) { | 328 int len) { |
328 return network_->ReceivedRTCPPacket(channel, data, len); | 329 return network_->ReceivedRTCPPacket(channel, data, len); |
329 } | 330 } |
OLD | NEW |