| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_LOGGING_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_LOGGING_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_LOGGING_H_ | 6 #define MEDIA_AUDIO_AUDIO_LOGGING_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 | 11 |
| 12 namespace media { | 12 namespace media { |
| 13 | |
| 14 class AudioParameters; | 13 class AudioParameters; |
| 15 | 14 |
| 16 // AudioLog logs state information about an active audio component. Each method | 15 // AudioLog logs state information about an active audio component. Each method |
| 17 // takes a |component_id| along with method specific information. Its methods | 16 // takes a |component_id| along with method specific information. Its methods |
| 18 // are safe to call from any thread. | 17 // are safe to call from any thread. |
| 19 class AudioLog { | 18 class AudioLog { |
| 20 public: | 19 public: |
| 21 virtual ~AudioLog() {} | 20 virtual ~AudioLog() {} |
| 22 | 21 |
| 23 // Called when an audio component is created. |params| are the parameters of | 22 // Called when an audio component is created. |params| are the parameters of |
| (...skipping 18 matching lines...) Expand all Loading... |
| 42 // Called when an audio component encounters an error. | 41 // Called when an audio component encounters an error. |
| 43 virtual void OnError(int component_id) = 0; | 42 virtual void OnError(int component_id) = 0; |
| 44 | 43 |
| 45 // Called when an audio component changes volume. |volume| is the new volume. | 44 // Called when an audio component changes volume. |volume| is the new volume. |
| 46 virtual void OnSetVolume(int component_id, double volume) = 0; | 45 virtual void OnSetVolume(int component_id, double volume) = 0; |
| 47 | 46 |
| 48 // Called when an audio component switches output device. |device_id| is the | 47 // Called when an audio component switches output device. |device_id| is the |
| 49 // new audio output device. | 48 // new audio output device. |
| 50 virtual void OnSwitchOutputDevice(int component_id, | 49 virtual void OnSwitchOutputDevice(int component_id, |
| 51 const std::string& device_id) = 0; | 50 const std::string& device_id) = 0; |
| 52 | |
| 53 // Called when an audio component wants to forward a log message. | |
| 54 virtual void OnLogMessage(int component_id, const std::string& message) = 0; | |
| 55 }; | 51 }; |
| 56 | 52 |
| 57 // AudioLogFactory dispenses AudioLog instances to owning classes for tracking | 53 // AudioLogFactory dispenses AudioLog instances to owning classes for tracking |
| 58 // AudioComponent behavior. All AudioComponents have the concept of an owning | 54 // AudioComponent behavior. All AudioComponents have the concept of an owning |
| 59 // class: | 55 // class: |
| 60 // | 56 // |
| 61 // - AudioInputRendererHost for AudioInputController | 57 // - AudioInputRendererHost for AudioInputController |
| 62 // - AudioRendererHost for AudioOutputController | 58 // - AudioRendererHost for AudioOutputController |
| 63 // - AudioOutputDispatcherImpl for AudioOutputStream | 59 // - AudioOutputDispatcherImpl for AudioOutputStream |
| 64 // | 60 // |
| (...skipping 18 matching lines...) Expand all Loading... |
| 83 virtual std::unique_ptr<AudioLog> CreateAudioLog( | 79 virtual std::unique_ptr<AudioLog> CreateAudioLog( |
| 84 AudioComponent component) = 0; | 80 AudioComponent component) = 0; |
| 85 | 81 |
| 86 protected: | 82 protected: |
| 87 virtual ~AudioLogFactory() {} | 83 virtual ~AudioLogFactory() {} |
| 88 }; | 84 }; |
| 89 | 85 |
| 90 } // namespace media | 86 } // namespace media |
| 91 | 87 |
| 92 #endif // MEDIA_AUDIO_AUDIO_LOGGING_H_ | 88 #endif // MEDIA_AUDIO_AUDIO_LOGGING_H_ |
| OLD | NEW |