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/media/capture/web_contents_audio_input_stream.h" | 5 #include "content/browser/media/capture/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/bind_to_current_loop.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
14 #include "content/browser/media/capture/audio_mirroring_manager.h" | 15 #include "content/browser/media/capture/audio_mirroring_manager.h" |
15 #include "content/browser/media/capture/web_contents_capture_util.h" | 16 #include "content/browser/media/capture/web_contents_capture_util.h" |
16 #include "content/browser/media/capture/web_contents_tracker.h" | 17 #include "content/browser/media/capture/web_contents_tracker.h" |
17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/browser/render_frame_host.h" | 19 #include "content/public/browser/render_frame_host.h" |
19 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
20 #include "media/audio/virtual_audio_input_stream.h" | 21 #include "media/audio/virtual_audio_input_stream.h" |
21 #include "media/audio/virtual_audio_output_stream.h" | 22 #include "media/audio/virtual_audio_output_stream.h" |
22 #include "media/base/bind_to_current_loop.h" | |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 class WebContentsAudioInputStream::Impl | 26 class WebContentsAudioInputStream::Impl |
27 : public base::RefCountedThreadSafe<WebContentsAudioInputStream::Impl>, | 27 : public base::RefCountedThreadSafe<WebContentsAudioInputStream::Impl>, |
28 public AudioMirroringManager::MirroringDestination { | 28 public AudioMirroringManager::MirroringDestination { |
29 public: | 29 public: |
30 // Takes ownership of |mixer_stream|. The rest outlive this instance. | 30 // Takes ownership of |mixer_stream|. The rest outlive this instance. |
31 Impl(int render_process_id, int main_render_frame_id, | 31 Impl(int render_process_id, int main_render_frame_id, |
32 AudioMirroringManager* mirroring_manager, | 32 AudioMirroringManager* mirroring_manager, |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 256 |
257 void WebContentsAudioInputStream::Impl::QueryForMatches( | 257 void WebContentsAudioInputStream::Impl::QueryForMatches( |
258 const std::set<SourceFrameRef>& candidates, | 258 const std::set<SourceFrameRef>& candidates, |
259 const MatchesCallback& results_callback) { | 259 const MatchesCallback& results_callback) { |
260 BrowserThread::PostTask( | 260 BrowserThread::PostTask( |
261 BrowserThread::UI, | 261 BrowserThread::UI, |
262 FROM_HERE, | 262 FROM_HERE, |
263 base::Bind(&Impl::QueryForMatchesOnUIThread, | 263 base::Bind(&Impl::QueryForMatchesOnUIThread, |
264 this, | 264 this, |
265 candidates, | 265 candidates, |
266 media::BindToCurrentLoop(results_callback))); | 266 base::BindToCurrentLoop(results_callback))); |
267 } | 267 } |
268 | 268 |
269 void WebContentsAudioInputStream::Impl::QueryForMatchesOnUIThread( | 269 void WebContentsAudioInputStream::Impl::QueryForMatchesOnUIThread( |
270 const std::set<SourceFrameRef>& candidates, | 270 const std::set<SourceFrameRef>& candidates, |
271 const MatchesCallback& results_callback) { | 271 const MatchesCallback& results_callback) { |
272 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 272 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
273 | 273 |
274 std::set<SourceFrameRef> matches; | 274 std::set<SourceFrameRef> matches; |
275 WebContents* const contents = tracker_->web_contents(); | 275 WebContents* const contents = tracker_->web_contents(); |
276 if (contents) { | 276 if (contents) { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 388 |
389 bool WebContentsAudioInputStream::GetAutomaticGainControl() { | 389 bool WebContentsAudioInputStream::GetAutomaticGainControl() { |
390 return impl_->mixer_stream()->GetAutomaticGainControl(); | 390 return impl_->mixer_stream()->GetAutomaticGainControl(); |
391 } | 391 } |
392 | 392 |
393 bool WebContentsAudioInputStream::IsMuted() { | 393 bool WebContentsAudioInputStream::IsMuted() { |
394 return false; | 394 return false; |
395 } | 395 } |
396 | 396 |
397 } // namespace content | 397 } // namespace content |
OLD | NEW |