diff options
Diffstat (limited to 'media/audio/mac')
-rw-r--r-- | media/audio/mac/audio_manager_mac.h | 9 | ||||
-rw-r--r-- | media/audio/mac/audio_output_mac.cc | 8 | ||||
-rw-r--r-- | media/audio/mac/audio_output_mac_unittest.cc | 16 |
3 files changed, 17 insertions, 16 deletions
diff --git a/media/audio/mac/audio_manager_mac.h b/media/audio/mac/audio_manager_mac.h index 670b51c..46cb2a5 100644 --- a/media/audio/mac/audio_manager_mac.h +++ b/media/audio/mac/audio_manager_mac.h @@ -14,8 +14,9 @@ class PCMQueueOutAudioOutputStream; // to the audio output and only internal users can call methods not exposed by // the AudioManager class. class AudioManagerMac : public AudioManager { -public: + public: AudioManagerMac() {}; + // Implementation of AudioManager. virtual bool HasAudioDevices(); virtual AudioOutputStream* MakeAudioStream(Format format, int channels, @@ -24,13 +25,13 @@ public: 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. void ReleaseStream(PCMQueueOutAudioOutputStream* stream); -private: - friend void DestroyAudioManagerMac(void *); + private: + friend void DestroyAudioManagerMac(void*); virtual ~AudioManagerMac() {}; DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); }; diff --git a/media/audio/mac/audio_output_mac.cc b/media/audio/mac/audio_output_mac.cc index 0b90d2c..4d7c6bb 100644 --- a/media/audio/mac/audio_output_mac.cc +++ b/media/audio/mac/audio_output_mac.cc @@ -122,13 +122,13 @@ void PCMQueueOutAudioOutputStream::Close() { void PCMQueueOutAudioOutputStream::Stop() { // We request a synchronous stop, so the next call can take some time. In - // the windows implementation we block here as well. + // the windows implementation we block here as well. source_ = NULL; // We set the source to null to signal to the data queueing thread it can stop // queueing data, however at most one callback might still be in flight which // could attempt to enqueue right after the next call. Rather that trying to // use a lock we rely on the internal Mac queue lock so the enqueue might - // succeed or might fail but it won't crash or leave the queue itself in an + // succeed or might fail but it won't crash or leave the queue itself in an // inconsistent state. OSStatus err = AudioQueueStop(audio_queue_, true); if (err != noErr) @@ -194,7 +194,7 @@ void PCMQueueOutAudioOutputStream::Start(AudioSourceCallback* callback) { HandleError(err); return; } - source_ = callback; + source_ = callback; // Ask the source to pre-fill all our buffers before playing. for(size_t ix = 0; ix != kNumBuffers; ++ix) { RenderCallback(this, NULL, buffer_[ix]); @@ -202,7 +202,7 @@ void PCMQueueOutAudioOutputStream::Start(AudioSourceCallback* callback) { // Queue the buffers to the audio driver, sounds starts now. for(size_t ix = 0; ix != kNumBuffers; ++ix) { err = AudioQueueEnqueueBuffer(audio_queue_, buffer_[ix], 0, NULL); - if (err != noErr) { + if (err != noErr) { HandleError(err); return; } diff --git a/media/audio/mac/audio_output_mac_unittest.cc b/media/audio/mac/audio_output_mac_unittest.cc index c0f5348..d6abefd 100644 --- a/media/audio/mac/audio_output_mac_unittest.cc +++ b/media/audio/mac/audio_output_mac_unittest.cc @@ -9,14 +9,14 @@ // Validate that the SineWaveAudioSource writes the expected values for -// the FORMAT_16BIT_MONO. +// the FORMAT_16BIT_MONO. TEST(MacAudioTest, SineWaveAudio16MonoTest) { const size_t samples = 1024; const int freq = 200; - + SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, freq, AudioManager::kTelephoneSampleRate); - + // TODO(cpu): Put the real test when the mock renderer is ported. int16 buffer[samples] = { 0xffff }; source.OnMoreData(NULL, buffer, sizeof(buffer)); @@ -68,11 +68,11 @@ TEST(MacAudioTest, PCMWaveStreamPlay200HzTone44KssMono) { audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1, AudioManager::kAudioCDSampleRate, 16); ASSERT_TRUE(NULL != oas); - + SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, 200.0, AudioManager::kAudioCDSampleRate); size_t bytes_100_ms = (AudioManager::kAudioCDSampleRate / 10) * 2; - + EXPECT_TRUE(oas->Open(bytes_100_ms)); oas->Start(&source); usleep(1500000); @@ -93,14 +93,14 @@ TEST(MacAudioTest, PCMWaveStreamPlay200HzTone22KssMono) { audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1, AudioManager::kAudioCDSampleRate/2, 16); ASSERT_TRUE(NULL != oas); - + SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, 200.0, AudioManager::kAudioCDSampleRate/2); size_t bytes_100_ms = (AudioManager::kAudioCDSampleRate / 20) * 2; - + EXPECT_TRUE(oas->Open(bytes_100_ms)); oas->Start(&source); - usleep(1500000); + usleep(1500000); oas->Stop(); oas->Close(); } |