OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/peer_connection_dependency_factory.h" | 5 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 | 635 |
636 // TODO(xians): Remove the following code after kDisableAudioTrackProcessing | 636 // TODO(xians): Remove the following code after kDisableAudioTrackProcessing |
637 // is removed. | 637 // is removed. |
638 if (PeerConnectionFactoryCreated()) | 638 if (PeerConnectionFactoryCreated()) |
639 StartAecDump(file.Pass()); | 639 StartAecDump(file.Pass()); |
640 else | 640 else |
641 aec_dump_file_ = file.Pass(); | 641 aec_dump_file_ = file.Pass(); |
642 } | 642 } |
643 | 643 |
644 void PeerConnectionDependencyFactory::OnDisableAecDump() { | 644 void PeerConnectionDependencyFactory::OnDisableAecDump() { |
| 645 // Do nothing if OnAecDumpFile() has never been called. |
| 646 if (!GetWebRtcAudioDevice()) |
| 647 return; |
| 648 |
645 if (MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()) { | 649 if (MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()) { |
646 GetWebRtcAudioDevice()->DisableAecDump(); | 650 GetWebRtcAudioDevice()->DisableAecDump(); |
647 return; | 651 return; |
648 } | 652 } |
649 | 653 |
650 // TODO(xians): Remove the following code after kDisableAudioTrackProcessing | 654 // TODO(xians): Remove the following code after kDisableAudioTrackProcessing |
651 // is removed. | 655 // is removed. |
652 if (aec_dump_file_.IsValid()) | 656 if (aec_dump_file_.IsValid()) |
653 aec_dump_file_.Close(); | 657 aec_dump_file_.Close(); |
654 } | 658 } |
655 | 659 |
656 void PeerConnectionDependencyFactory::StartAecDump(base::File aec_dump_file) { | 660 void PeerConnectionDependencyFactory::StartAecDump(base::File aec_dump_file) { |
657 // |pc_factory_| always takes ownership of |aec_dump_file|. If StartAecDump() | 661 // |pc_factory_| always takes ownership of |aec_dump_file|. If StartAecDump() |
658 // fails, |aec_dump_file| will be closed. | 662 // fails, |aec_dump_file| will be closed. |
659 if (!GetPcFactory()->StartAecDump(aec_dump_file.TakePlatformFile())) | 663 if (!GetPcFactory()->StartAecDump(aec_dump_file.TakePlatformFile())) |
660 VLOG(1) << "Could not start AEC dump."; | 664 VLOG(1) << "Could not start AEC dump."; |
661 } | 665 } |
662 | 666 |
663 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { | 667 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { |
664 if (audio_device_) | 668 if (audio_device_) |
665 return; | 669 return; |
666 | 670 |
667 audio_device_ = new WebRtcAudioDeviceImpl(); | 671 audio_device_ = new WebRtcAudioDeviceImpl(); |
668 } | 672 } |
669 | 673 |
670 } // namespace content | 674 } // namespace content |
OLD | NEW |