OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ |
6 #define CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ | 6 #define CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 11 #include "base/macros.h" |
9 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
| 13 #include "build/build_config.h" |
10 #include "chrome/browser/media/rtp_dump_type.h" | 14 #include "chrome/browser/media/rtp_dump_type.h" |
11 #include "chrome/browser/media/webrtc_rtp_dump_handler.h" | 15 #include "chrome/browser/media/webrtc_rtp_dump_handler.h" |
12 #include "chrome/common/media/webrtc_logging_message_data.h" | 16 #include "chrome/common/media/webrtc_logging_message_data.h" |
13 #include "chrome/common/partial_circular_buffer.h" | 17 #include "chrome/common/partial_circular_buffer.h" |
14 #include "content/public/browser/browser_message_filter.h" | 18 #include "content/public/browser/browser_message_filter.h" |
15 #include "content/public/browser/render_process_host.h" | 19 #include "content/public/browser/render_process_host.h" |
16 #include "net/base/network_interfaces.h" | 20 #include "net/base/network_interfaces.h" |
17 | 21 |
18 namespace net { | 22 namespace net { |
19 class URLRequestContextGetter; | 23 class URLRequestContextGetter; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 55 |
52 // Switches the buffer to read-only mode, where access to the internal | 56 // Switches the buffer to read-only mode, where access to the internal |
53 // buffer is allowed from different threads than were used to contribute | 57 // buffer is allowed from different threads than were used to contribute |
54 // to the log. Calls to Log() won't be allowed after calling | 58 // to the log. Calls to Log() won't be allowed after calling |
55 // SetComplete() and the call to SetComplete() must be done on the same | 59 // SetComplete() and the call to SetComplete() must be done on the same |
56 // thread as constructed the buffer and calls Log(). | 60 // thread as constructed the buffer and calls Log(). |
57 void SetComplete(); | 61 void SetComplete(); |
58 | 62 |
59 private: | 63 private: |
60 base::ThreadChecker thread_checker_; | 64 base::ThreadChecker thread_checker_; |
61 uint8 buffer_[kWebRtcLogSize]; | 65 uint8_t buffer_[kWebRtcLogSize]; |
62 PartialCircularBuffer circular_; | 66 PartialCircularBuffer circular_; |
63 bool read_only_; | 67 bool read_only_; |
64 }; | 68 }; |
65 | 69 |
66 // WebRtcLoggingHandlerHost handles operations regarding the WebRTC logging: | 70 // WebRtcLoggingHandlerHost handles operations regarding the WebRTC logging: |
67 // - Opens a shared memory buffer that the handler in the render process | 71 // - Opens a shared memory buffer that the handler in the render process |
68 // writes to. | 72 // writes to. |
69 // - Writes basic machine info to the log. | 73 // - Writes basic machine info to the log. |
70 // - Informs the handler in the render process when to stop logging. | 74 // - Informs the handler in the render process when to stop logging. |
71 // - Closes the shared memory (and thereby discarding it) or triggers uploading | 75 // - Closes the shared memory (and thereby discarding it) or triggers uploading |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 stop_callback); | 142 stop_callback); |
139 | 143 |
140 // Stops dumping the RTP headers for the specified direction. Must be called | 144 // Stops dumping the RTP headers for the specified direction. Must be called |
141 // on the IO thread. |type| specifies which direction(s) of RTP packet dumping | 145 // on the IO thread. |type| specifies which direction(s) of RTP packet dumping |
142 // should be stopped. |callback| will be called when stopping the dump is | 146 // should be stopped. |callback| will be called when stopping the dump is |
143 // done. | 147 // done. |
144 void StopRtpDump(RtpDumpType type, const GenericDoneCallback& callback); | 148 void StopRtpDump(RtpDumpType type, const GenericDoneCallback& callback); |
145 | 149 |
146 // Called when an RTP packet is sent or received. Must be called on the UI | 150 // Called when an RTP packet is sent or received. Must be called on the UI |
147 // thread. | 151 // thread. |
148 void OnRtpPacket(scoped_ptr<uint8[]> packet_header, | 152 void OnRtpPacket(scoped_ptr<uint8_t[]> packet_header, |
149 size_t header_length, | 153 size_t header_length, |
150 size_t packet_length, | 154 size_t packet_length, |
151 bool incoming); | 155 bool incoming); |
152 | 156 |
153 // Starts an audio debug recording. The recording lasts the given |delay|, | 157 // Starts an audio debug recording. The recording lasts the given |delay|, |
154 // unless |delay| is zero, in which case recording will continue until | 158 // unless |delay| is zero, in which case recording will continue until |
155 // StopAudioDebugRecordings() is explicitly invoked. | 159 // StopAudioDebugRecordings() is explicitly invoked. |
156 // |callback| is invoked once recording stops. If |delay| is zero | 160 // |callback| is invoked once recording stops. If |delay| is zero |
157 // |callback| is invoked once recording starts. | 161 // |callback| is invoked once recording starts. |
158 // If a recording was already in progress, |error_callback| is invoked instead | 162 // If a recording was already in progress, |error_callback| is invoked instead |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // sure the log directory exists. | 242 // sure the log directory exists. |
239 void CreateRtpDumpHandlerAndStart(RtpDumpType type, | 243 void CreateRtpDumpHandlerAndStart(RtpDumpType type, |
240 const GenericDoneCallback& callback, | 244 const GenericDoneCallback& callback, |
241 const base::FilePath& dump_dir); | 245 const base::FilePath& dump_dir); |
242 | 246 |
243 // A helper for starting RTP dump assuming the RTP dump handler has been | 247 // A helper for starting RTP dump assuming the RTP dump handler has been |
244 // created. | 248 // created. |
245 void DoStartRtpDump(RtpDumpType type, const GenericDoneCallback& callback); | 249 void DoStartRtpDump(RtpDumpType type, const GenericDoneCallback& callback); |
246 | 250 |
247 // Adds the packet to the dump on IO thread. | 251 // Adds the packet to the dump on IO thread. |
248 void DumpRtpPacketOnIOThread(scoped_ptr<uint8[]> packet_header, | 252 void DumpRtpPacketOnIOThread(scoped_ptr<uint8_t[]> packet_header, |
249 size_t header_length, | 253 size_t header_length, |
250 size_t packet_length, | 254 size_t packet_length, |
251 bool incoming); | 255 bool incoming); |
252 | 256 |
253 bool ReleaseRtpDumps(WebRtcLogPaths* log_paths); | 257 bool ReleaseRtpDumps(WebRtcLogPaths* log_paths); |
254 | 258 |
255 void FireGenericDoneCallback( | 259 void FireGenericDoneCallback( |
256 const WebRtcLoggingHandlerHost::GenericDoneCallback& callback, | 260 const WebRtcLoggingHandlerHost::GenericDoneCallback& callback, |
257 bool success, | 261 bool success, |
258 const std::string& error_message); | 262 const std::string& error_message); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 // Must be accessed on the UI thread. | 322 // Must be accessed on the UI thread. |
319 bool is_audio_debug_recordings_in_progress_; | 323 bool is_audio_debug_recordings_in_progress_; |
320 | 324 |
321 // This counter allows saving each debug recording in separate files. | 325 // This counter allows saving each debug recording in separate files. |
322 uint64_t current_audio_debug_recordings_id_; | 326 uint64_t current_audio_debug_recordings_id_; |
323 | 327 |
324 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost); | 328 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost); |
325 }; | 329 }; |
326 | 330 |
327 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ | 331 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ |
OLD | NEW |