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/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 : event_(event) { | 192 : event_(event) { |
193 DCHECK(event_); | 193 DCHECK(event_); |
194 } | 194 } |
195 virtual ~MockWebRtcAudioCapturerSink() {} | 195 virtual ~MockWebRtcAudioCapturerSink() {} |
196 | 196 |
197 // WebRtcAudioCapturerSink implementation. | 197 // WebRtcAudioCapturerSink implementation. |
198 virtual void CaptureData(const int16* audio_data, | 198 virtual void CaptureData(const int16* audio_data, |
199 int number_of_channels, | 199 int number_of_channels, |
200 int number_of_frames, | 200 int number_of_frames, |
201 int audio_delay_milliseconds, | 201 int audio_delay_milliseconds, |
202 double volume) OVERRIDE { | 202 double volume, |
| 203 bool key_pressed) OVERRIDE { |
203 // Signal that a callback has been received. | 204 // Signal that a callback has been received. |
204 event_->Signal(); | 205 event_->Signal(); |
205 } | 206 } |
206 | 207 |
207 // Set the format for the capture audio parameters. | 208 // Set the format for the capture audio parameters. |
208 virtual void SetCaptureFormat( | 209 virtual void SetCaptureFormat( |
209 const media::AudioParameters& params) OVERRIDE {} | 210 const media::AudioParameters& params) OVERRIDE {} |
210 | 211 |
211 private: | 212 private: |
212 base::WaitableEvent* event_; | 213 base::WaitableEvent* event_; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 ReadDataFromSpeechFile(capture_data.get(), length); | 351 ReadDataFromSpeechFile(capture_data.get(), length); |
351 | 352 |
352 // Start the timer. | 353 // Start the timer. |
353 scoped_ptr<uint8[]> buffer(new uint8[output_packet_size]); | 354 scoped_ptr<uint8[]> buffer(new uint8[output_packet_size]); |
354 base::Time start_time = base::Time::Now(); | 355 base::Time start_time = base::Time::Now(); |
355 int delay = 0; | 356 int delay = 0; |
356 for (int j = 0; j < kNumberOfPacketsForLoopbackTest; ++j) { | 357 for (int j = 0; j < kNumberOfPacketsForLoopbackTest; ++j) { |
357 // Sending fake capture data to WebRtc. | 358 // Sending fake capture data to WebRtc. |
358 capturer_sink->CaptureData( | 359 capturer_sink->CaptureData( |
359 reinterpret_cast<int16*>(capture_data.get() + input_packet_size * j), | 360 reinterpret_cast<int16*>(capture_data.get() + input_packet_size * j), |
360 num_input_channels, webrtc_audio_device->input_buffer_size(), | 361 num_input_channels, |
361 kHardwareLatencyInMs, 1.0); | 362 webrtc_audio_device->input_buffer_size(), |
| 363 kHardwareLatencyInMs, |
| 364 1.0, |
| 365 false); |
362 | 366 |
363 // Receiving data from WebRtc. | 367 // Receiving data from WebRtc. |
364 renderer_source->RenderData( | 368 renderer_source->RenderData( |
365 reinterpret_cast<uint8*>(buffer.get()), | 369 reinterpret_cast<uint8*>(buffer.get()), |
366 num_output_channels, webrtc_audio_device->output_buffer_size(), | 370 num_output_channels, webrtc_audio_device->output_buffer_size(), |
367 kHardwareLatencyInMs + delay); | 371 kHardwareLatencyInMs + delay); |
368 delay = (base::Time::Now() - start_time).InMilliseconds(); | 372 delay = (base::Time::Now() - start_time).InMilliseconds(); |
369 } | 373 } |
370 | 374 |
371 int latency = (base::Time::Now() - start_time).InMilliseconds(); | 375 int latency = (base::Time::Now() - start_time).InMilliseconds(); |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 #endif | 939 #endif |
936 | 940 |
937 TEST_F(MAYBE_WebRTCAudioDeviceTest, | 941 TEST_F(MAYBE_WebRTCAudioDeviceTest, |
938 MAYBE_WebRtcLoopbackTimeWithSignalProcessing) { | 942 MAYBE_WebRtcLoopbackTimeWithSignalProcessing) { |
939 int latency = RunWebRtcLoopbackTimeTest(audio_manager_.get(), true); | 943 int latency = RunWebRtcLoopbackTimeTest(audio_manager_.get(), true); |
940 PrintPerfResultMs("webrtc_loopback_with_signal_processing (100 packets)", | 944 PrintPerfResultMs("webrtc_loopback_with_signal_processing (100 packets)", |
941 "t", latency); | 945 "t", latency); |
942 } | 946 } |
943 | 947 |
944 } // namespace content | 948 } // namespace content |
OLD | NEW |