summaryrefslogtreecommitdiffstats
path: root/media/audio/audio_logging.h
diff options
context:
space:
mode:
authordalecurtis@chromium.org <dalecurtis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-27 00:11:42 +0000
committerdalecurtis@chromium.org <dalecurtis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-27 00:11:42 +0000
commit69946cfc43819379756d2696e6d78a1e364ad5a6 (patch)
tree987776bf7293bdcfea4566aeeb2aff237e17d0dd /media/audio/audio_logging.h
parent0be774c7c37f0efeb3ce3a021f15edd308043ae1 (diff)
downloadchromium_src-69946cfc43819379756d2696e6d78a1e364ad5a6.zip
chromium_src-69946cfc43819379756d2696e6d78a1e364ad5a6.tar.gz
chromium_src-69946cfc43819379756d2696e6d78a1e364ad5a6.tar.bz2
Introduce new interface for MediaInternals updates.
New and shiny! - Interface lives in media. - Adds support for tracking AudioOutputStreams instead of just just AudioOutputControllers. - Adds support for tracking AudioInputControllers (which are 1:1 with AudioInputStreams currently). - Changes the API to be threadsafe from all threads instead of just the IO thread. - Removes the nebulous OnSetAudioStreamStatus(). - Removes OnMediaEvents() from the public media API, will still be callable from the content implementation. - "Improves" the style of media-internals. - Fixes JavaScript errors from firing WebUI code before the WebUI finishes loading. - Fixes style inconsistencies around table headers. - Fixes stuck "copy to clipboard" window. Screenshot of the new UI: http://i.imgur.com/lzQds3e.png Still to be done: - Actually log AudioOutputStreams and AudioInputStreams. BUG=260005 TEST=New unittest! Interface works. Review URL: https://codereview.chromium.org/68173025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237447 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/audio_logging.h')
-rw-r--r--media/audio/audio_logging.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/media/audio/audio_logging.h b/media/audio/audio_logging.h
new file mode 100644
index 0000000..1d8366b
--- /dev/null
+++ b/media/audio/audio_logging.h
@@ -0,0 +1,84 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_AUDIO_AUDIO_LOGGING_H_
+#define MEDIA_AUDIO_AUDIO_LOGGING_H_
+
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+
+namespace media {
+class AudioParameters;
+
+// AudioLog logs state information about an active audio component. Each method
+// takes a |component_id| along with method specific information. Its methods
+// are safe to call from any thread.
+class AudioLog {
+ public:
+ virtual ~AudioLog() {}
+
+ // Called when an audio component is created. |params| are the parameters of
+ // the created stream. |input_device_id| and |output_device_id| are the
+ // respective device ids for input and output. Either one or both may be
+ // specified.
+ virtual void OnCreated(int component_id,
+ const media::AudioParameters& params,
+ const std::string& input_device_id,
+ const std::string& output_device_id) = 0;
+
+ // Called when an audio component is started, generally this is synonymous
+ // with "playing."
+ virtual void OnStarted(int component_id) = 0;
+
+ // Called when an audio component is stopped, generally this is synonymous
+ // with "paused."
+ virtual void OnStopped(int component_id) = 0;
+
+ // Called when an audio component is closed, generally this is synonymous
+ // with "deleted."
+ virtual void OnClosed(int component_id) = 0;
+
+ // Called when an audio component encounters an error.
+ virtual void OnError(int component_id) = 0;
+
+ // Called when an audio component changes volume. |volume| is the new volume.
+ virtual void OnSetVolume(int component_id, double volume) = 0;
+};
+
+// AudioLogFactory dispenses AudioLog instances to owning classes for tracking
+// AudioComponent behavior. All AudioComponents have the concept of an owning
+// class:
+//
+// - AudioInputRendererHost for AudioInputController
+// - AudioRendererHost for AudioOutputController
+// - AudioOutputDispatcherImpl for AudioOutputStream
+//
+// Each of these owning classes may own multiple instances of each component, as
+// such each AudioLog supports logging for multiple instances.
+class AudioLogFactory {
+ public:
+ enum AudioComponent {
+ // Input controllers have a 1:1 mapping with streams, so there's no need to
+ // track both controllers and streams.
+ AUDIO_INPUT_CONTROLLER,
+ // Output controllers may or may not be backed by an active stream, so we
+ // need to track both controllers and streams.
+ AUDIO_OUTPUT_CONTROLLER,
+ AUDIO_OUTPUT_STREAM,
+ AUDIO_COMPONENT_MAX
+ };
+
+ // Create a new AudioLog object for tracking the behavior for one or more
+ // instances of the given component. Each instance of an "owning" class must
+ // create its own AudioLog.
+ virtual scoped_ptr<AudioLog> CreateAudioLog(AudioComponent component) = 0;
+
+ protected:
+ virtual ~AudioLogFactory() {}
+};
+
+} // namespace media
+
+#endif // MEDIA_AUDIO_AUDIO_LOGGING_H_