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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/environment.h" | 7 #include "base/environment.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 virtual ~MockWebRtcAudioCapturerSink() {} | 214 virtual ~MockWebRtcAudioCapturerSink() {} |
215 | 215 |
216 // WebRtcAudioCapturerSink implementation. | 216 // WebRtcAudioCapturerSink implementation. |
217 virtual int CaptureData(const std::vector<int>& channels, | 217 virtual int CaptureData(const std::vector<int>& channels, |
218 const int16* audio_data, | 218 const int16* audio_data, |
219 int sample_rate, | 219 int sample_rate, |
220 int number_of_channels, | 220 int number_of_channels, |
221 int number_of_frames, | 221 int number_of_frames, |
222 int audio_delay_milliseconds, | 222 int audio_delay_milliseconds, |
223 int current_volume, | 223 int current_volume, |
224 bool need_audio_processing) OVERRIDE { | 224 bool need_audio_processing, |
| 225 bool key_pressed) OVERRIDE { |
225 // Signal that a callback has been received. | 226 // Signal that a callback has been received. |
226 event_->Signal(); | 227 event_->Signal(); |
227 return 0; | 228 return 0; |
228 } | 229 } |
229 | 230 |
230 // Set the format for the capture audio parameters. | 231 // Set the format for the capture audio parameters. |
231 virtual void SetCaptureFormat( | 232 virtual void SetCaptureFormat( |
232 const media::AudioParameters& params) OVERRIDE {} | 233 const media::AudioParameters& params) OVERRIDE {} |
233 | 234 |
234 private: | 235 private: |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 scoped_ptr<uint8[]> buffer(new uint8[output_packet_size]); | 375 scoped_ptr<uint8[]> buffer(new uint8[output_packet_size]); |
375 base::Time start_time = base::Time::Now(); | 376 base::Time start_time = base::Time::Now(); |
376 int delay = 0; | 377 int delay = 0; |
377 std::vector<int> voe_channels; | 378 std::vector<int> voe_channels; |
378 voe_channels.push_back(channel); | 379 voe_channels.push_back(channel); |
379 for (int j = 0; j < kNumberOfPacketsForLoopbackTest; ++j) { | 380 for (int j = 0; j < kNumberOfPacketsForLoopbackTest; ++j) { |
380 // Sending fake capture data to WebRtc. | 381 // Sending fake capture data to WebRtc. |
381 capturer_sink->CaptureData( | 382 capturer_sink->CaptureData( |
382 voe_channels, | 383 voe_channels, |
383 reinterpret_cast<int16*>(capture_data.get() + input_packet_size * j), | 384 reinterpret_cast<int16*>(capture_data.get() + input_packet_size * j), |
384 params.sample_rate(), params.channels(), params.frames_per_buffer(), | 385 params.sample_rate(), |
385 kHardwareLatencyInMs, 1.0, enable_apm); | 386 params.channels(), |
| 387 params.frames_per_buffer(), |
| 388 kHardwareLatencyInMs, |
| 389 1.0, |
| 390 enable_apm, |
| 391 false); |
386 | 392 |
387 // Receiving data from WebRtc. | 393 // Receiving data from WebRtc. |
388 renderer_source->RenderData( | 394 renderer_source->RenderData( |
389 reinterpret_cast<uint8*>(buffer.get()), | 395 reinterpret_cast<uint8*>(buffer.get()), |
390 num_output_channels, webrtc_audio_device->output_buffer_size(), | 396 num_output_channels, webrtc_audio_device->output_buffer_size(), |
391 kHardwareLatencyInMs + delay); | 397 kHardwareLatencyInMs + delay); |
392 delay = (base::Time::Now() - start_time).InMilliseconds(); | 398 delay = (base::Time::Now() - start_time).InMilliseconds(); |
393 } | 399 } |
394 | 400 |
395 int latency = (base::Time::Now() - start_time).InMilliseconds(); | 401 int latency = (base::Time::Now() - start_time).InMilliseconds(); |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 #endif | 965 #endif |
960 | 966 |
961 TEST_F(MAYBE_WebRTCAudioDeviceTest, | 967 TEST_F(MAYBE_WebRTCAudioDeviceTest, |
962 MAYBE_WebRtcLoopbackTimeWithSignalProcessing) { | 968 MAYBE_WebRtcLoopbackTimeWithSignalProcessing) { |
963 int latency = RunWebRtcLoopbackTimeTest(audio_manager_.get(), true); | 969 int latency = RunWebRtcLoopbackTimeTest(audio_manager_.get(), true); |
964 PrintPerfResultMs("webrtc_loopback_with_signal_processing (100 packets)", | 970 PrintPerfResultMs("webrtc_loopback_with_signal_processing (100 packets)", |
965 "t", latency); | 971 "t", latency); |
966 } | 972 } |
967 | 973 |
968 } // namespace content | 974 } // namespace content |
OLD | NEW |