OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <windows.h> | 5 #include <windows.h> |
6 #include <mmsystem.h> | 6 #include <mmsystem.h> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 int file_size_; | 136 int file_size_; |
137 int pos_; | 137 int pos_; |
138 base::Time previous_call_time_; | 138 base::Time previous_call_time_; |
139 FILE* text_file_; | 139 FILE* text_file_; |
140 size_t elements_to_write_; | 140 size_t elements_to_write_; |
141 }; | 141 }; |
142 | 142 |
143 // Convenience method which ensures that we are not running on the build | 143 // Convenience method which ensures that we are not running on the build |
144 // bots and that at least one valid output device can be found. | 144 // bots and that at least one valid output device can be found. |
145 static bool CanRunAudioTests(AudioManager* audio_man) { | 145 static bool CanRunAudioTests(AudioManager* audio_man) { |
146 if (NULL == audio_man) | |
147 return false; | |
148 | |
149 scoped_ptr<base::Environment> env(base::Environment::Create()); | |
150 if (env->HasVar("CHROME_HEADLESS")) | |
151 return false; | |
152 // TODO(henrika): note that we use Wave today to query the number of | 146 // TODO(henrika): note that we use Wave today to query the number of |
153 // existing output devices. | 147 // existing output devices. |
154 return audio_man->HasAudioOutputDevices(); | 148 bool output = audio_man->HasAudioOutputDevices(); |
| 149 LOG_IF(WARNING, !output) << "No output devices detected."; |
| 150 return output; |
155 } | 151 } |
156 | 152 |
157 // Convenience method which creates a default AudioOutputStream object but | 153 // Convenience method which creates a default AudioOutputStream object but |
158 // also allows the user to modify the default settings. | 154 // also allows the user to modify the default settings. |
159 class AudioOutputStreamWrapper { | 155 class AudioOutputStreamWrapper { |
160 public: | 156 public: |
161 explicit AudioOutputStreamWrapper(AudioManager* audio_manager) | 157 explicit AudioOutputStreamWrapper(AudioManager* audio_manager) |
162 : com_init_(ScopedCOMInitializer::kMTA), | 158 : com_init_(ScopedCOMInitializer::kMTA), |
163 audio_man_(audio_manager), | 159 audio_man_(audio_manager), |
164 format_(AudioParameters::AUDIO_PCM_LOW_LATENCY), | 160 format_(AudioParameters::AUDIO_PCM_LOW_LATENCY), |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 | 532 |
537 aos->Start(&file_source); | 533 aos->Start(&file_source); |
538 base::PlatformThread::Sleep(file_duration_ms); | 534 base::PlatformThread::Sleep(file_duration_ms); |
539 aos->Stop(); | 535 aos->Stop(); |
540 | 536 |
541 LOG(INFO) << ">> File playout has stopped."; | 537 LOG(INFO) << ">> File playout has stopped."; |
542 aos->Close(); | 538 aos->Close(); |
543 } | 539 } |
544 | 540 |
545 } // namespace media | 541 } // namespace media |
OLD | NEW |