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

Unified Diff: media/audio/audio_output_device.h

Issue 1703473002: Make AudioOutputDevice restartable and reinitializable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new_mixing
Patch Set: Changes from olka@, adding callback lock, removing stopping hack, rebase. Created 4 years, 8 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_device.h
diff --git a/media/audio/audio_output_device.h b/media/audio/audio_output_device.h
index 532f45fe4a13eeb6b8b2884292e28652da3690f1..cee37063ce0589b044b2e87593cb73c0962c2624 100644
--- a/media/audio/audio_output_device.h
+++ b/media/audio/audio_output_device.h
@@ -80,7 +80,8 @@
namespace media {
class MEDIA_EXPORT AudioOutputDevice
- : NON_EXPORTED_BASE(public AudioRendererSink),
+ : NON_EXPORTED_BASE(public RestartableAudioRendererSink),
+ NON_EXPORTED_BASE(public AudioRendererSink::RenderCallback),
NON_EXPORTED_BASE(public AudioOutputIPCDelegate),
NON_EXPORTED_BASE(public ScopedTaskRunnerObserver) {
public:
@@ -97,7 +98,7 @@ class MEDIA_EXPORT AudioOutputDevice
// AudioRendererSink implementation.
void Initialize(const AudioParameters& params,
- RenderCallback* callback) override;
+ AudioRendererSink::RenderCallback* callback) override;
void Start() override;
void Stop() override;
void Play() override;
@@ -134,15 +135,24 @@ class MEDIA_EXPORT AudioOutputDevice
PLAYING, // Playing back. Can Pause()/Stop().
};
+ // media::AudioRendererSink::RenderCallback implementation.
+ // These two functions are called on the audio worker thread.
+ int Render(media::AudioBus* audio_bus,
+ uint32_t frames_delayed,
+ uint32_t frames_skipped) override;
+ void OnRenderError() override;
+
// Methods called on IO thread ----------------------------------------------
// The following methods are tasks posted on the IO thread that need to
// be executed on that thread. They use AudioOutputIPC to send IPC messages
// upon state changes.
void RequestDeviceAuthorizationOnIOThread();
- void CreateStreamOnIOThread(const AudioParameters& params);
+ void InitializeOnIOThread(const AudioParameters& params,
+ AudioRendererSink::RenderCallback* callback);
+ void CreateStreamOnIOThread();
void PlayOnIOThread();
void PauseOnIOThread();
- void ShutDownOnIOThread();
+ void StopOnIOThread();
void SetVolumeOnIOThread(double volume);
// base::MessageLoop::DestructionObserver implementation for the IO loop.
@@ -151,7 +161,8 @@ class MEDIA_EXPORT AudioOutputDevice
AudioParameters audio_parameters_;
- RenderCallback* callback_;
+ base::Lock callback_lock_;
+ AudioRendererSink::RenderCallback* callback_;
// A pointer to the IPC layer that takes care of sending requests over to
// the AudioRendererHost. Only valid when state_ != IPC_CLOSED and must only

Powered by Google App Engine
This is Rietveld 408576698