Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: content/renderer/media/media_stream_dependency_factory.cc

Issue 101063003: Add browser test for AEC dump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/media/media_stream_dependency_factory.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 pc_factory_ = factory; 665 pc_factory_ = factory;
666 webrtc::PeerConnectionFactoryInterface::Options factory_options; 666 webrtc::PeerConnectionFactoryInterface::Options factory_options;
667 factory_options.disable_sctp_data_channels = 667 factory_options.disable_sctp_data_channels =
668 cmd_line->HasSwitch(switches::kDisableSCTPDataChannels); 668 cmd_line->HasSwitch(switches::kDisableSCTPDataChannels);
669 factory_options.disable_encryption = 669 factory_options.disable_encryption =
670 cmd_line->HasSwitch(switches::kDisableWebRtcEncryption); 670 cmd_line->HasSwitch(switches::kDisableWebRtcEncryption);
671 pc_factory_->SetOptions(factory_options); 671 pc_factory_->SetOptions(factory_options);
672 672
673 // |aec_dump_file| will be invalid when dump is not enabled. 673 // |aec_dump_file| will be invalid when dump is not enabled.
674 if (aec_dump_file_ != base::kInvalidPlatformFileValue) { 674 if (aec_dump_file_ != base::kInvalidPlatformFileValue) {
675 FILE* aec_dump_file_stream = base::FdopenPlatformFile(aec_dump_file_, "w"); 675 StartAecDump(aec_dump_file_);
676 if (!aec_dump_file_stream) {
677 VLOG(1) << "Could not open AEC dump file.";
678 base::ClosePlatformFile(aec_dump_file_);
679 } else {
680 // |pc_factory_| takes ownership of |aec_dump_file_stream|.
681 pc_factory_->StartAecDump(aec_dump_file_stream);
682 }
683 aec_dump_file_ = base::kInvalidPlatformFileValue; 676 aec_dump_file_ = base::kInvalidPlatformFileValue;
684 } 677 }
685 678
686 return true; 679 return true;
687 } 680 }
688 681
689 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { 682 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() {
690 return pc_factory_.get() != NULL; 683 return pc_factory_.get() != NULL;
691 } 684 }
692 685
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 IPC_MESSAGE_HANDLER(MediaStreamMsg_EnableAecDump, OnAecDumpFile) 1013 IPC_MESSAGE_HANDLER(MediaStreamMsg_EnableAecDump, OnAecDumpFile)
1021 IPC_MESSAGE_HANDLER(MediaStreamMsg_DisableAecDump, OnDisableAecDump) 1014 IPC_MESSAGE_HANDLER(MediaStreamMsg_DisableAecDump, OnDisableAecDump)
1022 IPC_MESSAGE_UNHANDLED(handled = false) 1015 IPC_MESSAGE_UNHANDLED(handled = false)
1023 IPC_END_MESSAGE_MAP() 1016 IPC_END_MESSAGE_MAP()
1024 return handled; 1017 return handled;
1025 } 1018 }
1026 1019
1027 void MediaStreamDependencyFactory::OnAecDumpFile( 1020 void MediaStreamDependencyFactory::OnAecDumpFile(
1028 IPC::PlatformFileForTransit file_handle) { 1021 IPC::PlatformFileForTransit file_handle) {
1029 DCHECK_EQ(aec_dump_file_, base::kInvalidPlatformFileValue); 1022 DCHECK_EQ(aec_dump_file_, base::kInvalidPlatformFileValue);
1030 aec_dump_file_ = IPC::PlatformFileForTransitToPlatformFile(file_handle); 1023 if (PeerConnectionFactoryCreated()) {
1031 DCHECK_NE(aec_dump_file_, base::kInvalidPlatformFileValue); 1024 base::PlatformFile file =
1025 IPC::PlatformFileForTransitToPlatformFile(file_handle);
1026 DCHECK_NE(file, base::kInvalidPlatformFileValue);
1027 StartAecDump(file);
1028 } else {
1029 aec_dump_file_ = IPC::PlatformFileForTransitToPlatformFile(file_handle);
1030 DCHECK_NE(aec_dump_file_, base::kInvalidPlatformFileValue);
1031 }
1032 } 1032 }
1033 1033
1034 void MediaStreamDependencyFactory::OnDisableAecDump() { 1034 void MediaStreamDependencyFactory::OnDisableAecDump() {
1035 if (aec_dump_file_ != base::kInvalidPlatformFileValue) 1035 if (aec_dump_file_ != base::kInvalidPlatformFileValue)
1036 base::ClosePlatformFile(aec_dump_file_); 1036 base::ClosePlatformFile(aec_dump_file_);
1037 aec_dump_file_ = base::kInvalidPlatformFileValue; 1037 aec_dump_file_ = base::kInvalidPlatformFileValue;
1038 } 1038 }
1039 1039
1040 void MediaStreamDependencyFactory::StartAecDump(
1041 const base::PlatformFile& aec_dump_file) {
1042 FILE* aec_dump_file_stream = base::FdopenPlatformFile(aec_dump_file, "w");
1043 if (!aec_dump_file_stream) {
1044 VLOG(1) << "Could not open AEC dump file.";
1045 base::ClosePlatformFile(aec_dump_file);
1046 } else {
1047 // |pc_factory_| takes ownership of |aec_dump_file_stream|.
1048 pc_factory_->StartAecDump(aec_dump_file_stream);
1049 }
1050 }
1051
1040 } // namespace content 1052 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_dependency_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698