Index: content/browser/webrtc/webrtc_internals.cc |
diff --git a/content/browser/webrtc/webrtc_internals.cc b/content/browser/webrtc/webrtc_internals.cc |
index 51163e96e3439eaee4b11387502201b880dde4a6..cedea0733661fd67a5b6afc8b5b868b0d859bfa4 100644 |
--- a/content/browser/webrtc/webrtc_internals.cc |
+++ b/content/browser/webrtc/webrtc_internals.cc |
@@ -19,6 +19,7 @@ |
#include "content/public/browser/web_contents.h" |
#include "device/power_save_blocker/power_save_blocker.h" |
#include "ipc/ipc_platform_file.h" |
+#include "media/audio/audio_manager.h" |
#include "media/media_features.h" |
#if defined(OS_WIN) |
@@ -323,13 +324,20 @@ void WebRTCInternals::DisableAudioDebugRecordings() { |
// Tear down the dialog since the user has unchecked the audio debug |
// recordings box. |
- select_file_dialog_ = NULL; |
+ select_file_dialog_ = nullptr; |
for (RenderProcessHost::iterator i( |
content::RenderProcessHost::AllHostsIterator()); |
!i.IsAtEnd(); i.Advance()) { |
i.GetCurrentValue()->DisableAudioDebugRecordings(); |
} |
+ |
+ // AudioManager is deleted on the audio thread, and the AudioManager outlives |
+ // this object, so it's safe to post unretained. |
+ media::AudioManager* audio_manager = media::AudioManager::Get(); |
+ audio_manager->GetTaskRunner()->PostTask( |
+ FROM_HERE, base::Bind(&media::AudioManager::DisableOutputDebugRecording, |
+ base::Unretained(audio_manager))); |
#endif |
} |
@@ -491,12 +499,21 @@ void WebRTCInternals::EnableAudioDebugRecordingsOnAllRenderProcessHosts() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
audio_debug_recordings_ = true; |
+ |
for (RenderProcessHost::iterator i( |
content::RenderProcessHost::AllHostsIterator()); |
!i.IsAtEnd(); i.Advance()) { |
i.GetCurrentValue()->EnableAudioDebugRecordings( |
audio_debug_recordings_file_path_); |
} |
+ |
+ // AudioManager is deleted on the audio thread, and the AudioManager outlives |
+ // this object, so it's safe to post unretained. |
+ media::AudioManager* audio_manager = media::AudioManager::Get(); |
+ audio_manager->GetTaskRunner()->PostTask( |
+ FROM_HERE, base::Bind(&media::AudioManager::EnableOutputDebugRecording, |
+ base::Unretained(audio_manager), |
+ audio_debug_recordings_file_path_)); |
} |
void WebRTCInternals::EnableEventLogRecordingsOnAllRenderProcessHosts() { |