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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop/message_loop_proxy.h" | 13 #include "base/message_loop/message_loop_proxy.h" |
14 #include "content/browser/browser_main_loop.h" | |
15 #include "content/browser/renderer_host/media/audio_mirroring_manager.h" | 14 #include "content/browser/renderer_host/media/audio_mirroring_manager.h" |
16 #include "content/browser/renderer_host/media/web_contents_capture_util.h" | 15 #include "content/browser/renderer_host/media/web_contents_capture_util.h" |
17 #include "content/browser/renderer_host/media/web_contents_tracker.h" | 16 #include "content/browser/renderer_host/media/web_contents_tracker.h" |
18 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
19 #include "media/audio/virtual_audio_input_stream.h" | 18 #include "media/audio/virtual_audio_input_stream.h" |
20 #include "media/audio/virtual_audio_output_stream.h" | 19 #include "media/audio/virtual_audio_output_stream.h" |
21 | 20 |
22 namespace content { | 21 namespace content { |
23 | 22 |
24 class WebContentsAudioInputStream::Impl | 23 class WebContentsAudioInputStream::Impl |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } else { | 273 } else { |
275 StartMirroring(); | 274 StartMirroring(); |
276 } | 275 } |
277 } | 276 } |
278 } | 277 } |
279 | 278 |
280 // static | 279 // static |
281 WebContentsAudioInputStream* WebContentsAudioInputStream::Create( | 280 WebContentsAudioInputStream* WebContentsAudioInputStream::Create( |
282 const std::string& device_id, | 281 const std::string& device_id, |
283 const media::AudioParameters& params, | 282 const media::AudioParameters& params, |
284 const scoped_refptr<base::MessageLoopProxy>& message_loop) { | 283 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
| 284 AudioMirroringManager* audio_mirroring_manager) { |
285 int render_process_id; | 285 int render_process_id; |
286 int render_view_id; | 286 int render_view_id; |
287 if (!WebContentsCaptureUtil::ExtractTabCaptureTarget( | 287 if (!WebContentsCaptureUtil::ExtractTabCaptureTarget( |
288 device_id, &render_process_id, &render_view_id)) { | 288 device_id, &render_process_id, &render_view_id)) { |
289 return NULL; | 289 return NULL; |
290 } | 290 } |
291 | 291 |
292 return new WebContentsAudioInputStream( | 292 return new WebContentsAudioInputStream( |
293 render_process_id, render_view_id, message_loop, | 293 render_process_id, render_view_id, message_loop, |
294 BrowserMainLoop::GetAudioMirroringManager(), | 294 audio_mirroring_manager, |
295 new WebContentsTracker(), | 295 new WebContentsTracker(), |
296 new media::VirtualAudioInputStream( | 296 new media::VirtualAudioInputStream( |
297 params, message_loop, | 297 params, message_loop, |
298 media::VirtualAudioInputStream::AfterCloseCallback())); | 298 media::VirtualAudioInputStream::AfterCloseCallback())); |
299 } | 299 } |
300 | 300 |
301 WebContentsAudioInputStream::WebContentsAudioInputStream( | 301 WebContentsAudioInputStream::WebContentsAudioInputStream( |
302 int render_process_id, int render_view_id, | 302 int render_process_id, int render_view_id, |
303 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 303 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
304 AudioMirroringManager* mirroring_manager, | 304 AudioMirroringManager* mirroring_manager, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 void WebContentsAudioInputStream::SetAutomaticGainControl(bool enabled) { | 341 void WebContentsAudioInputStream::SetAutomaticGainControl(bool enabled) { |
342 impl_->mixer_stream()->SetAutomaticGainControl(enabled); | 342 impl_->mixer_stream()->SetAutomaticGainControl(enabled); |
343 } | 343 } |
344 | 344 |
345 bool WebContentsAudioInputStream::GetAutomaticGainControl() { | 345 bool WebContentsAudioInputStream::GetAutomaticGainControl() { |
346 return impl_->mixer_stream()->GetAutomaticGainControl(); | 346 return impl_->mixer_stream()->GetAutomaticGainControl(); |
347 } | 347 } |
348 | 348 |
349 } // namespace content | 349 } // namespace content |
OLD | NEW |