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

Side by Side Diff: media/audio/audio_low_latency_input_output_unittest.cc

Issue 2028053002: Revert of Reland: Forward output glitch information from stream WebRTC log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « media/audio/audio_logging.h ('k') | media/audio/audio_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/bind.h"
11 #include "base/environment.h" 10 #include "base/environment.h"
12 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
13 #include "base/macros.h" 12 #include "base/macros.h"
14 #include "base/path_service.h" 13 #include "base/path_service.h"
15 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
16 #include "base/test/test_timeouts.h" 15 #include "base/test/test_timeouts.h"
17 #include "base/threading/thread_task_runner_handle.h" 16 #include "base/threading/thread_task_runner_handle.h"
18 #include "base/time/time.h" 17 #include "base/time/time.h"
19 #include "build/build_config.h" 18 #include "build/build_config.h"
20 #include "media/audio/audio_device_description.h" 19 #include "media/audio/audio_device_description.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // Size of internal sync buffer. Typical value is ~0 [ms]. 86 // Size of internal sync buffer. Typical value is ~0 [ms].
88 int buffer_delay_ms; 87 int buffer_delay_ms;
89 88
90 // Reported capture/input delay. Typical value is ~10 [ms]. 89 // Reported capture/input delay. Typical value is ~10 [ms].
91 int input_delay_ms; 90 int input_delay_ms;
92 91
93 // Reported render/output delay. Typical value is ~40 [ms]. 92 // Reported render/output delay. Typical value is ~40 [ms].
94 int output_delay_ms; 93 int output_delay_ms;
95 }; 94 };
96 95
97 void OnLogMessage(const std::string& message) {}
98
99 // This class mocks the platform specific audio manager and overrides 96 // This class mocks the platform specific audio manager and overrides
100 // the GetMessageLoop() method to ensure that we can run our tests on 97 // the GetMessageLoop() method to ensure that we can run our tests on
101 // the main thread instead of the audio thread. 98 // the main thread instead of the audio thread.
102 class MockAudioManager : public AudioManagerAnyPlatform { 99 class MockAudioManager : public AudioManagerAnyPlatform {
103 public: 100 public:
104 MockAudioManager() 101 MockAudioManager()
105 : AudioManagerAnyPlatform(base::ThreadTaskRunnerHandle::Get(), 102 : AudioManagerAnyPlatform(base::ThreadTaskRunnerHandle::Get(),
106 base::ThreadTaskRunnerHandle::Get(), 103 base::ThreadTaskRunnerHandle::Get(),
107 &fake_audio_log_factory_) {} 104 &fake_audio_log_factory_) {}
108 ~MockAudioManager() override {} 105 ~MockAudioManager() override {}
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 279
283 static AudioParameters GetDefaultAudioStreamParameters( 280 static AudioParameters GetDefaultAudioStreamParameters(
284 AudioManager* audio_manager) { 281 AudioManager* audio_manager) {
285 return audio_manager->GetInputStreamParameters( 282 return audio_manager->GetInputStreamParameters(
286 AudioDeviceDescription::kDefaultDeviceId); 283 AudioDeviceDescription::kDefaultDeviceId);
287 } 284 }
288 285
289 static StreamType* CreateStream(AudioManager* audio_manager, 286 static StreamType* CreateStream(AudioManager* audio_manager,
290 const AudioParameters& params) { 287 const AudioParameters& params) {
291 return audio_manager->MakeAudioInputStream( 288 return audio_manager->MakeAudioInputStream(
292 params, AudioDeviceDescription::kDefaultDeviceId, 289 params, AudioDeviceDescription::kDefaultDeviceId);
293 base::Bind(&OnLogMessage));
294 } 290 }
295 }; 291 };
296 292
297 class AudioOutputStreamTraits { 293 class AudioOutputStreamTraits {
298 public: 294 public:
299 typedef AudioOutputStream StreamType; 295 typedef AudioOutputStream StreamType;
300 296
301 static AudioParameters GetDefaultAudioStreamParameters( 297 static AudioParameters GetDefaultAudioStreamParameters(
302 AudioManager* audio_manager) { 298 AudioManager* audio_manager) {
303 return audio_manager->GetDefaultOutputStreamParameters(); 299 return audio_manager->GetDefaultOutputStreamParameters();
304 } 300 }
305 301
306 static StreamType* CreateStream(AudioManager* audio_manager, 302 static StreamType* CreateStream(AudioManager* audio_manager,
307 const AudioParameters& params) { 303 const AudioParameters& params) {
308 return audio_manager->MakeAudioOutputStream(params, std::string(), 304 return audio_manager->MakeAudioOutputStream(params, std::string());
309 base::Bind(&OnLogMessage));
310 } 305 }
311 }; 306 };
312 307
313 // Traits template holding a trait of StreamType. It encapsulates 308 // Traits template holding a trait of StreamType. It encapsulates
314 // AudioInputStream and AudioOutputStream stream types. 309 // AudioInputStream and AudioOutputStream stream types.
315 template <typename StreamTraits> 310 template <typename StreamTraits>
316 class StreamWrapper { 311 class StreamWrapper {
317 public: 312 public:
318 typedef typename StreamTraits::StreamType StreamType; 313 typedef typename StreamTraits::StreamType StreamType;
319 314
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 434
440 // All Close() operations that run on the mocked audio thread, 435 // All Close() operations that run on the mocked audio thread,
441 // should be synchronous and not post additional close tasks to 436 // should be synchronous and not post additional close tasks to
442 // mocked the audio thread. Hence, there is no need to call 437 // mocked the audio thread. Hence, there is no need to call
443 // message_loop()->RunUntilIdle() after the Close() methods. 438 // message_loop()->RunUntilIdle() after the Close() methods.
444 aos->Close(); 439 aos->Close();
445 ais->Close(); 440 ais->Close();
446 } 441 }
447 442
448 } // namespace media 443 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_logging.h ('k') | media/audio/audio_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698