Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_BASE_AUDIO_LOGGING_H_ | |
|
acolwell GONE FROM CHROMIUM
2013/11/21 00:53:58
It seems like media/audio would be a better home f
DaleCurtis
2013/11/21 01:18:30
Done.
| |
| 6 #define MEDIA_BASE_AUDIO_LOGGING_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 | |
| 12 namespace media { | |
| 13 class AudioParameters; | |
|
acolwell GONE FROM CHROMIUM
2013/11/21 00:53:58
nit: move this down into the media namespace below
DaleCurtis
2013/11/21 01:18:30
Done.
| |
| 14 } | |
| 15 | |
| 16 namespace media { | |
| 17 | |
| 18 // AudioLog logs state information about an active audio component. Each method | |
| 19 // takes a |component_id|, a monotonically increasing integer, along with method | |
|
acolwell GONE FROM CHROMIUM
2013/11/21 00:53:58
nit: Why is the monotonically increasing character
DaleCurtis
2013/11/21 01:18:30
It'd be nice if they were, but you're right that's
| |
| 20 // specific information. Its methods are safe to call from any thread. | |
| 21 class AudioLog { | |
| 22 public: | |
| 23 // Called when an audio component is created. |params| are the parameters of | |
| 24 // the created stream. |input_device_id| and |output_device_id| are the | |
| 25 // respective device ids for input and output. Either one or both may be | |
| 26 // specified. | |
| 27 virtual void OnCreated(int component_id, | |
| 28 const media::AudioParameters& params, | |
| 29 const std::string& input_device_id, | |
| 30 const std::string& output_device_id) = 0; | |
| 31 | |
| 32 // Called when an audio component is started, generally this is synonymous | |
| 33 // with "playing." | |
| 34 virtual void OnStarted(int component_id) = 0; | |
| 35 | |
| 36 // Called when an audio component is stopped, generally this is synonymous | |
| 37 // with "paused." | |
| 38 virtual void OnStopped(int component_id) = 0; | |
| 39 | |
| 40 // Called when an audio component is deleted, generally this is synonymous | |
| 41 // with "closed." | |
| 42 virtual void OnDeleted(int component_id) = 0; | |
| 43 | |
| 44 // Called when an audio component changes volume. |volume| is the new volume. | |
| 45 virtual void OnSetVolume(int component_id, double volume) = 0; | |
| 46 | |
| 47 protected: | |
| 48 virtual ~AudioLog() {} | |
| 49 }; | |
| 50 | |
| 51 // AudioLogDispenser dispenses AudioLog instances to owning classes for tracking | |
| 52 // AudioComponent behavior. All AudioComponents have the concept of an owning | |
| 53 // class: | |
| 54 // | |
| 55 // - AudioInputRendererHost for AudioInputController | |
| 56 // - AudioRendererHost for AudioOutputController | |
| 57 // - AudioOutputDispatcherImpl for AudioOutputStream | |
| 58 // | |
| 59 // Each of these owning classes may own multiple instances of each component, as | |
| 60 // such each AudioLog supports logging for multiple instances. | |
| 61 class AudioLogDispenser { | |
|
acolwell GONE FROM CHROMIUM
2013/11/21 00:53:58
nit: s/Dispenser/Factory since this appears to be
DaleCurtis
2013/11/21 01:18:30
Done.
| |
| 62 public: | |
| 63 enum AudioComponent { | |
| 64 // Input controllers have a 1:1 mapping with streams, so there's no need to | |
| 65 // track both controllers and streams. | |
| 66 AUDIO_INPUT_CONTROLLER, | |
| 67 // Output controllers may or may not be backed by an active stream, so we | |
| 68 // need to track both controllers and streams. | |
| 69 AUDIO_OUTPUT_CONTROLLER, | |
| 70 AUDIO_OUTPUT_STREAM, | |
| 71 }; | |
| 72 | |
| 73 // Create a new AudioLog object for tracking the behavior for one or more | |
| 74 // instances of the given component. Each instance of an "owning" class must | |
| 75 // create its own AudioLog. | |
| 76 virtual scoped_ptr<AudioLog> CreateAudioLog(AudioComponent component) = 0; | |
| 77 | |
| 78 protected: | |
| 79 virtual ~AudioLogDispenser() {} | |
| 80 }; | |
| 81 | |
| 82 } // namespace media | |
| 83 | |
| 84 #endif // MEDIA_BASE_AUDIO_LOGGING_H_ | |
| OLD | NEW |