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

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

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