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

Side by Side Diff: trunk/src/content/renderer/media/webrtc_audio_device_unittest.cc

Issue 22871007: Revert 217768 "Adding key press detection in the browser process." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 4 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 <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
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, 224 bool need_audio_processing) OVERRIDE {
225 bool key_pressed) OVERRIDE {
226 // Signal that a callback has been received. 225 // Signal that a callback has been received.
227 event_->Signal(); 226 event_->Signal();
228 return 0; 227 return 0;
229 } 228 }
230 229
231 // Set the format for the capture audio parameters. 230 // Set the format for the capture audio parameters.
232 virtual void SetCaptureFormat( 231 virtual void SetCaptureFormat(
233 const media::AudioParameters& params) OVERRIDE {} 232 const media::AudioParameters& params) OVERRIDE {}
234 233
235 private: 234 private:
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 scoped_ptr<uint8[]> buffer(new uint8[output_packet_size]); 374 scoped_ptr<uint8[]> buffer(new uint8[output_packet_size]);
376 base::Time start_time = base::Time::Now(); 375 base::Time start_time = base::Time::Now();
377 int delay = 0; 376 int delay = 0;
378 std::vector<int> voe_channels; 377 std::vector<int> voe_channels;
379 voe_channels.push_back(channel); 378 voe_channels.push_back(channel);
380 for (int j = 0; j < kNumberOfPacketsForLoopbackTest; ++j) { 379 for (int j = 0; j < kNumberOfPacketsForLoopbackTest; ++j) {
381 // Sending fake capture data to WebRtc. 380 // Sending fake capture data to WebRtc.
382 capturer_sink->CaptureData( 381 capturer_sink->CaptureData(
383 voe_channels, 382 voe_channels,
384 reinterpret_cast<int16*>(capture_data.get() + input_packet_size * j), 383 reinterpret_cast<int16*>(capture_data.get() + input_packet_size * j),
385 params.sample_rate(), 384 params.sample_rate(), params.channels(), params.frames_per_buffer(),
386 params.channels(), 385 kHardwareLatencyInMs, 1.0, enable_apm);
387 params.frames_per_buffer(),
388 kHardwareLatencyInMs,
389 1.0,
390 enable_apm,
391 false);
392 386
393 // Receiving data from WebRtc. 387 // Receiving data from WebRtc.
394 renderer_source->RenderData( 388 renderer_source->RenderData(
395 reinterpret_cast<uint8*>(buffer.get()), 389 reinterpret_cast<uint8*>(buffer.get()),
396 num_output_channels, webrtc_audio_device->output_buffer_size(), 390 num_output_channels, webrtc_audio_device->output_buffer_size(),
397 kHardwareLatencyInMs + delay); 391 kHardwareLatencyInMs + delay);
398 delay = (base::Time::Now() - start_time).InMilliseconds(); 392 delay = (base::Time::Now() - start_time).InMilliseconds();
399 } 393 }
400 394
401 int latency = (base::Time::Now() - start_time).InMilliseconds(); 395 int latency = (base::Time::Now() - start_time).InMilliseconds();
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 #endif 959 #endif
966 960
967 TEST_F(MAYBE_WebRTCAudioDeviceTest, 961 TEST_F(MAYBE_WebRTCAudioDeviceTest,
968 MAYBE_WebRtcLoopbackTimeWithSignalProcessing) { 962 MAYBE_WebRtcLoopbackTimeWithSignalProcessing) {
969 int latency = RunWebRtcLoopbackTimeTest(audio_manager_.get(), true); 963 int latency = RunWebRtcLoopbackTimeTest(audio_manager_.get(), true);
970 PrintPerfResultMs("webrtc_loopback_with_signal_processing (100 packets)", 964 PrintPerfResultMs("webrtc_loopback_with_signal_processing (100 packets)",
971 "t", latency); 965 "t", latency);
972 } 966 }
973 967
974 } // namespace content 968 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698