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

Unified Diff: content/renderer/media/webrtc/peer_connection_dependency_factory.cc

Issue 334743006: Support multiple files for AEC dump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again... 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/webrtc/peer_connection_dependency_factory.cc
diff --git a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
index a9652e797cc2303c4b9aa4702d17d951960f9dcd..f2f7f1d109b24b975286dfeeea9a6e48fa2de036 100644
--- a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
+++ b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
@@ -172,6 +172,8 @@ PeerConnectionDependencyFactory::PeerConnectionDependencyFactory(
PeerConnectionDependencyFactory::~PeerConnectionDependencyFactory() {
CleanupPeerConnectionFactory();
+ if (aec_dump_message_filter_)
+ aec_dump_message_filter_->RemoveDelegate(this);
}
blink::WebRTCPeerConnectionHandler*
@@ -347,9 +349,16 @@ void PeerConnectionDependencyFactory::CreatePeerConnectionFactory() {
cmd_line->HasSwitch(switches::kDisableWebRtcEncryption);
pc_factory_->SetOptions(factory_options);
- // |aec_dump_file| will be invalid when dump is not enabled.
- if (aec_dump_file_.IsValid())
- StartAecDump(aec_dump_file_.Pass());
+ // TODO(xians): Remove the following code after kDisableAudioTrackProcessing
+ // is removed.
+ if (!MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()) {
+ aec_dump_message_filter_ = AecDumpMessageFilter::Get();
+ // In unit tests not creating a message filter, |aec_dump_message_filter_|
+ // will be NULL. We can just ignore that. Other unit tests and browser tests
+ // ensure that we do get the filter when we should.
+ if (aec_dump_message_filter_)
+ aec_dump_message_filter_->AddDelegate(this);
+ }
}
bool PeerConnectionDependencyFactory::PeerConnectionFactoryCreated() {
@@ -612,56 +621,30 @@ PeerConnectionDependencyFactory::GetWebRtcWorkerThread() const {
return chrome_worker_thread_.message_loop_proxy();
}
-bool PeerConnectionDependencyFactory::OnControlMessageReceived(
- const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(PeerConnectionDependencyFactory, message)
- IPC_MESSAGE_HANDLER(MediaStreamMsg_EnableAecDump, OnAecDumpFile)
- IPC_MESSAGE_HANDLER(MediaStreamMsg_DisableAecDump, OnDisableAecDump)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
void PeerConnectionDependencyFactory::OnAecDumpFile(
- IPC::PlatformFileForTransit file_handle) {
- DCHECK(!aec_dump_file_.IsValid());
+ const IPC::PlatformFileForTransit& file_handle) {
+ DCHECK(CalledOnValidThread());
+ DCHECK(!MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled());
+ DCHECK(PeerConnectionFactoryCreated());
+
base::File file = IPC::PlatformFileForTransitToFile(file_handle);
DCHECK(file.IsValid());
- if (MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()) {
- EnsureWebRtcAudioDeviceImpl();
- GetWebRtcAudioDevice()->EnableAecDump(file.Pass());
- return;
- }
-
- // TODO(xians): Remove the following code after kDisableAudioTrackProcessing
- // is removed.
- if (PeerConnectionFactoryCreated())
- StartAecDump(file.Pass());
- else
- aec_dump_file_ = file.Pass();
+ // |pc_factory_| always takes ownership of |aec_dump_file|. If StartAecDump()
+ // fails, |aec_dump_file| will be closed.
+ if (!GetPcFactory()->StartAecDump(file.TakePlatformFile()))
+ VLOG(1) << "Could not start AEC dump.";
}
void PeerConnectionDependencyFactory::OnDisableAecDump() {
- if (MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()) {
- // Do nothing if OnAecDumpFile() has never been called.
- if (GetWebRtcAudioDevice())
- GetWebRtcAudioDevice()->DisableAecDump();
- return;
- }
-
- // TODO(xians): Remove the following code after kDisableAudioTrackProcessing
- // is removed.
- if (aec_dump_file_.IsValid())
- aec_dump_file_.Close();
+ DCHECK(CalledOnValidThread());
+ DCHECK(!MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled());
+ // Do nothing. We never disable AEC dump for non-track-processing case.
}
-void PeerConnectionDependencyFactory::StartAecDump(base::File aec_dump_file) {
- // |pc_factory_| always takes ownership of |aec_dump_file|. If StartAecDump()
- // fails, |aec_dump_file| will be closed.
- if (!GetPcFactory()->StartAecDump(aec_dump_file.TakePlatformFile()))
- VLOG(1) << "Could not start AEC dump.";
+void PeerConnectionDependencyFactory::OnIpcClosing() {
+ DCHECK(CalledOnValidThread());
+ aec_dump_message_filter_ = NULL;
}
void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() {
« no previous file with comments | « content/renderer/media/webrtc/peer_connection_dependency_factory.h ('k') | content/renderer/media/webrtc_audio_capturer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698