OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "content/browser/renderer_host/media/web_contents_audio_input_stream.h" | 5 #include "content/browser/renderer_host/media/web_contents_audio_input_stream.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 int render_process_id, int render_view_id, | 109 int render_process_id, int render_view_id, |
110 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 110 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
111 AudioMirroringManager* mirroring_manager, | 111 AudioMirroringManager* mirroring_manager, |
112 const scoped_refptr<WebContentsTracker>& tracker, | 112 const scoped_refptr<WebContentsTracker>& tracker, |
113 media::VirtualAudioInputStream* mixer_stream) | 113 media::VirtualAudioInputStream* mixer_stream) |
114 : message_loop_(message_loop), mirroring_manager_(mirroring_manager), | 114 : message_loop_(message_loop), mirroring_manager_(mirroring_manager), |
115 tracker_(tracker), mixer_stream_(mixer_stream), state_(CONSTRUCTED), | 115 tracker_(tracker), mixer_stream_(mixer_stream), state_(CONSTRUCTED), |
116 target_render_process_id_(render_process_id), | 116 target_render_process_id_(render_process_id), |
117 target_render_view_id_(render_view_id), | 117 target_render_view_id_(render_view_id), |
118 callback_(NULL) { | 118 callback_(NULL) { |
119 DCHECK(message_loop_); | 119 DCHECK(message_loop_.get()); |
120 DCHECK(mirroring_manager_); | 120 DCHECK(mirroring_manager_); |
121 DCHECK(tracker_); | 121 DCHECK(tracker_.get()); |
122 DCHECK(mixer_stream_.get()); | 122 DCHECK(mixer_stream_.get()); |
123 } | 123 } |
124 | 124 |
125 WebContentsAudioInputStream::Impl::~Impl() { | 125 WebContentsAudioInputStream::Impl::~Impl() { |
126 DCHECK(state_ == CONSTRUCTED || state_ == CLOSED); | 126 DCHECK(state_ == CONSTRUCTED || state_ == CLOSED); |
127 } | 127 } |
128 | 128 |
129 bool WebContentsAudioInputStream::Impl::Open() { | 129 bool WebContentsAudioInputStream::Impl::Open() { |
130 DCHECK(message_loop_->BelongsToCurrentThread()); | 130 DCHECK(message_loop_->BelongsToCurrentThread()); |
131 | 131 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 target_render_process_id_, target_render_view_id_, | 230 target_render_process_id_, target_render_view_id_, |
231 make_scoped_refptr(this))); | 231 make_scoped_refptr(this))); |
232 } | 232 } |
233 | 233 |
234 media::AudioOutputStream* WebContentsAudioInputStream::Impl::AddInput( | 234 media::AudioOutputStream* WebContentsAudioInputStream::Impl::AddInput( |
235 const media::AudioParameters& params) { | 235 const media::AudioParameters& params) { |
236 // Note: The closure created here holds a reference to "this," which will | 236 // Note: The closure created here holds a reference to "this," which will |
237 // guarantee the VirtualAudioInputStream (mixer_stream_) outlives the | 237 // guarantee the VirtualAudioInputStream (mixer_stream_) outlives the |
238 // VirtualAudioOutputStream. | 238 // VirtualAudioOutputStream. |
239 return new media::VirtualAudioOutputStream( | 239 return new media::VirtualAudioOutputStream( |
240 params, message_loop_, mixer_stream_.get(), | 240 params, |
| 241 message_loop_.get(), |
| 242 mixer_stream_.get(), |
241 base::Bind(&Impl::ReleaseInput, this)); | 243 base::Bind(&Impl::ReleaseInput, this)); |
242 } | 244 } |
243 | 245 |
244 void WebContentsAudioInputStream::Impl::ReleaseInput( | 246 void WebContentsAudioInputStream::Impl::ReleaseInput( |
245 media::VirtualAudioOutputStream* stream) { | 247 media::VirtualAudioOutputStream* stream) { |
246 delete stream; | 248 delete stream; |
247 } | 249 } |
248 | 250 |
249 void WebContentsAudioInputStream::Impl::OnTargetChanged(int render_process_id, | 251 void WebContentsAudioInputStream::Impl::OnTargetChanged(int render_process_id, |
250 int render_view_id) { | 252 int render_view_id) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 340 |
339 void WebContentsAudioInputStream::SetAutomaticGainControl(bool enabled) { | 341 void WebContentsAudioInputStream::SetAutomaticGainControl(bool enabled) { |
340 impl_->mixer_stream()->SetAutomaticGainControl(enabled); | 342 impl_->mixer_stream()->SetAutomaticGainControl(enabled); |
341 } | 343 } |
342 | 344 |
343 bool WebContentsAudioInputStream::GetAutomaticGainControl() { | 345 bool WebContentsAudioInputStream::GetAutomaticGainControl() { |
344 return impl_->mixer_stream()->GetAutomaticGainControl(); | 346 return impl_->mixer_stream()->GetAutomaticGainControl(); |
345 } | 347 } |
346 | 348 |
347 } // namespace content | 349 } // namespace content |
OLD | NEW |