Index: chrome/browser/media/webrtc_logging_handler_host.h |
diff --git a/chrome/browser/media/webrtc_logging_handler_host.h b/chrome/browser/media/webrtc_logging_handler_host.h |
index c2b3e32202a331f4340cebbb1a46fa55718d8494..d62d6ccfc539ce2259c7f67b5a21f74674d79c89 100644 |
--- a/chrome/browser/media/webrtc_logging_handler_host.h |
+++ b/chrome/browser/media/webrtc_logging_handler_host.h |
@@ -77,6 +77,10 @@ class WebRtcLoggingHandlerHost : public content::BrowserMessageFilter { |
typedef base::Callback<void(bool, const std::string&)> GenericDoneCallback; |
typedef base::Callback<void(bool, const std::string&, const std::string&)> |
UploadDoneCallback; |
+ typedef base::Callback<void(const std::string&)> |
+ AudioDebugRecordingsErrorCallback; |
+ typedef base::Callback<void(const std::string&, bool, bool)> |
+ AudioDebugRecordingsCallback; |
WebRtcLoggingHandlerHost(Profile* profile, WebRtcLogUploader* log_uploader); |
@@ -146,6 +150,27 @@ class WebRtcLoggingHandlerHost : public content::BrowserMessageFilter { |
size_t packet_length, |
bool incoming); |
+ // Starts an audio debug recording. The recording lasts the given |delay|, |
+ // unless |delay| is zero, in which case recording will continue until |
+ // StopAudioDebugRecordings() is explicitly invoked. |
+ // |callback| is invoked once recording stops. If |delay| is zero |
+ // |callback| is invoked once recording starts. |
+ // If a recording was already in progress, |error_callback| is invoked instead |
+ // of |callback|. |
+ void StartAudioDebugRecordings( |
+ content::RenderProcessHost* host, |
+ base::TimeDelta delay, |
+ const AudioDebugRecordingsCallback& callback, |
+ const AudioDebugRecordingsErrorCallback& error_callback); |
+ |
+ // Stops an audio debug recording. |callback| is invoked once recording |
+ // stops. If no recording was in progress, |error_callback| is invoked instead |
+ // of |callback|. |
+ void StopAudioDebugRecordings( |
+ content::RenderProcessHost* host, |
+ const AudioDebugRecordingsCallback& callback, |
+ const AudioDebugRecordingsErrorCallback& error_callback); |
+ |
private: |
// States used for protecting from function calls made at non-allowed points |
// in time. For example, StartLogging() is only allowed in CLOSED state. |
@@ -232,6 +257,23 @@ class WebRtcLoggingHandlerHost : public content::BrowserMessageFilter { |
bool success, |
const std::string& error_message); |
+ // Helper for starting audio debug recordings. |
+ void DoStartAudioDebugRecordings( |
+ content::RenderProcessHost* host, |
+ base::TimeDelta delay, |
+ const AudioDebugRecordingsCallback& callback, |
+ const AudioDebugRecordingsErrorCallback& error_callback, |
+ const base::FilePath& log_directory); |
+ |
+ // Helper for stopping audio debug recordings. |
+ void DoStopAudioDebugRecordings( |
+ content::RenderProcessHost* host, |
+ bool is_manual_stop, |
+ uint64_t audio_debug_recordings_id, |
+ const AudioDebugRecordingsCallback& callback, |
+ const AudioDebugRecordingsErrorCallback& error_callback, |
+ const base::FilePath& log_directory); |
+ |
scoped_ptr<WebRtcLogBuffer> log_buffer_; |
// The profile associated with our renderer process. |
@@ -273,6 +315,12 @@ class WebRtcLoggingHandlerHost : public content::BrowserMessageFilter { |
// Ownership lies with the browser process. |
WebRtcLogUploader* const log_uploader_; |
+ // Must be accessed on the UI thread. |
+ bool is_audio_debug_recordings_in_progress_; |
+ |
+ // This counter allows saving each debug recording in separate files. |
+ uint64_t current_audio_debug_recordings_id_; |
+ |
DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost); |
}; |