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

Side by Side Diff: trunk/src/content/renderer/media/webrtc/peer_connection_dependency_factory.cc

Issue 318383002: Revert 275781 "Revert 273044 "Change kEnableAudioTrackProcessing..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 6 months 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
OLDNEW
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"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
12 #include "content/common/media/media_stream_messages.h" 12 #include "content/common/media/media_stream_messages.h"
13 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
14 #include "content/renderer/media/media_stream.h" 14 #include "content/renderer/media/media_stream.h"
15 #include "content/renderer/media/media_stream_audio_processor.h"
15 #include "content/renderer/media/media_stream_audio_processor_options.h" 16 #include "content/renderer/media/media_stream_audio_processor_options.h"
16 #include "content/renderer/media/media_stream_audio_source.h" 17 #include "content/renderer/media/media_stream_audio_source.h"
17 #include "content/renderer/media/media_stream_video_source.h" 18 #include "content/renderer/media/media_stream_video_source.h"
18 #include "content/renderer/media/media_stream_video_track.h" 19 #include "content/renderer/media/media_stream_video_track.h"
19 #include "content/renderer/media/peer_connection_identity_service.h" 20 #include "content/renderer/media/peer_connection_identity_service.h"
20 #include "content/renderer/media/rtc_media_constraints.h" 21 #include "content/renderer/media/rtc_media_constraints.h"
21 #include "content/renderer/media/rtc_peer_connection_handler.h" 22 #include "content/renderer/media/rtc_peer_connection_handler.h"
22 #include "content/renderer/media/rtc_video_decoder_factory.h" 23 #include "content/renderer/media/rtc_video_decoder_factory.h"
23 #include "content/renderer/media/rtc_video_encoder_factory.h" 24 #include "content/renderer/media/rtc_video_encoder_factory.h"
24 #include "content/renderer/media/webaudio_capturer_source.h" 25 #include "content/renderer/media/webaudio_capturer_source.h"
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 IPC_END_MESSAGE_MAP() 620 IPC_END_MESSAGE_MAP()
620 return handled; 621 return handled;
621 } 622 }
622 623
623 void PeerConnectionDependencyFactory::OnAecDumpFile( 624 void PeerConnectionDependencyFactory::OnAecDumpFile(
624 IPC::PlatformFileForTransit file_handle) { 625 IPC::PlatformFileForTransit file_handle) {
625 DCHECK(!aec_dump_file_.IsValid()); 626 DCHECK(!aec_dump_file_.IsValid());
626 base::File file = IPC::PlatformFileForTransitToFile(file_handle); 627 base::File file = IPC::PlatformFileForTransitToFile(file_handle);
627 DCHECK(file.IsValid()); 628 DCHECK(file.IsValid());
628 629
629 if (CommandLine::ForCurrentProcess()->HasSwitch( 630 if (MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()) {
630 switches::kEnableAudioTrackProcessing)) {
631 EnsureWebRtcAudioDeviceImpl(); 631 EnsureWebRtcAudioDeviceImpl();
632 GetWebRtcAudioDevice()->EnableAecDump(file.Pass()); 632 GetWebRtcAudioDevice()->EnableAecDump(file.Pass());
633 return; 633 return;
634 } 634 }
635 635
636 // TODO(xians): Remove the following code after kEnableAudioTrackProcessing 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 (CommandLine::ForCurrentProcess()->HasSwitch( 645 if (MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()) {
646 switches::kEnableAudioTrackProcessing)) {
647 // Do nothing if OnAecDumpFile() has never been called. 646 // Do nothing if OnAecDumpFile() has never been called.
648 if (GetWebRtcAudioDevice()) 647 if (GetWebRtcAudioDevice())
649 GetWebRtcAudioDevice()->DisableAecDump(); 648 GetWebRtcAudioDevice()->DisableAecDump();
650 return; 649 return;
651 } 650 }
652 651
653 // TODO(xians): Remove the following code after kEnableAudioTrackProcessing 652 // TODO(xians): Remove the following code after kDisableAudioTrackProcessing
654 // is removed. 653 // is removed.
655 if (aec_dump_file_.IsValid()) 654 if (aec_dump_file_.IsValid())
656 aec_dump_file_.Close(); 655 aec_dump_file_.Close();
657 } 656 }
658 657
659 void PeerConnectionDependencyFactory::StartAecDump(base::File aec_dump_file) { 658 void PeerConnectionDependencyFactory::StartAecDump(base::File aec_dump_file) {
660 // |pc_factory_| always takes ownership of |aec_dump_file|. If StartAecDump() 659 // |pc_factory_| always takes ownership of |aec_dump_file|. If StartAecDump()
661 // fails, |aec_dump_file| will be closed. 660 // fails, |aec_dump_file| will be closed.
662 if (!GetPcFactory()->StartAecDump(aec_dump_file.TakePlatformFile())) 661 if (!GetPcFactory()->StartAecDump(aec_dump_file.TakePlatformFile()))
663 VLOG(1) << "Could not start AEC dump."; 662 VLOG(1) << "Could not start AEC dump.";
664 } 663 }
665 664
666 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { 665 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() {
667 if (audio_device_) 666 if (audio_device_)
668 return; 667 return;
669 668
670 audio_device_ = new WebRtcAudioDeviceImpl(); 669 audio_device_ = new WebRtcAudioDeviceImpl();
671 } 670 }
672 671
673 } // namespace content 672 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698