OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/media_stream_dependency_factory.h" | 5 #include "content/renderer/media/media_stream_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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
746 IPC_MESSAGE_HANDLER(MediaStreamMsg_EnableAecDump, OnAecDumpFile) | 746 IPC_MESSAGE_HANDLER(MediaStreamMsg_EnableAecDump, OnAecDumpFile) |
747 IPC_MESSAGE_HANDLER(MediaStreamMsg_DisableAecDump, OnDisableAecDump) | 747 IPC_MESSAGE_HANDLER(MediaStreamMsg_DisableAecDump, OnDisableAecDump) |
748 IPC_MESSAGE_UNHANDLED(handled = false) | 748 IPC_MESSAGE_UNHANDLED(handled = false) |
749 IPC_END_MESSAGE_MAP() | 749 IPC_END_MESSAGE_MAP() |
750 return handled; | 750 return handled; |
751 } | 751 } |
752 | 752 |
753 void MediaStreamDependencyFactory::OnAecDumpFile( | 753 void MediaStreamDependencyFactory::OnAecDumpFile( |
754 IPC::PlatformFileForTransit file_handle) { | 754 IPC::PlatformFileForTransit file_handle) { |
755 DCHECK_EQ(aec_dump_file_, base::kInvalidPlatformFileValue); | 755 DCHECK_EQ(aec_dump_file_, base::kInvalidPlatformFileValue); |
756 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
757 switches::kEnableAudioTrackProcessing)) { | |
758 EnsureWebRtcAudioDeviceImpl(); | |
759 GetWebRtcAudioDevice()->EnableAecDump(file_handle); | |
Henrik Grunell
2014/03/06 10:12:20
Have WebRtcAudioDeviceImpl::EnableAecDump take a b
no longer working on chromium
2014/03/06 18:57:21
Done.
| |
760 return; | |
761 } | |
762 | |
763 // TODO(xians): Remove the following code after kEnableAudioTrackProcessing | |
Henrik Grunell
2014/03/06 10:12:20
It shouldn't be removed when the flag is on by def
no longer working on chromium
2014/03/06 18:57:21
Done.
| |
764 // is on by default. | |
756 if (PeerConnectionFactoryCreated()) { | 765 if (PeerConnectionFactoryCreated()) { |
757 base::PlatformFile file = | 766 base::PlatformFile file = |
758 IPC::PlatformFileForTransitToPlatformFile(file_handle); | 767 IPC::PlatformFileForTransitToPlatformFile(file_handle); |
759 DCHECK_NE(file, base::kInvalidPlatformFileValue); | 768 DCHECK_NE(file, base::kInvalidPlatformFileValue); |
760 StartAecDump(file); | 769 StartAecDump(file); |
761 } else { | 770 } else { |
762 aec_dump_file_ = IPC::PlatformFileForTransitToPlatformFile(file_handle); | 771 aec_dump_file_ = IPC::PlatformFileForTransitToPlatformFile(file_handle); |
763 DCHECK_NE(aec_dump_file_, base::kInvalidPlatformFileValue); | 772 DCHECK_NE(aec_dump_file_, base::kInvalidPlatformFileValue); |
764 } | 773 } |
765 } | 774 } |
766 | 775 |
767 void MediaStreamDependencyFactory::OnDisableAecDump() { | 776 void MediaStreamDependencyFactory::OnDisableAecDump() { |
777 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
778 switches::kEnableAudioTrackProcessing)) { | |
779 GetWebRtcAudioDevice()->DisableAecDump(); | |
780 return; | |
781 } | |
782 | |
783 // TODO(xians): Remove the following code after kEnableAudioTrackProcessing | |
784 // is on by default. | |
768 if (aec_dump_file_ != base::kInvalidPlatformFileValue) | 785 if (aec_dump_file_ != base::kInvalidPlatformFileValue) |
769 base::ClosePlatformFile(aec_dump_file_); | 786 base::ClosePlatformFile(aec_dump_file_); |
770 aec_dump_file_ = base::kInvalidPlatformFileValue; | 787 aec_dump_file_ = base::kInvalidPlatformFileValue; |
771 } | 788 } |
772 | 789 |
773 void MediaStreamDependencyFactory::StartAecDump( | 790 void MediaStreamDependencyFactory::StartAecDump( |
774 const base::PlatformFile& aec_dump_file) { | 791 const base::PlatformFile& aec_dump_file) { |
775 // |pc_factory_| always takes ownership of |aec_dump_file|. If StartAecDump() | 792 // |pc_factory_| always takes ownership of |aec_dump_file|. If StartAecDump() |
776 // fails, |aec_dump_file| will be closed. | 793 // fails, |aec_dump_file| will be closed. |
777 if (!GetPcFactory()->StartAecDump(aec_dump_file)) | 794 if (!GetPcFactory()->StartAecDump(aec_dump_file)) |
778 VLOG(1) << "Could not start AEC dump."; | 795 VLOG(1) << "Could not start AEC dump."; |
779 } | 796 } |
780 | 797 |
781 void MediaStreamDependencyFactory::EnsureWebRtcAudioDeviceImpl() { | 798 void MediaStreamDependencyFactory::EnsureWebRtcAudioDeviceImpl() { |
782 if (audio_device_) | 799 if (audio_device_) |
783 return; | 800 return; |
784 | 801 |
785 audio_device_ = new WebRtcAudioDeviceImpl(); | 802 audio_device_ = new WebRtcAudioDeviceImpl(); |
786 } | 803 } |
787 | 804 |
788 } // namespace content | 805 } // namespace content |
OLD | NEW |