Disabled pinch zooming in undocked devtools window.
[chromium-blink-merge.git] / media / audio / audio_logging.h
blob913b8ec4433552bf41e22e734ecd00896c2bb714
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.
5 #ifndef MEDIA_AUDIO_AUDIO_LOGGING_H_
6 #define MEDIA_AUDIO_AUDIO_LOGGING_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
12 namespace media {
13 class AudioParameters;
15 // AudioLog logs state information about an active audio component. Each method
16 // takes a |component_id| along with method specific information. Its methods
17 // are safe to call from any thread.
18 class AudioLog {
19 public:
20 virtual ~AudioLog() {}
22 // Called when an audio component is created. |params| are the parameters of
23 // the created stream. |device_id| is the id of the audio device opened by
24 // the created stream.
25 virtual void OnCreated(int component_id,
26 const media::AudioParameters& params,
27 const std::string& device_id) = 0;
29 // Called when an audio component is started, generally this is synonymous
30 // with "playing."
31 virtual void OnStarted(int component_id) = 0;
33 // Called when an audio component is stopped, generally this is synonymous
34 // with "paused."
35 virtual void OnStopped(int component_id) = 0;
37 // Called when an audio component is closed, generally this is synonymous
38 // with "deleted."
39 virtual void OnClosed(int component_id) = 0;
41 // Called when an audio component encounters an error.
42 virtual void OnError(int component_id) = 0;
44 // Called when an audio component changes volume. |volume| is the new volume.
45 virtual void OnSetVolume(int component_id, double volume) = 0;
48 // AudioLogFactory dispenses AudioLog instances to owning classes for tracking
49 // AudioComponent behavior. All AudioComponents have the concept of an owning
50 // class:
52 // - AudioInputRendererHost for AudioInputController
53 // - AudioRendererHost for AudioOutputController
54 // - AudioOutputDispatcherImpl for AudioOutputStream
56 // Each of these owning classes may own multiple instances of each component, as
57 // such each AudioLog supports logging for multiple instances.
58 class AudioLogFactory {
59 public:
60 enum AudioComponent {
61 // Input controllers have a 1:1 mapping with streams, so there's no need to
62 // track both controllers and streams.
63 AUDIO_INPUT_CONTROLLER,
64 // Output controllers may or may not be backed by an active stream, so we
65 // need to track both controllers and streams.
66 AUDIO_OUTPUT_CONTROLLER,
67 AUDIO_OUTPUT_STREAM,
68 AUDIO_COMPONENT_MAX
71 // Create a new AudioLog object for tracking the behavior for one or more
72 // instances of the given component. Each instance of an "owning" class must
73 // create its own AudioLog.
74 virtual scoped_ptr<AudioLog> CreateAudioLog(AudioComponent component) = 0;
76 protected:
77 virtual ~AudioLogFactory() {}
80 } // namespace media
82 #endif // MEDIA_AUDIO_AUDIO_LOGGING_H_