| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_MANAGER_H_ | 6 #define MEDIA_AUDIO_AUDIO_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 // Returns the app name or an empty string if it is not set. | 77 // Returns the app name or an empty string if it is not set. |
| 78 static const std::string& GetGlobalAppName(); | 78 static const std::string& GetGlobalAppName(); |
| 79 #endif | 79 #endif |
| 80 | 80 |
| 81 // Returns the pointer to the last created instance, or NULL if not yet | 81 // Returns the pointer to the last created instance, or NULL if not yet |
| 82 // created. This is a utility method for the code outside of media directory, | 82 // created. This is a utility method for the code outside of media directory, |
| 83 // like src/chrome. | 83 // like src/chrome. |
| 84 static AudioManager* Get(); | 84 static AudioManager* Get(); |
| 85 | 85 |
| 86 // Releases all audio resources. | 86 // Synchronously releases all audio resources. |
| 87 // Must be called before deletion and on the same thread as AudioManager | 87 // Must be called before deletion and on the same thread as AudioManager |
| 88 // was created. | 88 // was created. |
| 89 void Shutdown(); | 89 // Returns true on success but false if AudioManager could not be shutdown. |
| 90 // AudioManager instance must not be deleted if shutdown failed. |
| 91 bool Shutdown(); |
| 90 | 92 |
| 91 // Log callback used for sending log messages from a stream to the object | 93 // Log callback used for sending log messages from a stream to the object |
| 92 // that manages the stream. | 94 // that manages the stream. |
| 93 using LogCallback = base::Callback<void(const std::string&)>; | 95 using LogCallback = base::Callback<void(const std::string&)>; |
| 94 | 96 |
| 95 // Factory for all the supported stream formats. |params| defines parameters | 97 // Factory for all the supported stream formats. |params| defines parameters |
| 96 // of the audio stream to be created. | 98 // of the audio stream to be created. |
| 97 // | 99 // |
| 98 // |params.sample_per_packet| is the requested buffer allocation which the | 100 // |params.sample_per_packet| is the requested buffer allocation which the |
| 99 // audio source thinks it can usually fill without blocking. Internally two | 101 // audio source thinks it can usually fill without blocking. Internally two |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 std::unique_ptr<AudioThread> audio_thread_; | 271 std::unique_ptr<AudioThread> audio_thread_; |
| 270 bool shutdown_ = false; // True after |this| has been shutdown. | 272 bool shutdown_ = false; // True after |this| has been shutdown. |
| 271 | 273 |
| 272 THREAD_CHECKER(thread_checker_); | 274 THREAD_CHECKER(thread_checker_); |
| 273 DISALLOW_COPY_AND_ASSIGN(AudioManager); | 275 DISALLOW_COPY_AND_ASSIGN(AudioManager); |
| 274 }; | 276 }; |
| 275 | 277 |
| 276 } // namespace media | 278 } // namespace media |
| 277 | 279 |
| 278 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ | 280 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ |
| OLD | NEW |