Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(944)

Unified Diff: media/audio/audio_system.h

Issue 2763383002: Switching AudioInputDeviceManager from using AudioManager interface to AudioSystem one. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/audio/audio_system.h
diff --git a/media/audio/audio_system.h b/media/audio/audio_system.h
index 66dc622db267575d189e74adc5fb4729c6fbc6c7..a55bf8c44255aed8327afabbac9e1306e640847f 100644
--- a/media/audio/audio_system.h
+++ b/media/audio/audio_system.h
@@ -6,6 +6,7 @@
#define MEDIA_AUDIO_AUDIO_SYSTEM_H_
#include "base/callback.h"
+#include "base/memory/weak_ptr.h"
#include "media/audio/audio_device_description.h"
#include "media/base/audio_parameters.h"
#include "media/base/media_export.h"
@@ -22,6 +23,13 @@ class AudioManager;
// to Mojo audio service.
class MEDIA_EXPORT AudioSystem {
public:
+ class OnAudioThreadDeleter {
+ public:
+ void operator()(const AudioSystem* instance) const;
+ };
+
+ using UniquePtr = std::unique_ptr<AudioSystem, OnAudioThreadDeleter>;
+
// Replies are asynchronously sent from audio system thread to the thread the
// call is issued on. Attention! Since audio system thread may outlive all the
// others, callbacks must always be bound to weak pointers!
@@ -29,7 +37,9 @@ class MEDIA_EXPORT AudioSystem {
using OnBoolCallback = base::Callback<void(bool)>;
using OnDeviceDescriptionsCallback =
base::Callback<void(AudioDeviceDescriptions)>;
+ using OnDeviceIdCallback = base::Callback<void(const std::string&)>;
+ // Must not be called on audio thread, since it outlives the global pointer.
static AudioSystem* Get();
virtual ~AudioSystem();
@@ -59,9 +69,18 @@ class MEDIA_EXPORT AudioSystem {
// Replies with device descriptions of input audio devices if |for_input| is
// true, and of output audio devices otherwise.
virtual void GetDeviceDescriptions(
- OnDeviceDescriptionsCallback on_descriptions_cp,
+ OnDeviceDescriptionsCallback on_descriptions_cb,
bool for_input) = 0;
+ virtual void GetAssociatedOutputDeviceID(
+ const std::string& input_device_id,
+ OnDeviceIdCallback on_device_id_cb) = 0;
+
+ // To be used on audio thread only.
DaleCurtis 2017/03/22 19:08:34 Sorry, this is bad practice, can you find another
+ // AudioSystem instance must be posted to its task runner in form of a weak
+ // pointer, since the task runner outlives it.
+ virtual base::WeakPtr<AudioSystem> GetWeakPtr() = 0;
+
virtual base::SingleThreadTaskRunner* GetTaskRunner() const = 0;
// Must not be used for anything but stream creation.

Powered by Google App Engine
This is Rietveld 408576698