diff options
32 files changed, 166 insertions, 160 deletions
diff --git a/chrome/browser/renderer_host/audio_renderer_host.h b/chrome/browser/renderer_host/audio_renderer_host.h index b9ee30f..cbb2ef9 100644 --- a/chrome/browser/renderer_host/audio_renderer_host.h +++ b/chrome/browser/renderer_host/audio_renderer_host.h @@ -68,7 +68,7 @@ #include "base/waitable_event.h" #include "chrome/browser/chrome_thread.h" #include "ipc/ipc_message.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" #include "media/audio/audio_output_controller.h" #include "media/audio/simple_sources.h" diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 37658a5..430caff 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -35,7 +35,7 @@ #include "googleurl/src/gurl.h" #include "ipc/ipc_message_utils.h" #include "ipc/ipc_platform_file.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" #include "net/base/upload_data.h" #include "net/http/http_response_headers.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h" diff --git a/chrome/renderer/media/audio_renderer_impl.h b/chrome/renderer/media/audio_renderer_impl.h index 8bc6d3c..a0e99d8 100644 --- a/chrome/renderer/media/audio_renderer_impl.h +++ b/chrome/renderer/media/audio_renderer_impl.h @@ -96,7 +96,7 @@ #include "base/shared_memory.h" #include "base/waitable_event.h" #include "chrome/renderer/audio_message_filter.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" #include "media/base/factory.h" #include "media/base/filters.h" #include "media/filters/audio_renderer_base.h" diff --git a/media/audio/audio_output.h b/media/audio/audio_io.h index 6b87a68..990f7c1 100644 --- a/media/audio/audio_output.h +++ b/media/audio/audio_io.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_AUDIO_AUDIO_OUTPUT_H_ -#define MEDIA_AUDIO_AUDIO_OUTPUT_H_ +#ifndef MEDIA_AUDIO_AUDIO_IO_H_ +#define MEDIA_AUDIO_AUDIO_IO_H_ #include "base/basictypes.h" @@ -128,7 +128,7 @@ class AudioManager { // Returns true if the OS reports existence of audio devices. This does not // guarantee that the existing devices support all formats and sample rates. - virtual bool HasAudioDevices() = 0; + virtual bool HasAudioOutputDevices() = 0; // Factory for all the supported stream formats. The |channels| can be 1 to 5. // The |sample_rate| is in hertz and can be any value supported by the @@ -143,9 +143,9 @@ class AudioManager { // available. // // Do not free the returned AudioOutputStream. It is owned by AudioManager. - virtual AudioOutputStream* MakeAudioStream(Format format, int channels, - int sample_rate, - char bits_per_sample) = 0; + virtual AudioOutputStream* MakeAudioOutputStream(Format format, int channels, + int sample_rate, + char bits_per_sample) = 0; // Muting continues playback but effectively the volume is set to zero. // Un-muting returns the volume to the previous level. @@ -161,4 +161,4 @@ class AudioManager { }; -#endif // MEDIA_AUDIO_AUDIO_OUTPUT_H_ +#endif // MEDIA_AUDIO_AUDIO_IO_H_ diff --git a/media/audio/audio_output_controller.cc b/media/audio/audio_output_controller.cc index 62cf148..ffdfaa1 100644 --- a/media/audio/audio_output_controller.cc +++ b/media/audio/audio_output_controller.cc @@ -163,7 +163,7 @@ void AudioOutputController::DoCreate(AudioManager::Format format, int channels, DCHECK_EQ(kEmpty, state_); // Create the stream in the first place. - stream_ = AudioManager::GetAudioManager()->MakeAudioStream( + stream_ = AudioManager::GetAudioManager()->MakeAudioOutputStream( format, channels, sample_rate, bits_per_sample); if (!stream_) { diff --git a/media/audio/audio_output_controller.h b/media/audio/audio_output_controller.h index d1111da..10e3d03 100644 --- a/media/audio/audio_output_controller.h +++ b/media/audio/audio_output_controller.h @@ -10,7 +10,7 @@ #include "base/scoped_ptr.h" #include "base/thread.h" #include "base/time.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" #include "media/audio/simple_sources.h" // An AudioOutputController controls an AudioOutputStream and provides data diff --git a/media/audio/audio_output_controller_unittest.cc b/media/audio/audio_output_controller_unittest.cc index b3d4233..0783b09 100644 --- a/media/audio/audio_output_controller_unittest.cc +++ b/media/audio/audio_output_controller_unittest.cc @@ -55,10 +55,10 @@ class MockAudioOutputControllerSyncReader DISALLOW_COPY_AND_ASSIGN(MockAudioOutputControllerSyncReader); }; -static bool HasAudioDevices() { +static bool HasAudioOutputDevices() { AudioManager* audio_man = AudioManager::GetAudioManager(); CHECK(audio_man); - return audio_man->HasAudioDevices(); + return audio_man->HasAudioOutputDevices(); } static bool IsRunningHeadless() { @@ -75,7 +75,7 @@ ACTION_P3(SignalEvent, event, count, limit) { } TEST(AudioOutputControllerTest, CreateAndClose) { - if (!HasAudioDevices() || IsRunningHeadless()) + if (!HasAudioOutputDevices() || IsRunningHeadless()) return; MockAudioOutputControllerEventHandler event_handler; @@ -95,7 +95,7 @@ TEST(AudioOutputControllerTest, CreateAndClose) { } TEST(AudioOutputControllerTest, PlayAndClose) { - if (!HasAudioDevices() || IsRunningHeadless()) + if (!HasAudioOutputDevices() || IsRunningHeadless()) return; MockAudioOutputControllerEventHandler event_handler; @@ -140,7 +140,7 @@ TEST(AudioOutputControllerTest, PlayAndClose) { } TEST(AudioOutputControllerTest, PlayPauseClose) { - if (!HasAudioDevices() || IsRunningHeadless()) + if (!HasAudioOutputDevices() || IsRunningHeadless()) return; MockAudioOutputControllerEventHandler event_handler; @@ -196,7 +196,7 @@ TEST(AudioOutputControllerTest, PlayPauseClose) { } TEST(AudioOutputControllerTest, HardwareBufferTooLarge) { - if (!HasAudioDevices() || IsRunningHeadless()) + if (!HasAudioOutputDevices() || IsRunningHeadless()) return; // Create an audio device with a very large hardware buffer size. @@ -214,7 +214,7 @@ TEST(AudioOutputControllerTest, HardwareBufferTooLarge) { } TEST(AudioOutputControllerTest, CloseTwice) { - if (!HasAudioDevices() || IsRunningHeadless()) + if (!HasAudioOutputDevices() || IsRunningHeadless()) return; MockAudioOutputControllerEventHandler event_handler; diff --git a/media/audio/fake_audio_output_stream.h b/media/audio/fake_audio_output_stream.h index 59afec7..000e5bf 100644 --- a/media/audio/fake_audio_output_stream.h +++ b/media/audio/fake_audio_output_stream.h @@ -12,7 +12,7 @@ #include <vector> #include "base/scoped_ptr.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" class FakeAudioOutputStream : public AudioOutputStream { public: diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc index b4c4dd2..0440ecf 100644 --- a/media/audio/linux/alsa_output.cc +++ b/media/audio/linux/alsa_output.cc @@ -339,7 +339,7 @@ void AlsaPcmOutputStream::Close() { // Signal to the manager that we're closed and can be removed. Since // we just posted a CloseTask to the message loop, we won't be deleted // immediately, but it will happen soon afterwards. - manager()->ReleaseStream(this); + manager()->ReleaseOutputStream(this); } void AlsaPcmOutputStream::Start(AudioSourceCallback* callback) { diff --git a/media/audio/linux/alsa_output.h b/media/audio/linux/alsa_output.h index 5f54d3b..eaea5a2 100644 --- a/media/audio/linux/alsa_output.h +++ b/media/audio/linux/alsa_output.h @@ -36,7 +36,7 @@ #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/thread.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" #include "testing/gtest/include/gtest/gtest_prod.h" namespace media { diff --git a/media/audio/linux/alsa_output_unittest.cc b/media/audio/linux/alsa_output_unittest.cc index 44a395b..8ae871ce4 100644 --- a/media/audio/linux/alsa_output_unittest.cc +++ b/media/audio/linux/alsa_output_unittest.cc @@ -70,14 +70,15 @@ class MockAudioSourceCallback : public AudioOutputStream::AudioSourceCallback { class MockAudioManagerLinux : public AudioManagerLinux { public: MOCK_METHOD0(Init, void()); - MOCK_METHOD0(HasAudioDevices, bool()); - MOCK_METHOD4(MakeAudioStream, AudioOutputStream*(Format format, int channels, - int sample_rate, - char bits_per_sample)); + MOCK_METHOD0(HasAudioOutputDevices, bool()); + MOCK_METHOD4(MakeAudioOutputStream, AudioOutputStream*(Format format, + int channels, + int sample_rate, + char bits_per_sample)); MOCK_METHOD0(MuteAll, void()); MOCK_METHOD0(UnMuteAll, void()); - MOCK_METHOD1(ReleaseStream, void(AlsaPcmOutputStream* stream)); + MOCK_METHOD1(ReleaseOutputStream, void(AlsaPcmOutputStream* stream)); }; class AlsaPcmOutputStreamTest : public testing::Test { @@ -249,7 +250,7 @@ TEST_F(AlsaPcmOutputStreamTest, LatencyFloor) { EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)).WillOnce(Return(0)); EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle)) .WillOnce(Return(kTestDeviceName)); - EXPECT_CALL(mock_manager_, ReleaseStream(test_stream_.get())); + EXPECT_CALL(mock_manager_, ReleaseOutputStream(test_stream_.get())); test_stream_->Close(); message_loop_.RunAllPending(); @@ -285,7 +286,7 @@ TEST_F(AlsaPcmOutputStreamTest, LatencyFloor) { .WillOnce(Return(0)); EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle)) .WillOnce(Return(kTestDeviceName)); - EXPECT_CALL(mock_manager_, ReleaseStream(test_stream_.get())); + EXPECT_CALL(mock_manager_, ReleaseOutputStream(test_stream_.get())); test_stream_->Close(); message_loop_.RunAllPending(); @@ -336,7 +337,7 @@ TEST_F(AlsaPcmOutputStreamTest, OpenClose) { .WillOnce(Return(0)); EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle)) .WillOnce(Return(kTestDeviceName)); - EXPECT_CALL(mock_manager_, ReleaseStream(test_stream_.get())); + EXPECT_CALL(mock_manager_, ReleaseOutputStream(test_stream_.get())); test_stream_->Close(); message_loop_.RunAllPending(); @@ -366,7 +367,7 @@ TEST_F(AlsaPcmOutputStreamTest, PcmOpenFailed) { EXPECT_FALSE(test_stream_->buffer_.get()); // Close the stream since we opened it to make destruction happy. - EXPECT_CALL(mock_manager_, ReleaseStream(test_stream_.get())); + EXPECT_CALL(mock_manager_, ReleaseOutputStream(test_stream_.get())); test_stream_->Close(); message_loop_.RunAllPending(); } @@ -400,7 +401,7 @@ TEST_F(AlsaPcmOutputStreamTest, PcmSetParamsFailed) { EXPECT_FALSE(test_stream_->buffer_.get()); // Close the stream since we opened it to make destruction happy. - EXPECT_CALL(mock_manager_, ReleaseStream(test_stream_.get())); + EXPECT_CALL(mock_manager_, ReleaseOutputStream(test_stream_.get())); test_stream_->Close(); message_loop_.RunAllPending(); } @@ -457,7 +458,7 @@ TEST_F(AlsaPcmOutputStreamTest, StartStop) { test_stream_->Start(&mock_callback); message_loop_.RunAllPending(); - EXPECT_CALL(mock_manager_, ReleaseStream(test_stream_.get())); + EXPECT_CALL(mock_manager_, ReleaseOutputStream(test_stream_.get())); EXPECT_CALL(mock_callback, OnClose(test_stream_.get())); EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)) .WillOnce(Return(0)); diff --git a/media/audio/linux/audio_manager_linux.cc b/media/audio/linux/audio_manager_linux.cc index 9fa4799..c3cf942 100644 --- a/media/audio/linux/audio_manager_linux.cc +++ b/media/audio/linux/audio_manager_linux.cc @@ -19,15 +19,16 @@ AudioManagerLinux* g_audio_manager = NULL; } // namespace // Implementation of AudioManager. -bool AudioManagerLinux::HasAudioDevices() { +bool AudioManagerLinux::HasAudioOutputDevices() { // TODO(ajwong): Make this actually query audio devices. return true; } -AudioOutputStream* AudioManagerLinux::MakeAudioStream(Format format, - int channels, - int sample_rate, - char bits_per_sample) { +AudioOutputStream* AudioManagerLinux::MakeAudioOutputStream( + Format format, + int channels, + int sample_rate, + char bits_per_sample) { // Early return for testing hook. Do this before checking for // |initialized_|. if (format == AudioManager::AUDIO_MOCK) { @@ -81,7 +82,7 @@ void AudioManagerLinux::UnMuteAll() { NOTIMPLEMENTED(); } -void AudioManagerLinux::ReleaseStream(AlsaPcmOutputStream* stream) { +void AudioManagerLinux::ReleaseOutputStream(AlsaPcmOutputStream* stream) { if (stream) { AutoLock l(lock_); active_streams_.erase(stream); diff --git a/media/audio/linux/audio_manager_linux.h b/media/audio/linux/audio_manager_linux.h index 32f09a8..d9229585 100644 --- a/media/audio/linux/audio_manager_linux.h +++ b/media/audio/linux/audio_manager_linux.h @@ -11,7 +11,7 @@ #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/thread.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" class AlsaPcmOutputStream; class AlsaWrapper; @@ -24,14 +24,14 @@ class AudioManagerLinux : public AudioManager { virtual void Init(); // Implementation of AudioManager. - virtual bool HasAudioDevices(); - virtual AudioOutputStream* MakeAudioStream(Format format, int channels, - int sample_rate, - char bits_per_sample); + virtual bool HasAudioOutputDevices(); + virtual AudioOutputStream* MakeAudioOutputStream(Format format, int channels, + int sample_rate, + char bits_per_sample); virtual void MuteAll(); virtual void UnMuteAll(); - virtual void ReleaseStream(AlsaPcmOutputStream* stream); + virtual void ReleaseOutputStream(AlsaPcmOutputStream* stream); protected: // Friend function for invoking the destructor at exit. diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc index ee5943a..2cc5b39 100644 --- a/media/audio/mac/audio_manager_mac.cc +++ b/media/audio/mac/audio_manager_mac.cc @@ -9,7 +9,7 @@ #include "media/audio/mac/audio_manager_mac.h" #include "media/audio/mac/audio_output_mac.h" -bool AudioManagerMac::HasAudioDevices() { +bool AudioManagerMac::HasAudioOutputDevices() { AudioDeviceID output_device_id = kAudioObjectUnknown; AudioObjectPropertyAddress property_address = { kAudioHardwarePropertyDefaultOutputDevice, // mSelector @@ -27,9 +27,11 @@ bool AudioManagerMac::HasAudioDevices() { output_device_id != kAudioObjectUnknown; } -AudioOutputStream* AudioManagerMac::MakeAudioStream(Format format, int channels, - int sample_rate, - char bits_per_sample) { +AudioOutputStream* AudioManagerMac::MakeAudioOutputStream( + Format format, + int channels, + int sample_rate, + char bits_per_sample) { if (format == AUDIO_MOCK) return FakeAudioOutputStream::MakeFakeStream(); else if (format != AUDIO_PCM_LINEAR) @@ -47,7 +49,8 @@ void AudioManagerMac::UnMuteAll() { } // Called by the stream when it has been released by calling Close(). -void AudioManagerMac::ReleaseStream(PCMQueueOutAudioOutputStream* stream) { +void AudioManagerMac::ReleaseOutputStream( + PCMQueueOutAudioOutputStream* stream) { delete stream; } diff --git a/media/audio/mac/audio_manager_mac.h b/media/audio/mac/audio_manager_mac.h index 51ee58a..492481d 100644 --- a/media/audio/mac/audio_manager_mac.h +++ b/media/audio/mac/audio_manager_mac.h @@ -6,7 +6,7 @@ #define MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ #include "base/basictypes.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" class PCMQueueOutAudioOutputStream; @@ -18,16 +18,16 @@ class AudioManagerMac : public AudioManager { AudioManagerMac() {}; // Implementation of AudioManager. - virtual bool HasAudioDevices(); - virtual AudioOutputStream* MakeAudioStream(Format format, int channels, - int sample_rate, - char bits_per_sample); + virtual bool HasAudioOutputDevices(); + virtual AudioOutputStream* MakeAudioOutputStream(Format format, int channels, + int sample_rate, + char bits_per_sample); virtual void MuteAll(); virtual void UnMuteAll(); // Mac-only method to free a stream created in MakeAudioStream. // It is called internally by the audio stream when it has been closed. - void ReleaseStream(PCMQueueOutAudioOutputStream* stream); + void ReleaseOutputStream(PCMQueueOutAudioOutputStream* stream); private: friend void DestroyAudioManagerMac(void*); diff --git a/media/audio/mac/audio_output_mac.cc b/media/audio/mac/audio_output_mac.cc index 57c76cb..cd7c8eba 100644 --- a/media/audio/mac/audio_output_mac.cc +++ b/media/audio/mac/audio_output_mac.cc @@ -143,7 +143,7 @@ void PCMQueueOutAudioOutputStream::Close() { } // Inform the audio manager that we have been closed. This can cause our // destruction. - manager_->ReleaseStream(this); + manager_->ReleaseOutputStream(this); } void PCMQueueOutAudioOutputStream::Stop() { diff --git a/media/audio/mac/audio_output_mac.h b/media/audio/mac/audio_output_mac.h index 0f58cae..7e86107 100644 --- a/media/audio/mac/audio_output_mac.h +++ b/media/audio/mac/audio_output_mac.h @@ -8,7 +8,7 @@ #include <AudioToolbox/AudioQueue.h> #include <AudioToolbox/AudioFormat.h> -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" #include "base/basictypes.h" diff --git a/media/audio/mac/audio_output_mac_unittest.cc b/media/audio/mac/audio_output_mac_unittest.cc index ee589f5..d48e47f 100644 --- a/media/audio/mac/audio_output_mac_unittest.cc +++ b/media/audio/mac/audio_output_mac_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/basictypes.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" #include "media/audio/simple_sources.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -51,10 +51,11 @@ TEST(MacAudioTest, SineWaveAudio16MonoTest) { TEST(MacAudioTest, PCMWaveStreamGetAndClose) { AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 2, 8000, 16); + audio_man->MakeAudioOutputStream(AudioManager::AUDIO_PCM_LINEAR, 2, + 8000, 16); ASSERT_TRUE(NULL != oas); oas->Close(); } @@ -63,10 +64,11 @@ TEST(MacAudioTest, PCMWaveStreamGetAndClose) { TEST(MacAudioTest, PCMWaveStreamOpenAndClose) { AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 2, 8000, 16); + audio_man->MakeAudioOutputStream(AudioManager::AUDIO_PCM_LINEAR, 2, + 8000, 16); ASSERT_TRUE(NULL != oas); EXPECT_TRUE(oas->Open(1024)); oas->Close(); @@ -79,10 +81,10 @@ TEST(MacAudioTest, PCMWaveStreamOpenAndClose) { TEST(MacAudioTest, PCMWaveStreamPlay200HzTone44KssMono) { AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1, + audio_man->MakeAudioOutputStream(AudioManager::AUDIO_PCM_LINEAR, 1, AudioManager::kAudioCDSampleRate, 16); ASSERT_TRUE(NULL != oas); @@ -112,10 +114,10 @@ TEST(MacAudioTest, PCMWaveStreamPlay200HzTone44KssMono) { TEST(MacAudioTest, PCMWaveStreamPlay200HzTone22KssMono) { AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1, + audio_man->MakeAudioOutputStream(AudioManager::AUDIO_PCM_LINEAR, 1, AudioManager::kAudioCDSampleRate/2, 16); ASSERT_TRUE(NULL != oas); @@ -139,10 +141,10 @@ static void ClearBuffer(AudioOutputStream* strea, void* dest, TEST(MacAudioTest, PCMWaveStreamPendingBytes) { AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1, + audio_man->MakeAudioOutputStream(AudioManager::AUDIO_PCM_LINEAR, 1, AudioManager::kAudioCDSampleRate, 16); ASSERT_TRUE(NULL != oas); diff --git a/media/audio/openbsd/audio_manager_openbsd.cc b/media/audio/openbsd/audio_manager_openbsd.cc index 41dc93bb..641b181 100644 --- a/media/audio/openbsd/audio_manager_openbsd.cc +++ b/media/audio/openbsd/audio_manager_openbsd.cc @@ -12,15 +12,16 @@ AudioManagerOpenBSD* g_audio_manager = NULL; } // namespace // Implementation of AudioManager. -bool AudioManagerOpenBSD::HasAudioDevices() { +bool AudioManagerOpenBSD::HasAudioOutputDevices() { NOTIMPLEMENTED(); return false; } -AudioOutputStream* AudioManagerOpenBSD::MakeAudioStream(Format format, - int channels, - int sample_rate, - char bits_per_sample) { +AudioOutputStream* AudioManagerOpenBSD::MakeAudioOutputStream( + Format format, + int channels, + int sample_rate, + char bits_per_sample) { NOTIMPLEMENTED(); return NULL; } diff --git a/media/audio/openbsd/audio_manager_openbsd.h b/media/audio/openbsd/audio_manager_openbsd.h index 1766a77d..ffa352d 100644 --- a/media/audio/openbsd/audio_manager_openbsd.h +++ b/media/audio/openbsd/audio_manager_openbsd.h @@ -5,7 +5,7 @@ #ifndef MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_H_ #define MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_H_ -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" class AudioManagerOpenBSD : public AudioManager { public: @@ -15,10 +15,10 @@ class AudioManagerOpenBSD : public AudioManager { virtual void Init(); // Implementation of AudioManager. - virtual bool HasAudioDevices(); - virtual AudioOutputStream* MakeAudioStream(Format format, int channels, - int sample_rate, - char bits_per_sample); + virtual bool HasAudioOutputDevices(); + virtual AudioOutputStream* MakeAudioOutputStream(Format format, int channels, + int sample_rate, + char bits_per_sample); virtual void MuteAll(); virtual void UnMuteAll(); diff --git a/media/audio/simple_sources.cc b/media/audio/simple_sources.cc index d1669daa..70d67b5 100644 --- a/media/audio/simple_sources.cc +++ b/media/audio/simple_sources.cc @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "base/logging.h" #include "base/ref_counted.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" #include "media/base/data_buffer.h" ////////////////////////////////////////////////////////////////////////////// diff --git a/media/audio/simple_sources.h b/media/audio/simple_sources.h index 5c7765c..d94c2ed 100644 --- a/media/audio/simple_sources.h +++ b/media/audio/simple_sources.h @@ -8,7 +8,7 @@ #include <list> #include "base/lock.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" #include "media/base/seekable_buffer.h" // An audio source that produces a pure sinusoidal tone. diff --git a/media/audio/simple_sources_unittest.cc b/media/audio/simple_sources_unittest.cc index 118ec6f..7ddc23f 100644 --- a/media/audio/simple_sources_unittest.cc +++ b/media/audio/simple_sources_unittest.cc @@ -76,9 +76,9 @@ TEST(SimpleSources, SineWaveAudio16MonoTest) { AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_MOCK, 1, - AudioManager::kTelephoneSampleRate, - bytes_per_sample * 2); + audio_man->MakeAudioOutputStream(AudioManager::AUDIO_MOCK, 1, + AudioManager::kTelephoneSampleRate, + bytes_per_sample * 2); ASSERT_TRUE(NULL != oas); EXPECT_TRUE(oas->Open(samples * bytes_per_sample)); diff --git a/media/audio/win/audio_output_win.cc b/media/audio/win/audio_manager_win.cc index ebfd915..81a59f5 100644 --- a/media/audio/win/audio_output_win.cc +++ b/media/audio/win/audio_manager_win.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" #include <windows.h> #include <mmsystem.h> @@ -35,7 +35,7 @@ AudioManagerWin* g_audio_manager = NULL; } // namespace. -bool AudioManagerWin::HasAudioDevices() { +bool AudioManagerWin::HasAudioOutputDevices() { return (::waveOutGetNumDevs() != 0); } @@ -43,9 +43,11 @@ bool AudioManagerWin::HasAudioDevices() { // should suffice most windows user's needs. // - PCMWaveOutAudioOutputStream: Based on the waveOutWrite API (in progress) // - PCMDXSoundAudioOutputStream: Based on DirectSound or XAudio (future work). -AudioOutputStream* AudioManagerWin::MakeAudioStream(Format format, int channels, - int sample_rate, - char bits_per_sample) { +AudioOutputStream* AudioManagerWin::MakeAudioOutputStream( + Format format, + int channels, + int sample_rate, + char bits_per_sample) { if ((channels > kMaxChannels) || (channels <= 0) || (sample_rate > kMaxSampleRate) || (sample_rate <= 0) || (bits_per_sample > kMaxBitsPerSample) || (bits_per_sample <= 0)) @@ -64,7 +66,7 @@ AudioOutputStream* AudioManagerWin::MakeAudioStream(Format format, int channels, return NULL; } -void AudioManagerWin::ReleaseStream(PCMWaveOutAudioOutputStream* stream) { +void AudioManagerWin::ReleaseOutputStream(PCMWaveOutAudioOutputStream* stream) { if (stream) delete stream; } diff --git a/media/audio/win/audio_manager_win.h b/media/audio/win/audio_manager_win.h index f060fc4..df6ab10 100644 --- a/media/audio/win/audio_manager_win.h +++ b/media/audio/win/audio_manager_win.h @@ -8,7 +8,7 @@ #include <windows.h> #include "base/basictypes.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" class PCMWaveOutAudioOutputStream; @@ -19,16 +19,16 @@ class AudioManagerWin : public AudioManager { public: AudioManagerWin() {} // Implementation of AudioManager. - virtual bool HasAudioDevices(); - virtual AudioOutputStream* MakeAudioStream(Format format, int channels, - int sample_rate, - char bits_per_sample); + virtual bool HasAudioOutputDevices(); + virtual AudioOutputStream* MakeAudioOutputStream(Format format, int channels, + int sample_rate, + char bits_per_sample); virtual void MuteAll(); virtual void UnMuteAll(); // Windows-only methods to free a stream created in MakeAudioStream. These // are called internally by the audio stream when it has been closed. - void ReleaseStream(PCMWaveOutAudioOutputStream* stream); + void ReleaseOutputStream(PCMWaveOutAudioOutputStream* stream); private: friend void DestroyAudioManagerWin(void *); diff --git a/media/audio/win/audio_output_win_unittest.cc b/media/audio/win/audio_output_win_unittest.cc index 6a06274..bb90e75 100644 --- a/media/audio/win/audio_output_win_unittest.cc +++ b/media/audio/win/audio_output_win_unittest.cc @@ -10,7 +10,7 @@ #include "base/file_util.h" #include "base/path_service.h" #include "base/sync_socket.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" #include "media/audio/simple_sources.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -206,7 +206,7 @@ TEST(WinAudioTest, MockStreamBasicCallbacks) { AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_MOCK, 2, 8000, 8); + audio_man->MakeAudioOutputStream(AudioManager::AUDIO_MOCK, 2, 8000, 8); ASSERT_TRUE(NULL != oas); EXPECT_TRUE(oas->Open(256)); TestSourceBasic source; @@ -232,10 +232,10 @@ TEST(WinAudioTest, PCMWaveStreamGetAndClose) { return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; - AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 2, 8000, 16); + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( + AudioManager::AUDIO_PCM_LINEAR, 2, 8000, 16); ASSERT_TRUE(NULL != oas); oas->Close(); } @@ -246,15 +246,16 @@ TEST(WinAudioTest, SanityOnMakeParams) { return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; AudioManager::Format fmt = AudioManager::AUDIO_PCM_LINEAR; - EXPECT_TRUE(NULL == audio_man->MakeAudioStream(fmt, 8, 8000, 16)); - EXPECT_TRUE(NULL == audio_man->MakeAudioStream(fmt, 1, 1024 * 1024, 16)); - EXPECT_TRUE(NULL == audio_man->MakeAudioStream(fmt, 2, 8000, 80)); - EXPECT_TRUE(NULL == audio_man->MakeAudioStream(fmt, -2, 8000, 16)); - EXPECT_TRUE(NULL == audio_man->MakeAudioStream(fmt, 2, -8000, 16)); - EXPECT_TRUE(NULL == audio_man->MakeAudioStream(fmt, 2, -8000, -16)); + EXPECT_TRUE(NULL == audio_man->MakeAudioOutputStream(fmt, 8, 8000, 16)); + EXPECT_TRUE(NULL == audio_man->MakeAudioOutputStream(fmt, 1, 1024 * 1024, + 16)); + EXPECT_TRUE(NULL == audio_man->MakeAudioOutputStream(fmt, 2, 8000, 80)); + EXPECT_TRUE(NULL == audio_man->MakeAudioOutputStream(fmt, -2, 8000, 16)); + EXPECT_TRUE(NULL == audio_man->MakeAudioOutputStream(fmt, 2, -8000, 16)); + EXPECT_TRUE(NULL == audio_man->MakeAudioOutputStream(fmt, 2, -8000, -16)); } // Test that it can be opened and closed. @@ -263,10 +264,10 @@ TEST(WinAudioTest, PCMWaveStreamOpenAndClose) { return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; - AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 2, 8000, 16); + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( + AudioManager::AUDIO_PCM_LINEAR, 2, 8000, 16); ASSERT_TRUE(NULL != oas); EXPECT_TRUE(oas->Open(1024)); oas->Close(); @@ -278,10 +279,10 @@ TEST(WinAudioTest, PCMWaveStreamOpenLimit) { return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; - AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 2, 8000, 16); + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( + AudioManager::AUDIO_PCM_LINEAR, 2, 8000, 16); ASSERT_TRUE(NULL != oas); EXPECT_FALSE(oas->Open(1024 * 1024 * 1024)); oas->Close(); @@ -294,10 +295,10 @@ TEST(WinAudioTest, PCMWaveStreamTripleBuffer) { return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; - AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1, 16000, 16); + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( + AudioManager::AUDIO_PCM_LINEAR, 1, 16000, 16); ASSERT_TRUE(NULL != oas); TestSourceTripleBuffer test_triple_buffer; EXPECT_TRUE(oas->Open(512)); @@ -318,10 +319,10 @@ TEST(WinAudioTest, PCMWaveSlowSource) { return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; - AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1, 16000, 16); + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( + AudioManager::AUDIO_PCM_LINEAR, 1, 16000, 16); ASSERT_TRUE(NULL != oas); TestSourceLaggy test_laggy(2, 90); EXPECT_TRUE(oas->Open(512)); @@ -344,11 +345,10 @@ TEST(WinAudioTest, PCMWaveStreamPlaySlowLoop) { return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; - AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1, - AudioManager::kAudioCDSampleRate, 16); + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( + AudioManager::AUDIO_PCM_LINEAR, 1, AudioManager::kAudioCDSampleRate, 16); ASSERT_TRUE(NULL != oas); SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, @@ -375,11 +375,10 @@ TEST(WinAudioTest, PCMWaveStreamPlay200HzTone44Kss) { return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; - AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1, - AudioManager::kAudioCDSampleRate, 16); + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( + AudioManager::AUDIO_PCM_LINEAR, 1, AudioManager::kAudioCDSampleRate, 16); ASSERT_TRUE(NULL != oas); SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, @@ -403,11 +402,11 @@ TEST(WinAudioTest, PCMWaveStreamPlay200HzTone22Kss) { return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; - AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1, - AudioManager::kAudioCDSampleRate/2, 16); + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( + AudioManager::AUDIO_PCM_LINEAR, 1, AudioManager::kAudioCDSampleRate/2, + 16); ASSERT_TRUE(NULL != oas); SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, @@ -449,10 +448,10 @@ TEST(WinAudioTest, PushSourceFile16KHz) { AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; - AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1, 16000, 16); + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( + AudioManager::AUDIO_PCM_LINEAR, 1, 16000, 16); ASSERT_TRUE(NULL != oas); // compute buffer size for 100ms of audio. Which is 3200 bytes. @@ -493,11 +492,10 @@ TEST(WinAudioTest, PCMWaveStreamPlayTwice200HzTone44Kss) { return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; - AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1, - AudioManager::kAudioCDSampleRate, 16); + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( + AudioManager::AUDIO_PCM_LINEAR, 1, AudioManager::kAudioCDSampleRate, 16); ASSERT_TRUE(NULL != oas); SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, @@ -532,11 +530,11 @@ TEST(WinAudioTest, PCMWaveStreamPlay200HzTone44KssLowLatency) { return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; - AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LOW_LATENCY, 1, - AudioManager::kAudioCDSampleRate, 16); + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( + AudioManager::AUDIO_PCM_LOW_LATENCY, 1, AudioManager::kAudioCDSampleRate, + 16); ASSERT_TRUE(NULL != oas); SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, @@ -559,11 +557,10 @@ TEST(WinAudioTest, PCMWaveStreamPendingBytes) { return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; - AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1, - AudioManager::kAudioCDSampleRate, 16); + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( + AudioManager::AUDIO_PCM_LINEAR, 1, AudioManager::kAudioCDSampleRate, 16); ASSERT_TRUE(NULL != oas); NiceMock<MockAudioSource> source; @@ -678,13 +675,12 @@ TEST(WinAudioTest, SyncSocketBasic) { AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); - if (!audio_man->HasAudioDevices()) + if (!audio_man->HasAudioOutputDevices()) return; int sample_rate = AudioManager::kAudioCDSampleRate; - AudioOutputStream* oas = - audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LOW_LATENCY, 1, - sample_rate, 16); + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( + AudioManager::AUDIO_PCM_LOW_LATENCY, 1, sample_rate, 16); ASSERT_TRUE(NULL != oas); // compute buffer size for 20ms of audio, 882 samples (mono). diff --git a/media/audio/win/waveout_output_win.cc b/media/audio/win/waveout_output_win.cc index 59f4c1c..cbd0ddc 100644 --- a/media/audio/win/waveout_output_win.cc +++ b/media/audio/win/waveout_output_win.cc @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "base/logging.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" #include "media/audio/audio_util.h" #include "media/audio/win/audio_manager_win.h" @@ -209,7 +209,7 @@ void PCMWaveOutAudioOutputStream::Close() { // Tell the audio manager that we have been released. This can result in // the manager destroying us in-place so this needs to be the last thing // we do on this function. - manager_->ReleaseStream(this); + manager_->ReleaseOutputStream(this); } void PCMWaveOutAudioOutputStream::SetVolume(double volume) { diff --git a/media/audio/win/waveout_output_win.h b/media/audio/win/waveout_output_win.h index df35542..d9b47c0 100644 --- a/media/audio/win/waveout_output_win.h +++ b/media/audio/win/waveout_output_win.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "base/scoped_handle_win.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" class AudioManagerWin; diff --git a/media/filters/audio_renderer_impl.cc b/media/filters/audio_renderer_impl.cc index 591b0b2..0f4a053 100644 --- a/media/filters/audio_renderer_impl.cc +++ b/media/filters/audio_renderer_impl.cc @@ -33,7 +33,7 @@ bool AudioRendererImpl::IsMediaFormatSupported( int channels; int sample_rate; int sample_bits; - return AudioManager::GetAudioManager()->HasAudioDevices() && + return AudioManager::GetAudioManager()->HasAudioOutputDevices() && ParseMediaFormat(media_format, &channels, &sample_rate, &sample_bits); } @@ -88,7 +88,7 @@ bool AudioRendererImpl::OnInitialize(const MediaFormat& media_format) { bytes_per_second_ = sample_rate * channels * sample_bits / 8; // Create our audio stream. - stream_ = AudioManager::GetAudioManager()->MakeAudioStream( + stream_ = AudioManager::GetAudioManager()->MakeAudioOutputStream( AudioManager::AUDIO_PCM_LINEAR, channels, sample_rate, sample_bits); if (!stream_) return false; diff --git a/media/filters/audio_renderer_impl.h b/media/filters/audio_renderer_impl.h index ced7a9e..7bbb265e 100644 --- a/media/filters/audio_renderer_impl.h +++ b/media/filters/audio_renderer_impl.h @@ -18,7 +18,7 @@ #include <deque> #include "base/lock.h" -#include "media/audio/audio_output.h" +#include "media/audio/audio_io.h" #include "media/base/buffers.h" #include "media/base/factory.h" #include "media/base/filters.h" diff --git a/media/media.gyp b/media/media.gyp index 1aeb44b2..11f5d34 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -20,7 +20,7 @@ ], 'msvs_guid': '6AE76406-B03B-11DD-94B1-80B556D89593', 'sources': [ - 'audio/audio_output.h', + 'audio/audio_io.h', 'audio/audio_output_controller.cc', 'audio/audio_output_controller.h', 'audio/audio_util.cc', @@ -42,7 +42,7 @@ 'audio/simple_sources.cc', 'audio/simple_sources.h', 'audio/win/audio_manager_win.h', - 'audio/win/audio_output_win.cc', + 'audio/win/audio_manager_win.cc', 'audio/win/waveout_output_win.cc', 'audio/win/waveout_output_win.h', 'base/buffers.cc', diff --git a/tools/valgrind/memcheck/suppressions_mac.txt b/tools/valgrind/memcheck/suppressions_mac.txt index ad4c542..d78e8c9 100644 --- a/tools/valgrind/memcheck/suppressions_mac.txt +++ b/tools/valgrind/memcheck/suppressions_mac.txt @@ -54,7 +54,7 @@ fun:_ZN16HALDefaultDevice10InitializeEv fun:_ZN9HALSystem16CheckOutInstanceEv fun:AudioObjectGetPropertyData - fun:_ZN15AudioManagerMac15HasAudioDevicesEv + fun:_ZN15AudioManagerMac15HasAudioOutputDevicesEv } { # Filed with Apple as rdar://6915060; see http://crbug.com/11270 |