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

Unified Diff: media/audio/audio_output_controller.h

Issue 2443573003: Factor out AudioOutputDelegate from AudioRendererHost. (Closed)
Patch Set: Simplify. Created 4 years, 2 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_output_controller.h
diff --git a/media/audio/audio_output_controller.h b/media/audio/audio_output_controller.h
index 856716f7774f943f9342b1c951d53eef6fce6091..de4bb0fe5ed33051349e42db25a399f138f20acf 100644
--- a/media/audio/audio_output_controller.h
+++ b/media/audio/audio_output_controller.h
@@ -71,10 +71,10 @@ class MEDIA_EXPORT AudioOutputController
// following methods are called on the audio manager thread.
class MEDIA_EXPORT EventHandler {
public:
- virtual void OnCreated() = 0;
- virtual void OnPlaying() = 0;
- virtual void OnPaused() = 0;
- virtual void OnError() = 0;
+ virtual void OnControllerCreated() = 0;
+ virtual void OnControllerPlaying() = 0;
+ virtual void OnControllerPaused() = 0;
+ virtual void OnControllerError() = 0;
protected:
virtual ~EventHandler() {}
@@ -108,14 +108,16 @@ class MEDIA_EXPORT AudioOutputController
// Factory method for creating an AudioOutputController.
// This also creates and opens an AudioOutputStream on the audio manager
// thread, and if this is successful, the |event_handler| will receive an
- // OnCreated() call from the same audio manager thread. |audio_manager| must
- // outlive AudioOutputController.
+ // OnControllerCreated() call from the same audio manager thread.
+ // |audio_manager| must outlive AudioOutputController.
// The |output_device_id| can be either empty (default device) or specify a
// specific hardware device for audio output.
static scoped_refptr<AudioOutputController> Create(
- AudioManager* audio_manager, EventHandler* event_handler,
- const AudioParameters& params, const std::string& output_device_id,
- SyncReader* sync_reader);
+ AudioManager* audio_manager,
+ EventHandler* event_handler,
+ const AudioParameters& params,
+ const std::string& output_device_id,
+ std::unique_ptr<SyncReader> sync_reader);
// Indicates whether audio power level analysis will be performed. If false,
// ReadCurrentPowerAndClip() can not be called.
@@ -188,6 +190,9 @@ class MEDIA_EXPORT AudioOutputController
// audio_power_monitor.h for usage. This may be called on any thread.
std::pair<float, bool> ReadCurrentPowerAndClip();
+ // Accessor for enabling communication to the reader.
+ SyncReader* reader() { return sync_reader_.get(); }
+
protected:
// Internal state of the source.
enum State {
@@ -207,10 +212,11 @@ class MEDIA_EXPORT AudioOutputController
~AudioOutputController() override;
private:
- AudioOutputController(AudioManager* audio_manager, EventHandler* handler,
+ AudioOutputController(AudioManager* audio_manager,
+ EventHandler* handler,
const AudioParameters& params,
const std::string& output_device_id,
- SyncReader* sync_reader);
+ std::unique_ptr<SyncReader> sync_reader);
// The following methods are executed on the audio manager thread.
void DoCreate(bool is_for_device_change);
@@ -263,7 +269,7 @@ class MEDIA_EXPORT AudioOutputController
State state_;
// SyncReader is used only in low latency mode for synchronous reading.
- SyncReader* const sync_reader_;
+ const std::unique_ptr<SyncReader> sync_reader_;
// The message loop of audio manager thread that this object runs on.
const scoped_refptr<base::SingleThreadTaskRunner> message_loop_;

Powered by Google App Engine
This is Rietveld 408576698