Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_MEDIA_AUDIO_DEBUG_RECORDINGS_HANDLER_H_ | |
| 6 #define CHROME_BROWSER_MEDIA_AUDIO_DEBUG_RECORDINGS_HANDLER_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 #include <stdint.h> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "build/build_config.h" | |
| 13 #include "content/public/browser/browser_message_filter.h" | |
|
Henrik Grunell
2016/02/23 15:29:10
Remove. Seems like other includes could be removed
terelius-chromium
2016/03/02 10:01:10
Done.
| |
| 14 #include "content/public/browser/render_process_host.h" | |
| 15 #include "net/base/network_interfaces.h" | |
| 16 | |
| 17 class Profile; | |
| 18 | |
| 19 // AudioDebugRecordingsHandler provides an interface to the internal logs | |
| 20 // in WebRTC: | |
| 21 // - Starts and stops AudioDebugRecordings, aka AEC dumps. | |
| 22 // - Starts and stops RTC event logs. | |
|
Guido Urdaneta
2016/02/23 13:57:34
This class is only for AudioDebugRecordings.
Shoul
Henrik Grunell
2016/02/23 15:29:10
It's not strictly WebRTC since it also does record
Henrik Grunell
2016/02/23 15:29:10
Remove comment about RTC event log. :) Actually, r
terelius-chromium
2016/03/02 10:01:10
Done.
| |
| 23 class AudioDebugRecordingsHandler | |
| 24 : public base::RefCountedThreadSafe<AudioDebugRecordingsHandler> { | |
| 25 public: | |
| 26 typedef base::Callback<void(bool, const std::string&)> GenericDoneCallback; | |
| 27 typedef base::Callback<void(const std::string&)> | |
| 28 TimeLimitedRecordingErrorCallback; | |
|
Henrik Grunell
2016/02/23 15:29:10
Drop "TimeLimited".
terelius-chromium
2016/03/02 10:01:10
Done. Changed to RecordingErrorCallback and Record
| |
| 29 typedef base::Callback<void(const std::string&, bool, bool)> | |
| 30 TimeLimitedRecordingCallback; | |
| 31 | |
| 32 // Key used to attach the handler to the RenderProcessHost | |
| 33 static const char kAudioDebugRecordingsHandlerKey[]; | |
| 34 | |
| 35 explicit AudioDebugRecordingsHandler(Profile* profile); | |
| 36 | |
| 37 // Starts an audio debug recording. The recording lasts the given |delay|, | |
| 38 // unless |delay| is zero, in which case recording will continue until | |
| 39 // StopAudioDebugRecordings() is explicitly invoked. | |
| 40 // |callback| is invoked once recording stops. If |delay| is zero | |
| 41 // |callback| is invoked once recording starts. | |
| 42 // If a recording was already in progress, |error_callback| is invoked instead | |
| 43 // of |callback|. | |
| 44 void StartAudioDebugRecordings( | |
| 45 content::RenderProcessHost* host, | |
| 46 base::TimeDelta delay, | |
| 47 const TimeLimitedRecordingCallback& callback, | |
| 48 const TimeLimitedRecordingErrorCallback& error_callback); | |
| 49 | |
| 50 // Stops an audio debug recording. |callback| is invoked once recording | |
| 51 // stops. If no recording was in progress, |error_callback| is invoked instead | |
| 52 // of |callback|. | |
| 53 void StopAudioDebugRecordings( | |
| 54 content::RenderProcessHost* host, | |
| 55 const TimeLimitedRecordingCallback& callback, | |
| 56 const TimeLimitedRecordingErrorCallback& error_callback); | |
| 57 | |
| 58 private: | |
| 59 friend class content::BrowserThread; | |
|
Henrik Grunell
2016/02/23 15:29:10
Not sure why these friends are needed. Can be remo
terelius-chromium
2016/03/02 10:01:10
Based on a comment in base/memory/ref_counted.h, I
Henrik Grunell
2016/03/10 21:33:34
Acknowledged.
| |
| 60 friend class base::DeleteHelper<AudioDebugRecordingsHandler>; | |
| 61 friend class base::RefCountedThreadSafe<AudioDebugRecordingsHandler>; | |
| 62 | |
| 63 virtual ~AudioDebugRecordingsHandler(); | |
| 64 | |
| 65 base::FilePath GetLogDirectoryAndEnsureExists(); | |
| 66 | |
| 67 // Helper for starting audio debug recordings. | |
| 68 void DoStartAudioDebugRecordings( | |
| 69 content::RenderProcessHost* host, | |
| 70 base::TimeDelta delay, | |
| 71 const TimeLimitedRecordingCallback& callback, | |
| 72 const TimeLimitedRecordingErrorCallback& error_callback, | |
| 73 const base::FilePath& log_directory); | |
| 74 | |
| 75 // Helper for stopping audio debug recordings. | |
| 76 void DoStopAudioDebugRecordings( | |
| 77 content::RenderProcessHost* host, | |
| 78 bool is_manual_stop, | |
| 79 uint64_t audio_debug_recordings_id, | |
| 80 const TimeLimitedRecordingCallback& callback, | |
| 81 const TimeLimitedRecordingErrorCallback& error_callback, | |
| 82 const base::FilePath& log_directory); | |
| 83 | |
| 84 // The profile associated with our renderer process. | |
| 85 Profile* const profile_; | |
| 86 | |
| 87 // Must be accessed on the UI thread. | |
| 88 bool is_audio_debug_recordings_in_progress_; | |
| 89 | |
| 90 // This counter allows saving each debug recording in separate files. | |
| 91 uint64_t current_audio_debug_recordings_id_; | |
| 92 | |
| 93 DISALLOW_COPY_AND_ASSIGN(AudioDebugRecordingsHandler); | |
| 94 }; | |
| 95 | |
| 96 #endif // CHROME_BROWSER_MEDIA_AUDIO_DEBUG_RECORDINGS_HANDLER_H_ | |
| OLD | NEW |