| Index: content/renderer/media/media_stream_dependency_factory.cc
|
| diff --git a/content/renderer/media/media_stream_dependency_factory.cc b/content/renderer/media/media_stream_dependency_factory.cc
|
| index 33b8011041771482216496b0484d72a482baebaa..e87c7548a9d52df940b924803775186a4870ec79 100644
|
| --- a/content/renderer/media/media_stream_dependency_factory.cc
|
| +++ b/content/renderer/media/media_stream_dependency_factory.cc
|
| @@ -672,14 +672,7 @@ bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() {
|
|
|
| // |aec_dump_file| will be invalid when dump is not enabled.
|
| if (aec_dump_file_ != base::kInvalidPlatformFileValue) {
|
| - FILE* aec_dump_file_stream = base::FdopenPlatformFile(aec_dump_file_, "w");
|
| - if (!aec_dump_file_stream) {
|
| - VLOG(1) << "Could not open AEC dump file.";
|
| - base::ClosePlatformFile(aec_dump_file_);
|
| - } else {
|
| - // |pc_factory_| takes ownership of |aec_dump_file_stream|.
|
| - pc_factory_->StartAecDump(aec_dump_file_stream);
|
| - }
|
| + StartAecDump(aec_dump_file_);
|
| aec_dump_file_ = base::kInvalidPlatformFileValue;
|
| }
|
|
|
| @@ -1027,8 +1020,15 @@ bool MediaStreamDependencyFactory::OnControlMessageReceived(
|
| void MediaStreamDependencyFactory::OnAecDumpFile(
|
| IPC::PlatformFileForTransit file_handle) {
|
| DCHECK_EQ(aec_dump_file_, base::kInvalidPlatformFileValue);
|
| - aec_dump_file_ = IPC::PlatformFileForTransitToPlatformFile(file_handle);
|
| - DCHECK_NE(aec_dump_file_, base::kInvalidPlatformFileValue);
|
| + if (PeerConnectionFactoryCreated()) {
|
| + base::PlatformFile file =
|
| + IPC::PlatformFileForTransitToPlatformFile(file_handle);
|
| + DCHECK_NE(file, base::kInvalidPlatformFileValue);
|
| + StartAecDump(file);
|
| + } else {
|
| + aec_dump_file_ = IPC::PlatformFileForTransitToPlatformFile(file_handle);
|
| + DCHECK_NE(aec_dump_file_, base::kInvalidPlatformFileValue);
|
| + }
|
| }
|
|
|
| void MediaStreamDependencyFactory::OnDisableAecDump() {
|
| @@ -1037,4 +1037,16 @@ void MediaStreamDependencyFactory::OnDisableAecDump() {
|
| aec_dump_file_ = base::kInvalidPlatformFileValue;
|
| }
|
|
|
| +void MediaStreamDependencyFactory::StartAecDump(
|
| + const base::PlatformFile& aec_dump_file) {
|
| + FILE* aec_dump_file_stream = base::FdopenPlatformFile(aec_dump_file, "w");
|
| + if (!aec_dump_file_stream) {
|
| + VLOG(1) << "Could not open AEC dump file.";
|
| + base::ClosePlatformFile(aec_dump_file);
|
| + } else {
|
| + // |pc_factory_| takes ownership of |aec_dump_file_stream|.
|
| + pc_factory_->StartAecDump(aec_dump_file_stream);
|
| + }
|
| +}
|
| +
|
| } // namespace content
|
|
|