| Index: content/browser/renderer_host/media/audio_renderer_host.h
|
| diff --git a/content/browser/renderer_host/media/audio_renderer_host.h b/content/browser/renderer_host/media/audio_renderer_host.h
|
| index afdb31b2b2ab6889a8200f562b056271e6af7ad3..c8e489257441533fa86d8b596465545cbaa2168f 100644
|
| --- a/content/browser/renderer_host/media/audio_renderer_host.h
|
| +++ b/content/browser/renderer_host/media/audio_renderer_host.h
|
| @@ -46,14 +46,18 @@
|
| #include <memory>
|
| #include <string>
|
| #include <utility>
|
| +#include <vector>
|
|
|
| #include "base/atomic_ref_count.h"
|
| #include "base/gtest_prod_util.h"
|
| #include "base/logging.h"
|
| #include "base/macros.h"
|
| #include "base/memory/ref_counted.h"
|
| +#include "base/memory/shared_memory.h"
|
| #include "base/process/process.h"
|
| #include "base/sequenced_task_runner_helpers.h"
|
| +#include "base/sync_socket.h"
|
| +#include "content/browser/renderer_host/media/audio_output_delegate.h"
|
| #include "content/browser/renderer_host/media/media_devices_manager.h"
|
| #include "content/common/content_export.h"
|
| #include "content/public/browser/browser_message_filter.h"
|
| @@ -79,7 +83,9 @@ class MediaStreamManager;
|
| class MediaStreamUIProxy;
|
| class ResourceContext;
|
|
|
| -class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
|
| +class CONTENT_EXPORT AudioRendererHost
|
| + : public BrowserMessageFilter,
|
| + private AudioOutputDelegate::EventHandler {
|
| public:
|
| // Called from UI thread from the owner of this object.
|
| AudioRendererHost(int render_process_id,
|
| @@ -112,9 +118,6 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
|
| FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, CreateMockStream);
|
| FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, MockStreamDataConversation);
|
|
|
| - class AudioEntry;
|
| - typedef std::map<int, AudioEntry*> AudioEntryMap;
|
| -
|
| // Internal callback type for access requests to output devices.
|
| // |have_access| is true only if there is permission to access the device.
|
| typedef base::Callback<void(bool have_access)> OutputDeviceAccessCB;
|
| @@ -129,6 +132,13 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
|
|
|
| ~AudioRendererHost() override;
|
|
|
| + // AudioOutputDelegate::EventHandler implementation
|
| + void OnStreamCreated(int stream_id,
|
| + base::SharedMemory* shared_memory,
|
| + base::CancelableSyncSocket* foreign_socket) override;
|
| + void OnStreamError(int stream_id) override;
|
| + void OnStreamStateChanged(bool is_playing) override;
|
| +
|
| // Methods called on IO thread ----------------------------------------------
|
|
|
| // Audio related IPC message handlers.
|
| @@ -168,11 +178,6 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
|
|
|
| // Helper methods.
|
|
|
| - // Complete the process of creating an audio stream. This will set up the
|
| - // shared memory or shared socket in low latency mode and send the
|
| - // NotifyStreamCreated message to the peer.
|
| - void DoCompleteCreation(int stream_id);
|
| -
|
| // Called after the |render_frame_id| provided to OnCreateStream() was
|
| // validated. When |is_valid| is false, this calls ReportErrorAndClose().
|
| void DidValidateRenderFrame(int stream_id, bool is_valid);
|
| @@ -186,20 +191,12 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
|
| // Send an error message to the renderer.
|
| void SendErrorMessage(int stream_id);
|
|
|
| - // Delete an audio entry, notifying observers first. This is called by
|
| - // AudioOutputController after it has closed.
|
| - void DeleteEntry(std::unique_ptr<AudioEntry> entry);
|
| -
|
| // Send an error message to the renderer, then close the stream.
|
| void ReportErrorAndClose(int stream_id);
|
|
|
| - // A helper method to look up a AudioEntry identified by |stream_id|.
|
| - // Returns NULL if not found.
|
| - AudioEntry* LookupById(int stream_id);
|
| -
|
| - // A helper method to update the number of playing streams and alert the
|
| - // ResourceScheduler when the renderer starts or stops playing an audiostream.
|
| - void UpdateNumPlayingStreams(AudioEntry* entry, bool is_playing);
|
| + // A helper method to look up a AudioOutputDelegate identified by |stream_id|.
|
| + // Returns nullptr if not found.
|
| + AudioOutputDelegate* LookupById(int stream_id);
|
|
|
| // Check if the renderer process has access to the requested output device.
|
| void CheckOutputDeviceAccess(int render_frame_id,
|
| @@ -256,8 +253,11 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
|
| // Used to access to AudioInputDeviceManager.
|
| MediaStreamManager* media_stream_manager_;
|
|
|
| - // A map of stream IDs to audio sources.
|
| - AudioEntryMap audio_entries_;
|
| + using AudioOutputDelegateList =
|
| + std::vector<std::unique_ptr<AudioOutputDelegate>>;
|
| +
|
| + // A list of the current open streams.
|
| + AudioOutputDelegateList delegates_;
|
|
|
| // The number of streams in the playing state. Atomic read safe from any
|
| // thread, but should only be updated from the IO thread.
|
|
|