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

Unified Diff: chrome/browser/media/webrtc/audio_debug_recordings_handler.cc

Issue 2582703003: Audio output debug recording. (Closed)
Patch Set: Code review. Created 3 years, 11 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 | « no previous file | content/browser/browser_main_loop.cc » ('j') | content/browser/webrtc/webrtc_internals.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/webrtc/audio_debug_recordings_handler.cc
diff --git a/chrome/browser/media/webrtc/audio_debug_recordings_handler.cc b/chrome/browser/media/webrtc/audio_debug_recordings_handler.cc
index cd712ad7f6340b2de732535308bbbc4bc8f1377f..cc25172e7efec48bc4530be80893eac843eeef3b 100644
--- a/chrome/browser/media/webrtc/audio_debug_recordings_handler.cc
+++ b/chrome/browser/media/webrtc/audio_debug_recordings_handler.cc
@@ -17,6 +17,7 @@
#include "chrome/common/chrome_switches.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
+#include "media/audio/audio_manager.h"
using content::BrowserThread;
@@ -106,6 +107,13 @@ void AudioDebugRecordingsHandler::DoStartAudioDebugRecordings(
log_directory, ++current_audio_debug_recordings_id_);
host->EnableAudioDebugRecordings(prefix_path);
+ // AudioManager is deleted on the audio thread, and the AudioManager outlives
+ // this object, so it's safe to post unretained.
o1ka 2017/01/31 11:00:11 Add why media::AudioManager::Get() is safe (or bet
Henrik Grunell 2017/02/08 11:29:37 Changed to a pointer injected.
+ media::AudioManager* audio_manager = media::AudioManager::Get();
Max Morin 2017/01/30 10:24:01 The AudioManager::Get() pointer is nulled on the U
Henrik Grunell 2017/01/30 14:11:26 I'll double check that tomorrow.
Henrik Grunell 2017/02/08 11:29:37 This class lives on the UI thread, which is implic
+ audio_manager->GetTaskRunner()->PostTask(
+ FROM_HERE, base::Bind(&media::AudioManager::EnableOutputDebugRecording,
+ base::Unretained(audio_manager), prefix_path));
+
if (delay.is_zero()) {
const bool is_stopped = false, is_manual_stop = false;
callback.Run(prefix_path.AsUTF8Unsafe(), is_stopped, is_manual_stop);
@@ -149,7 +157,15 @@ void AudioDebugRecordingsHandler::DoStopAudioDebugRecordings(
return;
}
+ // 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)));
+
host->DisableAudioDebugRecordings();
+
is_audio_debug_recordings_in_progress_ = false;
const bool is_stopped = true;
callback.Run(prefix_path.AsUTF8Unsafe(), is_stopped, is_manual_stop);
« no previous file with comments | « no previous file | content/browser/browser_main_loop.cc » ('j') | content/browser/webrtc/webrtc_internals.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698