Chromium Code Reviews| Index: media/audio/audio_low_latency_input_output_unittest.cc |
| diff --git a/media/audio/audio_low_latency_input_output_unittest.cc b/media/audio/audio_low_latency_input_output_unittest.cc |
| index e4cb177cd76eeba4075d283b86f242eac244edc8..b23feb03cce092bc01f05f3829a12f80106e5577 100644 |
| --- a/media/audio/audio_low_latency_input_output_unittest.cc |
| +++ b/media/audio/audio_low_latency_input_output_unittest.cc |
| @@ -46,22 +46,22 @@ |
| #include "media/audio/fake_audio_manager.h" |
| #endif |
| -namespace media { |
| +namespace { |
|
tommi (sloooow) - chröme
2017/05/10 17:54:02
what about moving this anonymous namespace into me
eugenis
2017/05/10 18:30:54
Yes, that's a lot better!
|
| #if defined(USE_PULSEAUDIO) |
| -typedef AudioManagerPulse AudioManagerAnyPlatform; |
| +typedef media::AudioManagerPulse AudioManagerAnyPlatform; |
| #elif defined(USE_ALSA) |
| -typedef AudioManagerAlsa AudioManagerAnyPlatform; |
| +typedef media::AudioManagerAlsa AudioManagerAnyPlatform; |
| #elif defined(USE_CRAS) |
| -typedef AudioManagerCras AudioManagerAnyPlatform; |
| +typedef media::AudioManagerCras AudioManagerAnyPlatform; |
| #elif defined(OS_MACOSX) |
| -typedef AudioManagerMac AudioManagerAnyPlatform; |
| +typedef media::AudioManagerMac AudioManagerAnyPlatform; |
| #elif defined(OS_WIN) |
| -typedef AudioManagerWin AudioManagerAnyPlatform; |
| +typedef media::AudioManagerWin AudioManagerAnyPlatform; |
| #elif defined(OS_ANDROID) |
| -typedef AudioManagerAndroid AudioManagerAnyPlatform; |
| +typedef media::AudioManagerAndroid AudioManagerAnyPlatform; |
| #else |
| -typedef FakeAudioManager AudioManagerAnyPlatform; |
| +typedef media::FakeAudioManager AudioManagerAnyPlatform; |
| #endif |
| // Limits the number of delay measurements we can store in an array and |
| @@ -112,7 +112,7 @@ class MockAudioManager : public AudioManagerAnyPlatform { |
| ~MockAudioManager() override {} |
| private: |
| - FakeAudioLogFactory fake_audio_log_factory_; |
| + media::FakeAudioLogFactory fake_audio_log_factory_; |
| DISALLOW_COPY_AND_ASSIGN(MockAudioManager); |
| }; |
| @@ -123,7 +123,7 @@ class AudioLowLatencyInputOutputTest : public testing::Test { |
| ~AudioLowLatencyInputOutputTest() override {} |
| - AudioManager* audio_manager() { return &mock_audio_manager_; } |
| + media::AudioManager* audio_manager() { return &mock_audio_manager_; } |
| base::MessageLoopForUI* message_loop() { return &message_loop_; } |
| private: |
| @@ -140,8 +140,8 @@ class AudioLowLatencyInputOutputTest : public testing::Test { |
| // The total effect is that recorded audio is played out in loop back using |
| // a sync buffer as temporary storage. |
| class FullDuplexAudioSinkSource |
| - : public AudioInputStream::AudioInputCallback, |
| - public AudioOutputStream::AudioSourceCallback { |
| + : public media::AudioInputStream::AudioInputCallback, |
| + public media::AudioOutputStream::AudioSourceCallback { |
| public: |
| FullDuplexAudioSinkSource(int sample_rate, |
| int samples_per_packet, |
| @@ -193,8 +193,8 @@ class FullDuplexAudioSinkSource |
| } |
| // AudioInputStream::AudioInputCallback. |
| - void OnData(AudioInputStream* stream, |
| - const AudioBus* src, |
| + void OnData(media::AudioInputStream* stream, |
| + const media::AudioBus* src, |
| uint32_t hardware_delay_bytes, |
| double volume) override { |
| base::AutoLock lock(lock_); |
| @@ -224,13 +224,13 @@ class FullDuplexAudioSinkSource |
| // } |
| } |
| - void OnError(AudioInputStream* stream) override {} |
| + void OnError(media::AudioInputStream* stream) override {} |
| // AudioOutputStream::AudioSourceCallback. |
| int OnMoreData(base::TimeDelta delay, |
| base::TimeTicks /* delay_timestamp */, |
| int /* prior_frames_skipped */, |
| - AudioBus* dest) override { |
| + media::AudioBus* dest) override { |
| base::AutoLock lock(lock_); |
| // Update one component in the AudioDelayState for the packet |
| @@ -258,7 +258,7 @@ class FullDuplexAudioSinkSource |
| return 0; |
| } |
| - void OnError(AudioOutputStream* stream) override {} |
| + void OnError(media::AudioOutputStream* stream) override {} |
| protected: |
| // Converts from bytes to milliseconds taking the sample rate and size |
| @@ -283,34 +283,35 @@ class FullDuplexAudioSinkSource |
| class AudioInputStreamTraits { |
| public: |
| - typedef AudioInputStream StreamType; |
| + typedef media::AudioInputStream StreamType; |
| - static AudioParameters GetDefaultAudioStreamParameters( |
| - AudioManager* audio_manager) { |
| - return AudioDeviceInfoAccessorForTests(audio_manager) |
| - .GetInputStreamParameters(AudioDeviceDescription::kDefaultDeviceId); |
| + static media::AudioParameters GetDefaultAudioStreamParameters( |
| + media::AudioManager* audio_manager) { |
| + return media::AudioDeviceInfoAccessorForTests(audio_manager) |
| + .GetInputStreamParameters( |
| + media::AudioDeviceDescription::kDefaultDeviceId); |
| } |
| - static StreamType* CreateStream(AudioManager* audio_manager, |
| - const AudioParameters& params) { |
| + static StreamType* CreateStream(media::AudioManager* audio_manager, |
| + const media::AudioParameters& params) { |
| return audio_manager->MakeAudioInputStream( |
| - params, AudioDeviceDescription::kDefaultDeviceId, |
| + params, media::AudioDeviceDescription::kDefaultDeviceId, |
| base::Bind(&OnLogMessage)); |
| } |
| }; |
| class AudioOutputStreamTraits { |
| public: |
| - typedef AudioOutputStream StreamType; |
| + typedef media::AudioOutputStream StreamType; |
| - static AudioParameters GetDefaultAudioStreamParameters( |
| - AudioManager* audio_manager) { |
| - return AudioDeviceInfoAccessorForTests(audio_manager) |
| + static media::AudioParameters GetDefaultAudioStreamParameters( |
| + media::AudioManager* audio_manager) { |
| + return media::AudioDeviceInfoAccessorForTests(audio_manager) |
| .GetDefaultOutputStreamParameters(); |
| } |
| - static StreamType* CreateStream(AudioManager* audio_manager, |
| - const AudioParameters& params) { |
| + static StreamType* CreateStream(media::AudioManager* audio_manager, |
| + const media::AudioParameters& params) { |
| return audio_manager->MakeAudioOutputStream(params, std::string(), |
| base::Bind(&OnLogMessage)); |
| } |
| @@ -323,18 +324,17 @@ class StreamWrapper { |
| public: |
| typedef typename StreamTraits::StreamType StreamType; |
| - explicit StreamWrapper(AudioManager* audio_manager) |
| - : |
| - audio_manager_(audio_manager), |
| - format_(AudioParameters::AUDIO_PCM_LOW_LATENCY), |
| + explicit StreamWrapper(media::AudioManager* audio_manager) |
| + : audio_manager_(audio_manager), |
| + format_(media::AudioParameters::AUDIO_PCM_LOW_LATENCY), |
| #if defined(OS_ANDROID) |
| - channel_layout_(CHANNEL_LAYOUT_MONO), |
| + channel_layout_(media::CHANNEL_LAYOUT_MONO), |
| #else |
| - channel_layout_(CHANNEL_LAYOUT_STEREO), |
| + channel_layout_(media::CHANNEL_LAYOUT_STEREO), |
| #endif |
| bits_per_sample_(16) { |
| // Use the preferred sample rate. |
| - const AudioParameters& params = |
| + const media::AudioParameters& params = |
| StreamTraits::GetDefaultAudioStreamParameters(audio_manager_); |
| sample_rate_ = params.sample_rate(); |
| @@ -360,16 +360,17 @@ class StreamWrapper { |
| private: |
| StreamType* CreateStream() { |
| - StreamType* stream = StreamTraits::CreateStream(audio_manager_, |
| - AudioParameters(format_, channel_layout_, sample_rate_, |
| - bits_per_sample_, samples_per_packet_)); |
| + StreamType* stream = StreamTraits::CreateStream( |
| + audio_manager_, |
| + media::AudioParameters(format_, channel_layout_, sample_rate_, |
| + bits_per_sample_, samples_per_packet_)); |
| EXPECT_TRUE(stream); |
| return stream; |
| } |
| - AudioManager* audio_manager_; |
| - AudioParameters::Format format_; |
| - ChannelLayout channel_layout_; |
| + media::AudioManager* audio_manager_; |
| + media::AudioParameters::Format format_; |
| + media::ChannelLayout channel_layout_; |
| int bits_per_sample_; |
| int sample_rate_; |
| int samples_per_packet_; |
| @@ -392,16 +393,16 @@ typedef StreamWrapper<AudioOutputStreamTraits> AudioOutputStreamWrapper; |
| // ylabel('delay [msec]') |
| // title('Full-duplex audio delay measurement'); |
| TEST_F(AudioLowLatencyInputOutputTest, DISABLED_FullDuplexDelayMeasurement) { |
| - AudioDeviceInfoAccessorForTests device_info_accessor(audio_manager()); |
| + media::AudioDeviceInfoAccessorForTests device_info_accessor(audio_manager()); |
| ABORT_AUDIO_TEST_IF_NOT(device_info_accessor.HasAudioInputDevices() && |
| device_info_accessor.HasAudioOutputDevices()); |
| AudioInputStreamWrapper aisw(audio_manager()); |
| - AudioInputStream* ais = aisw.Create(); |
| + media::AudioInputStream* ais = aisw.Create(); |
| EXPECT_TRUE(ais); |
| AudioOutputStreamWrapper aosw(audio_manager()); |
| - AudioOutputStream* aos = aosw.Create(); |
| + media::AudioOutputStream* aos = aosw.Create(); |
| EXPECT_TRUE(aos); |
| // This test only supports identical parameters in both directions. |
| @@ -452,4 +453,4 @@ TEST_F(AudioLowLatencyInputOutputTest, DISABLED_FullDuplexDelayMeasurement) { |
| ais->Close(); |
| } |
| -} // namespace media |
| +} // namespace |