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

Side by Side Diff: chrome/browser/media/audio_debug_recordings_handler.h

Issue 1650133002: Start and stop RTC event logs from private extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unused includes Created 4 years, 9 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 unified diff | Download patch
OLDNEW
(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/callback.h"
12 #include "base/files/file_path.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/threading/thread_checker.h"
15 #include "base/time/time.h"
16
17 namespace content {
18 class RenderProcessHost;
19 } // namespace content
20
21 class Profile;
22
23 // AudioDebugRecordingsHandler provides an interface to start and stop
24 // AudioDebugRecordings, aka AEC dumps.
Henrik Grunell 2016/03/10 21:33:34 Nit: "aka" -> "including".
terelius-chromium 2016/03/24 16:21:22 Done.
25 class AudioDebugRecordingsHandler
26 : public base::RefCountedThreadSafe<AudioDebugRecordingsHandler> {
27 public:
28 typedef base::Callback<void(bool, const std::string&)> GenericDoneCallback;
29 typedef base::Callback<void(const std::string&)> RecordingErrorCallback;
30 typedef base::Callback<void(const std::string&, bool, bool)>
31 RecordingDoneCallback;
32
33 // Key used to attach the handler to the RenderProcessHost
34 static const char kAudioDebugRecordingsHandlerKey[];
35
36 explicit AudioDebugRecordingsHandler(Profile* profile);
37
38 // Starts an audio debug recording. The recording lasts the given |delay|,
39 // unless |delay| is zero, in which case recording will continue until
40 // StopAudioDebugRecordings() is explicitly invoked.
41 // |callback| is invoked once recording stops. If |delay| is zero
42 // |callback| is invoked once recording starts.
43 // If a recording was already in progress, |error_callback| is invoked instead
44 // of |callback|.
45 void StartAudioDebugRecordings(content::RenderProcessHost* host,
46 base::TimeDelta delay,
47 const RecordingDoneCallback& callback,
48 const RecordingErrorCallback& 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(content::RenderProcessHost* host,
54 const RecordingDoneCallback& callback,
55 const RecordingErrorCallback& error_callback);
56
57 private:
58 friend class base::RefCountedThreadSafe<AudioDebugRecordingsHandler>;
59
60 virtual ~AudioDebugRecordingsHandler();
61
62 base::FilePath GetLogDirectoryAndEnsureExists();
63
64 // Helper for starting audio debug recordings.
65 void DoStartAudioDebugRecordings(content::RenderProcessHost* host,
66 base::TimeDelta delay,
67 const RecordingDoneCallback& callback,
68 const RecordingErrorCallback& error_callback,
69 const base::FilePath& log_directory);
70
71 // Helper for stopping audio debug recordings.
72 void DoStopAudioDebugRecordings(content::RenderProcessHost* host,
73 bool is_manual_stop,
74 uint64_t audio_debug_recordings_id,
75 const RecordingDoneCallback& callback,
76 const RecordingErrorCallback& error_callback,
77 const base::FilePath& log_directory);
78
79 // The profile associated with our renderer process.
80 Profile* const profile_;
81
82 // Must be accessed on the UI thread.
83 bool is_audio_debug_recordings_in_progress_;
84
85 // This counter allows saving each debug recording in separate files.
86 uint64_t current_audio_debug_recordings_id_;
87
88 base::ThreadChecker thread_checker_;
89 DISALLOW_COPY_AND_ASSIGN(AudioDebugRecordingsHandler);
90 };
91
92 #endif // CHROME_BROWSER_MEDIA_AUDIO_DEBUG_RECORDINGS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698