Commit a43fc4ac authored by xians@chromium.org's avatar xians@chromium.org

Fix the aec dump crash when users disable aec dump without closing the "Save File" overlay.

BUG=378713
TEST=manual test:
1Launch chrome and navigate to chrome://webrtc-internals/. 
2.Expand "Create Dump" option >> Check the checkbox option of "enable Diagnostic audio recordings". 
3.With "Save File" overlay opened, again uncheck the same checkbox.

Review URL: https://codereview.chromium.org/310463002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274523 0039d316-1c4b-4281-b951-d872f2087c98
parent 940b67da
...@@ -246,6 +246,10 @@ void WebRTCInternals::EnableAecDump(content::WebContents* web_contents) { ...@@ -246,6 +246,10 @@ void WebRTCInternals::EnableAecDump(content::WebContents* web_contents) {
void WebRTCInternals::DisableAecDump() { void WebRTCInternals::DisableAecDump() {
#if defined(ENABLE_WEBRTC) #if defined(ENABLE_WEBRTC)
aec_dump_enabled_ = false; aec_dump_enabled_ = false;
// Tear down the dialog since the user has unchecked the AEC dump box.
select_file_dialog_ = NULL;
for (RenderProcessHost::iterator i( for (RenderProcessHost::iterator i(
content::RenderProcessHost::AllHostsIterator()); content::RenderProcessHost::AllHostsIterator());
!i.IsAtEnd(); i.Advance()) { !i.IsAtEnd(); i.Advance()) {
......
...@@ -643,7 +643,9 @@ void PeerConnectionDependencyFactory::OnAecDumpFile( ...@@ -643,7 +643,9 @@ void PeerConnectionDependencyFactory::OnAecDumpFile(
void PeerConnectionDependencyFactory::OnDisableAecDump() { void PeerConnectionDependencyFactory::OnDisableAecDump() {
if (MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()) { if (MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()) {
GetWebRtcAudioDevice()->DisableAecDump(); // Do nothing if OnAecDumpFile() has never been called.
if (GetWebRtcAudioDevice())
GetWebRtcAudioDevice()->DisableAecDump();
return; return;
} }
......
...@@ -524,7 +524,14 @@ bool WebRtcAudioDeviceImpl::GetAuthorizedDeviceInfoForAudioRenderer( ...@@ -524,7 +524,14 @@ bool WebRtcAudioDeviceImpl::GetAuthorizedDeviceInfoForAudioRenderer(
void WebRtcAudioDeviceImpl::EnableAecDump(base::File aec_dump_file) { void WebRtcAudioDeviceImpl::EnableAecDump(base::File aec_dump_file) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(aec_dump_file.IsValid()); DCHECK(aec_dump_file.IsValid());
DCHECK(!aec_dump_file_.IsValid());
// Close the previous AEC dump file description if it has not been consumed.
// This can happen if no getUserMedia has been made yet.
// TODO(xians): DCHECK(!aec_dump_file_.IsValid()) after the browser
// guarantees it won't call EnableAecDump() more than once in a row.
if (aec_dump_file_.IsValid())
aec_dump_file_.Close();
aec_dump_file_ = aec_dump_file.Pass(); aec_dump_file_ = aec_dump_file.Pass();
MaybeStartAecDump(); MaybeStartAecDump();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment