diff options
author | hclam@google.com <hclam@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-22 00:06:17 +0000 |
---|---|---|
committer | hclam@google.com <hclam@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-22 00:06:17 +0000 |
commit | dff80f15dca03378e052f725a6dbff46f4649249 (patch) | |
tree | 8b87e546774f6ff053bf590fe440e653314adce7 /media/audio/mac | |
parent | ee01535e43949832b8fb57a74d892390e01d36dd (diff) | |
download | chromium_src-dff80f15dca03378e052f725a6dbff46f4649249.zip chromium_src-dff80f15dca03378e052f725a6dbff46f4649249.tar.gz chromium_src-dff80f15dca03378e052f725a6dbff46f4649249.tar.bz2 |
Refactoring to share MockAudioOutputStream implementations across 3 platforms
Re-trying the previous CL. The last change got reverted because of valgrind
failure.
TBR=scherkus
Original CL: http://codereview.chromium.org/155471
Review URL: http://codereview.chromium.org/159167
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21242 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/mac')
-rw-r--r-- | media/audio/mac/audio_manager_mac.cc | 16 | ||||
-rw-r--r-- | media/audio/mac/audio_manager_mac.h | 1 | ||||
-rw-r--r-- | media/audio/mac/audio_output_mac.cc | 4 | ||||
-rw-r--r-- | media/audio/mac/audio_output_mac.h | 1 |
4 files changed, 7 insertions, 15 deletions
diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc index 7a8e15b..a921dfb 100644 --- a/media/audio/mac/audio_manager_mac.cc +++ b/media/audio/mac/audio_manager_mac.cc @@ -5,6 +5,7 @@ #include <CoreAudio/AudioHardware.h> #include "base/at_exit.h" +#include "media/audio/fake_audio_output_stream.h" #include "media/audio/mac/audio_manager_mac.h" #include "media/audio/mac/audio_output_mac.h" @@ -19,8 +20,9 @@ bool AudioManagerMac::HasAudioDevices() { AudioOutputStream* AudioManagerMac::MakeAudioStream(Format format, int channels, int sample_rate, char bits_per_sample) { - // TODO(cpu): add mock format. - if (format != AUDIO_PCM_LINEAR) + if (format == AUDIO_MOCK) + return FakeAudioOutputStream::MakeFakeStream(); + else if (format != AUDIO_PCM_LINEAR) return NULL; return new PCMQueueOutAudioOutputStream(this, channels, sample_rate, bits_per_sample); @@ -34,19 +36,15 @@ void AudioManagerMac::UnMuteAll() { // TODO(cpu): implement. } -const void* AudioManagerMac::GetLastMockBuffer() { - // TODO(cpu): implement. - return NULL; -} - // Called by the stream when it has been released by calling Close(). void AudioManagerMac::ReleaseStream(PCMQueueOutAudioOutputStream* stream) { delete stream; } namespace { - AudioManagerMac* g_audio_manager = NULL; - + +AudioManagerMac* g_audio_manager = NULL; + } // namespace. void DestroyAudioManagerMac(void* param) { diff --git a/media/audio/mac/audio_manager_mac.h b/media/audio/mac/audio_manager_mac.h index 46cb2a5..51ee58a 100644 --- a/media/audio/mac/audio_manager_mac.h +++ b/media/audio/mac/audio_manager_mac.h @@ -24,7 +24,6 @@ class AudioManagerMac : public AudioManager { char bits_per_sample); virtual void MuteAll(); virtual void UnMuteAll(); - virtual const void* GetLastMockBuffer(); // Mac-only method to free a stream created in MakeAudioStream. // It is called internally by the audio stream when it has been closed. diff --git a/media/audio/mac/audio_output_mac.cc b/media/audio/mac/audio_output_mac.cc index 4d7c6bb..657e91a 100644 --- a/media/audio/mac/audio_output_mac.cc +++ b/media/audio/mac/audio_output_mac.cc @@ -145,10 +145,6 @@ void PCMQueueOutAudioOutputStream::GetVolume(double* left_level, // TODO(cpu): Implement. } -size_t PCMQueueOutAudioOutputStream::GetNumBuffers() { - return kNumBuffers; -} - // Note to future hackers of this function: Do not add locks here because we // call out to third party source that might do crazy things including adquire // external locks or somehow re-enter here because its legal for them to call diff --git a/media/audio/mac/audio_output_mac.h b/media/audio/mac/audio_output_mac.h index d1129b3..340e1eb 100644 --- a/media/audio/mac/audio_output_mac.h +++ b/media/audio/mac/audio_output_mac.h @@ -35,7 +35,6 @@ class PCMQueueOutAudioOutputStream : public AudioOutputStream { virtual void Stop(); virtual void SetVolume(double left_level, double right_level); virtual void GetVolume(double* left_level, double* right_level); - virtual size_t GetNumBuffers(); private: // The audio is double buffered. |