Chromium Code Reviews| 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..0574062a2406c80dcc9cf5dcac477590e0ee5b36 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. |
| + media::AudioManager::Get()->GetTaskRunner()->PostTask( |
|
DaleCurtis
2017/01/19 17:44:33
Just call Get() once and reuse value?
Henrik Grunell
2017/01/20 10:38:55
Done.
|
| + FROM_HERE, |
| + base::Bind(&media::AudioManager::EnableOutputDebugRecording, |
| + base::Unretained(media::AudioManager::Get()), 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,14 @@ 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::Get()->GetTaskRunner()->PostTask( |
| + FROM_HERE, base::Bind(&media::AudioManager::DisableOutputDebugRecording, |
| + base::Unretained(media::AudioManager::Get()))); |
| + |
| host->DisableAudioDebugRecordings(); |
| + |
| is_audio_debug_recordings_in_progress_ = false; |
| const bool is_stopped = true; |
| callback.Run(prefix_path.AsUTF8Unsafe(), is_stopped, is_manual_stop); |