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

Unified Diff: content/browser/webrtc/webrtc_internals.cc

Issue 2582703003: Audio output debug recording. (Closed)
Patch Set: Code review. Created 3 years, 10 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
« no previous file with comments | « content/browser/webrtc/webrtc_audio_debug_recordings_browsertest.cc ('k') | media/audio/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/webrtc/webrtc_internals.cc
diff --git a/content/browser/webrtc/webrtc_internals.cc b/content/browser/webrtc/webrtc_internals.cc
index 677e7e26c6ea037c1bc73374c7128bd51e126e84..dee0c97f6e02867485153ec9df98751b36c5c7cb 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,22 @@ 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();
}
+
+ // It's safe to get the AudioManager pointer here. That pointer is invalidated
+ // on the UI thread, which we're on.
+ // AudioManager is deleted on the audio thread, and the AudioManager outlives
+ // this object, so it's safe to post unretained to the audio thread.
+ media::AudioManager* audio_manager = media::AudioManager::Get();
+ audio_manager->GetTaskRunner()->PostTask(
+ FROM_HERE, base::Bind(&media::AudioManager::DisableOutputDebugRecording,
+ base::Unretained(audio_manager)));
#endif
}
@@ -493,12 +503,23 @@ 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_);
}
+
+ // It's safe to get the AudioManager pointer here. That pointer is invalidated
+ // on the UI thread, which we're on.
+ // AudioManager is deleted on the audio thread, and the AudioManager outlives
+ // this object, so it's safe to post unretained to the audio thread.
+ 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() {
« no previous file with comments | « content/browser/webrtc/webrtc_audio_debug_recordings_browsertest.cc ('k') | media/audio/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698