| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // AudioRendererHost serves audio related requests from AudioRenderer which | 5 // AudioRendererHost serves audio related requests from AudioRenderer which |
| 6 // lives inside the render process and provide access to audio hardware. | 6 // lives inside the render process and provide access to audio hardware. |
| 7 // | 7 // |
| 8 // This class is owned by BrowserRenderProcessHost, and instantiated on UI | 8 // This class is owned by BrowserRenderProcessHost, and instantiated on UI |
| 9 // thread, but all other operations and method calls happen on IO thread, so we | 9 // thread, but all other operations and method calls happen on IO thread, so we |
| 10 // need to be extra careful about the lifetime of this object. AudioManager is a | 10 // need to be extra careful about the lifetime of this object. AudioManager is a |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 AudioMirroringManager* mirroring_manager, | 74 AudioMirroringManager* mirroring_manager, |
| 75 MediaInternals* media_internals, | 75 MediaInternals* media_internals, |
| 76 MediaStreamManager* media_stream_manager); | 76 MediaStreamManager* media_stream_manager); |
| 77 | 77 |
| 78 // Calls |callback| with the list of AudioOutputControllers for this object. | 78 // Calls |callback| with the list of AudioOutputControllers for this object. |
| 79 void GetOutputControllers( | 79 void GetOutputControllers( |
| 80 int render_view_id, | 80 int render_view_id, |
| 81 const RenderViewHost::GetAudioOutputControllersCallback& callback) const; | 81 const RenderViewHost::GetAudioOutputControllersCallback& callback) const; |
| 82 | 82 |
| 83 // BrowserMessageFilter implementation. | 83 // BrowserMessageFilter implementation. |
| 84 virtual void OnChannelClosing() override; | 84 void OnChannelClosing() override; |
| 85 virtual void OnDestruct() const override; | 85 void OnDestruct() const override; |
| 86 virtual bool OnMessageReceived(const IPC::Message& message) override; | 86 bool OnMessageReceived(const IPC::Message& message) override; |
| 87 | 87 |
| 88 // Returns true if any streams managed by this host are actively playing. Can | 88 // Returns true if any streams managed by this host are actively playing. Can |
| 89 // be called from any thread. | 89 // be called from any thread. |
| 90 bool HasActiveAudio(); | 90 bool HasActiveAudio(); |
| 91 | 91 |
| 92 // Returns true if any streams managed by the RenderView identified by | 92 // Returns true if any streams managed by the RenderView identified by |
| 93 // |render_view_id| are actively playing. Can be called from any thread. | 93 // |render_view_id| are actively playing. Can be called from any thread. |
| 94 bool RenderViewHasActiveAudio(int render_view_id) const; | 94 bool RenderViewHasActiveAudio(int render_view_id) const; |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 friend class AudioRendererHostTest; | 97 friend class AudioRendererHostTest; |
| 98 friend class BrowserThread; | 98 friend class BrowserThread; |
| 99 friend class base::DeleteHelper<AudioRendererHost>; | 99 friend class base::DeleteHelper<AudioRendererHost>; |
| 100 friend class MockAudioRendererHost; | 100 friend class MockAudioRendererHost; |
| 101 friend class TestAudioRendererHost; | 101 friend class TestAudioRendererHost; |
| 102 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, CreateMockStream); | 102 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, CreateMockStream); |
| 103 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, MockStreamDataConversation); | 103 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, MockStreamDataConversation); |
| 104 | 104 |
| 105 class AudioEntry; | 105 class AudioEntry; |
| 106 typedef std::map<int, AudioEntry*> AudioEntryMap; | 106 typedef std::map<int, AudioEntry*> AudioEntryMap; |
| 107 | 107 |
| 108 virtual ~AudioRendererHost(); | 108 ~AudioRendererHost() override; |
| 109 | 109 |
| 110 // Methods called on IO thread ---------------------------------------------- | 110 // Methods called on IO thread ---------------------------------------------- |
| 111 | 111 |
| 112 // Audio related IPC message handlers. | 112 // Audio related IPC message handlers. |
| 113 | 113 |
| 114 // Creates an audio output stream with the specified format whose data is | 114 // Creates an audio output stream with the specified format whose data is |
| 115 // produced by an entity in the render view referenced by |render_view_id|. | 115 // produced by an entity in the render view referenced by |render_view_id|. |
| 116 // |session_id| is used for unified IO to find out which input device to be | 116 // |session_id| is used for unified IO to find out which input device to be |
| 117 // opened for the stream. For clients that do not use unified IO, | 117 // opened for the stream. For clients that do not use unified IO, |
| 118 // |session_id| will be ignored. | 118 // |session_id| will be ignored. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 // The number of streams in the playing state. | 181 // The number of streams in the playing state. |
| 182 base::AtomicRefCount num_playing_streams_; | 182 base::AtomicRefCount num_playing_streams_; |
| 183 | 183 |
| 184 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 184 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
| 185 }; | 185 }; |
| 186 | 186 |
| 187 } // namespace content | 187 } // namespace content |
| 188 | 188 |
| 189 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 189 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
| OLD | NEW |