Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/renderer/media/webrtc_audio_device_impl.h" | 5 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/platform_file.h" | 9 #include "base/platform_file.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 455 DCHECK(capturer.get()); | 455 DCHECK(capturer.get()); |
| 456 base::AutoLock auto_lock(lock_); | 456 base::AutoLock auto_lock(lock_); |
| 457 capturers_.remove(capturer); | 457 capturers_.remove(capturer); |
| 458 } | 458 } |
| 459 | 459 |
| 460 scoped_refptr<WebRtcAudioCapturer> | 460 scoped_refptr<WebRtcAudioCapturer> |
| 461 WebRtcAudioDeviceImpl::GetDefaultCapturer() const { | 461 WebRtcAudioDeviceImpl::GetDefaultCapturer() const { |
| 462 base::AutoLock auto_lock(lock_); | 462 base::AutoLock auto_lock(lock_); |
| 463 // Use the last |capturer| which is from the latest getUserMedia call as | 463 // Use the last |capturer| which is from the latest getUserMedia call as |
| 464 // the default capture device. | 464 // the default capture device. |
| 465 for (CapturerList::const_reverse_iterator iter = capturers_.rbegin(); | 465 return capturers_.empty() ? NULL : capturers_.back(); |
|
Peter Kasting
2014/03/18 02:55:54
(Discussed this with xians to ensure this was real
| |
| 466 iter != capturers_.rend(); ++iter) { | |
| 467 return *iter; | |
| 468 } | |
| 469 | |
| 470 return NULL; | |
| 471 } | 466 } |
| 472 | 467 |
| 473 void WebRtcAudioDeviceImpl::AddPlayoutSink( | 468 void WebRtcAudioDeviceImpl::AddPlayoutSink( |
| 474 WebRtcPlayoutDataSource::Sink* sink) { | 469 WebRtcPlayoutDataSource::Sink* sink) { |
| 475 DCHECK(thread_checker_.CalledOnValidThread()); | 470 DCHECK(thread_checker_.CalledOnValidThread()); |
| 476 DCHECK(sink); | 471 DCHECK(sink); |
| 477 base::AutoLock auto_lock(lock_); | 472 base::AutoLock auto_lock(lock_); |
| 478 DCHECK(std::find(playout_sinks_.begin(), playout_sinks_.end(), sink) == | 473 DCHECK(std::find(playout_sinks_.begin(), playout_sinks_.end(), sink) == |
| 479 playout_sinks_.end()); | 474 playout_sinks_.end()); |
| 480 playout_sinks_.push_back(sink); | 475 playout_sinks_.push_back(sink); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 539 return; | 534 return; |
| 540 | 535 |
| 541 default_capturer->StartAecDump(aec_dump_file_); | 536 default_capturer->StartAecDump(aec_dump_file_); |
| 542 | 537 |
| 543 // Invalidate the |aec_dump_file_| since the ownership of the file has been | 538 // Invalidate the |aec_dump_file_| since the ownership of the file has been |
| 544 // passed to WebRtc. | 539 // passed to WebRtc. |
| 545 aec_dump_file_ = base::kInvalidPlatformFileValue; | 540 aec_dump_file_ = base::kInvalidPlatformFileValue; |
| 546 } | 541 } |
| 547 | 542 |
| 548 } // namespace content | 543 } // namespace content |
| OLD | NEW |