| 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" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 void QueryForMatchesOnUIThread(const std::set<SourceFrameRef>& candidates, | 84 void QueryForMatchesOnUIThread(const std::set<SourceFrameRef>& candidates, |
| 85 const MatchesCallback& results_callback); | 85 const MatchesCallback& results_callback); |
| 86 media::AudioOutputStream* AddInput( | 86 media::AudioOutputStream* AddInput( |
| 87 const media::AudioParameters& params) override; | 87 const media::AudioParameters& params) override; |
| 88 | 88 |
| 89 // Callback which is run when |stream| is closed. Deletes |stream|. | 89 // Callback which is run when |stream| is closed. Deletes |stream|. |
| 90 void ReleaseInput(media::VirtualAudioOutputStream* stream); | 90 void ReleaseInput(media::VirtualAudioOutputStream* stream); |
| 91 | 91 |
| 92 // Called by WebContentsTracker when the target of the audio mirroring has | 92 // Called by WebContentsTracker when the target of the audio mirroring has |
| 93 // changed. | 93 // changed. |
| 94 void OnTargetChanged(RenderWidgetHost* target); | 94 void OnTargetChanged(bool had_target); |
| 95 | 95 |
| 96 // Injected dependencies. | 96 // Injected dependencies. |
| 97 const int initial_render_process_id_; | 97 const int initial_render_process_id_; |
| 98 const int initial_main_render_frame_id_; | 98 const int initial_main_render_frame_id_; |
| 99 AudioMirroringManager* const mirroring_manager_; | 99 AudioMirroringManager* const mirroring_manager_; |
| 100 const scoped_refptr<WebContentsTracker> tracker_; | 100 const scoped_refptr<WebContentsTracker> tracker_; |
| 101 // The AudioInputStream implementation that handles the audio conversion and | 101 // The AudioInputStream implementation that handles the audio conversion and |
| 102 // mixing details. | 102 // mixing details. |
| 103 const scoped_ptr<media::VirtualAudioInputStream> mixer_stream_; | 103 const scoped_ptr<media::VirtualAudioInputStream> mixer_stream_; |
| 104 | 104 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 params, | 298 params, |
| 299 mixer_stream_.get(), | 299 mixer_stream_.get(), |
| 300 base::Bind(&Impl::ReleaseInput, this)); | 300 base::Bind(&Impl::ReleaseInput, this)); |
| 301 } | 301 } |
| 302 | 302 |
| 303 void WebContentsAudioInputStream::Impl::ReleaseInput( | 303 void WebContentsAudioInputStream::Impl::ReleaseInput( |
| 304 media::VirtualAudioOutputStream* stream) { | 304 media::VirtualAudioOutputStream* stream) { |
| 305 delete stream; | 305 delete stream; |
| 306 } | 306 } |
| 307 | 307 |
| 308 void WebContentsAudioInputStream::Impl::OnTargetChanged( | 308 void WebContentsAudioInputStream::Impl::OnTargetChanged(bool had_target) { |
| 309 RenderWidgetHost* target) { | |
| 310 DCHECK(thread_checker_.CalledOnValidThread()); | 309 DCHECK(thread_checker_.CalledOnValidThread()); |
| 311 | 310 |
| 312 is_target_lost_ = !target; | 311 is_target_lost_ = !had_target; |
| 313 | 312 |
| 314 if (state_ == MIRRORING) { | 313 if (state_ == MIRRORING) { |
| 315 if (is_target_lost_) { | 314 if (is_target_lost_) { |
| 316 ReportError(); | 315 ReportError(); |
| 317 Stop(); | 316 Stop(); |
| 318 } else { | 317 } else { |
| 319 StartMirroring(); | 318 StartMirroring(); |
| 320 } | 319 } |
| 321 } | 320 } |
| 322 } | 321 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 387 |
| 389 bool WebContentsAudioInputStream::GetAutomaticGainControl() { | 388 bool WebContentsAudioInputStream::GetAutomaticGainControl() { |
| 390 return impl_->mixer_stream()->GetAutomaticGainControl(); | 389 return impl_->mixer_stream()->GetAutomaticGainControl(); |
| 391 } | 390 } |
| 392 | 391 |
| 393 bool WebContentsAudioInputStream::IsMuted() { | 392 bool WebContentsAudioInputStream::IsMuted() { |
| 394 return false; | 393 return false; |
| 395 } | 394 } |
| 396 | 395 |
| 397 } // namespace content | 396 } // namespace content |
| OLD | NEW |