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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 if (MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()) { | 645 if (MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()) { |
646 GetWebRtcAudioDevice()->DisableAecDump(); | 646 // Do nothing if OnAecDumpFile() has never been called. |
| 647 if (GetWebRtcAudioDevice()) |
| 648 GetWebRtcAudioDevice()->DisableAecDump(); |
647 return; | 649 return; |
648 } | 650 } |
649 | 651 |
650 // TODO(xians): Remove the following code after kDisableAudioTrackProcessing | 652 // TODO(xians): Remove the following code after kDisableAudioTrackProcessing |
651 // is removed. | 653 // is removed. |
652 if (aec_dump_file_.IsValid()) | 654 if (aec_dump_file_.IsValid()) |
653 aec_dump_file_.Close(); | 655 aec_dump_file_.Close(); |
654 } | 656 } |
655 | 657 |
656 void PeerConnectionDependencyFactory::StartAecDump(base::File aec_dump_file) { | 658 void PeerConnectionDependencyFactory::StartAecDump(base::File aec_dump_file) { |
657 // |pc_factory_| always takes ownership of |aec_dump_file|. If StartAecDump() | 659 // |pc_factory_| always takes ownership of |aec_dump_file|. If StartAecDump() |
658 // fails, |aec_dump_file| will be closed. | 660 // fails, |aec_dump_file| will be closed. |
659 if (!GetPcFactory()->StartAecDump(aec_dump_file.TakePlatformFile())) | 661 if (!GetPcFactory()->StartAecDump(aec_dump_file.TakePlatformFile())) |
660 VLOG(1) << "Could not start AEC dump."; | 662 VLOG(1) << "Could not start AEC dump."; |
661 } | 663 } |
662 | 664 |
663 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { | 665 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { |
664 if (audio_device_) | 666 if (audio_device_) |
665 return; | 667 return; |
666 | 668 |
667 audio_device_ = new WebRtcAudioDeviceImpl(); | 669 audio_device_ = new WebRtcAudioDeviceImpl(); |
668 } | 670 } |
669 | 671 |
670 } // namespace content | 672 } // namespace content |
OLD | NEW |