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

Side by Side Diff: content/browser/renderer_host/media/audio_renderer_host.h

Issue 880393002: Fix webrtcAudioPrivate API to handle requests from <webview>s. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update test Created 5 years, 10 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 unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
41 41
42 #include "base/atomic_ref_count.h" 42 #include "base/atomic_ref_count.h"
43 #include "base/gtest_prod_util.h" 43 #include "base/gtest_prod_util.h"
44 #include "base/memory/ref_counted.h" 44 #include "base/memory/ref_counted.h"
45 #include "base/memory/scoped_ptr.h" 45 #include "base/memory/scoped_ptr.h"
46 #include "base/process/process.h" 46 #include "base/process/process.h"
47 #include "base/sequenced_task_runner_helpers.h" 47 #include "base/sequenced_task_runner_helpers.h"
48 #include "content/common/content_export.h" 48 #include "content/common/content_export.h"
49 #include "content/public/browser/browser_message_filter.h" 49 #include "content/public/browser/browser_message_filter.h"
50 #include "content/public/browser/browser_thread.h" 50 #include "content/public/browser/browser_thread.h"
51 #include "content/public/browser/render_view_host.h" 51 #include "content/public/browser/render_process_host.h"
52 #include "media/audio/audio_io.h" 52 #include "media/audio/audio_io.h"
53 #include "media/audio/audio_logging.h" 53 #include "media/audio/audio_logging.h"
54 #include "media/audio/audio_output_controller.h" 54 #include "media/audio/audio_output_controller.h"
55 #include "media/audio/simple_sources.h" 55 #include "media/audio/simple_sources.h"
56 56
57 namespace media { 57 namespace media {
58 class AudioManager; 58 class AudioManager;
59 class AudioParameters; 59 class AudioParameters;
60 } 60 }
61 61
62 namespace content { 62 namespace content {
63 63
64 class AudioMirroringManager; 64 class AudioMirroringManager;
65 class MediaInternals; 65 class MediaInternals;
66 class MediaStreamManager; 66 class MediaStreamManager;
67 class ResourceContext; 67 class ResourceContext;
68 68
69 class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter { 69 class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
70 public: 70 public:
71 // Called from UI thread from the owner of this object. 71 // Called from UI thread from the owner of this object.
72 AudioRendererHost(int render_process_id, 72 AudioRendererHost(int render_process_id,
73 media::AudioManager* audio_manager, 73 media::AudioManager* audio_manager,
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 const RenderProcessHost::GetAudioOutputControllersCallback&
81 const RenderViewHost::GetAudioOutputControllersCallback& callback) const; 81 callback) const;
82 82
83 // BrowserMessageFilter implementation. 83 // BrowserMessageFilter implementation.
84 void OnChannelClosing() override; 84 void OnChannelClosing() override;
85 void OnDestruct() const override; 85 void OnDestruct() const override;
86 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
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 void OnSetVolume(int stream_id, double volume); 137 void OnSetVolume(int stream_id, double volume);
138 138
139 // Complete the process of creating an audio stream. This will set up the 139 // Complete the process of creating an audio stream. This will set up the
140 // shared memory or shared socket in low latency mode and send the 140 // shared memory or shared socket in low latency mode and send the
141 // NotifyStreamCreated message to the peer. 141 // NotifyStreamCreated message to the peer.
142 void DoCompleteCreation(int stream_id); 142 void DoCompleteCreation(int stream_id);
143 143
144 // Send playing/paused status to the renderer. 144 // Send playing/paused status to the renderer.
145 void DoNotifyStreamStateChanged(int stream_id, bool is_playing); 145 void DoNotifyStreamStateChanged(int stream_id, bool is_playing);
146 146
147 RenderViewHost::AudioOutputControllerList DoGetOutputControllers( 147 RenderProcessHost::AudioOutputControllerList DoGetOutputControllers() const;
148 int render_view_id) const;
149 148
150 // Send an error message to the renderer. 149 // Send an error message to the renderer.
151 void SendErrorMessage(int stream_id); 150 void SendErrorMessage(int stream_id);
152 151
153 // Delete an audio entry, notifying observers first. This is called by 152 // Delete an audio entry, notifying observers first. This is called by
154 // AudioOutputController after it has closed. 153 // AudioOutputController after it has closed.
155 void DeleteEntry(scoped_ptr<AudioEntry> entry); 154 void DeleteEntry(scoped_ptr<AudioEntry> entry);
156 155
157 // Send an error message to the renderer, then close the stream. 156 // Send an error message to the renderer, then close the stream.
158 void ReportErrorAndClose(int stream_id); 157 void ReportErrorAndClose(int stream_id);
(...skipping 21 matching lines...) Expand all
180 179
181 // The number of streams in the playing state. 180 // The number of streams in the playing state.
182 base::AtomicRefCount num_playing_streams_; 181 base::AtomicRefCount num_playing_streams_;
183 182
184 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); 183 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost);
185 }; 184 };
186 185
187 } // namespace content 186 } // namespace content
188 187
189 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ 188 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/webrtc_audio_private.idl ('k') | content/browser/renderer_host/media/audio_renderer_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698