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

Unified Diff: media/audio/mac/audio_output_mac_unittest.cc

Issue 92131: Third installement of low level audio for mac... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 side-by-side diff with in-line comments
Download patch
« media/audio/mac/audio_output_mac.cc ('K') | « media/audio/mac/audio_output_mac.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/mac/audio_output_mac_unittest.cc
===================================================================
--- media/audio/mac/audio_output_mac_unittest.cc (revision 14284)
+++ media/audio/mac/audio_output_mac_unittest.cc (working copy)
@@ -54,3 +54,53 @@
EXPECT_TRUE(oas->Open(1024));
oas->Close();
}
+
+// This test produces actual audio for 1.5 seconds on the default wave device at
+// 44.1K s/sec. Parameters have been chosen carefully so you should not hear
+// pops or noises while the sound is playing. The sound must also be identical
+// to the sound of PCMWaveStreamPlay200HzTone22KssMono test.
+TEST(MacAudioTest, PCMWaveStreamPlay200HzTone44KssMono) {
+ AudioManager* audio_man = AudioManager::GetAudioManager();
+ ASSERT_TRUE(NULL != audio_man);
+ if (!audio_man->HasAudioDevices())
+ return;
+ AudioOutputStream* oas =
+ 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);
+ oas->Stop();
+ oas->Close();
+}
+
+// This test produces actual audio for 1.5 seconds on the default wave device at
+// 22K s/sec. Parameters have been chosen carefully so you should not hear pops
+// or noises while the sound is playing. The sound must also be identical to the
+// sound of PCMWaveStreamPlay200HzTone44KssMono test.
+TEST(MacAudioTest, PCMWaveStreamPlay200HzTone22KssMono) {
+ AudioManager* audio_man = AudioManager::GetAudioManager();
+ ASSERT_TRUE(NULL != audio_man);
+ if (!audio_man->HasAudioDevices())
+ return;
+ AudioOutputStream* oas =
+ 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);
+ oas->Stop();
+ oas->Close();
+}
« media/audio/mac/audio_output_mac.cc ('K') | « media/audio/mac/audio_output_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698