Chromium Code Reviews| 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 835fbda0b0b5b8146812acb83f8fc585dc9a9f0f..7c6d5abb923c2ae6eb154f0b8d214b74a3a93008 100644 |
| --- a/chrome/browser/media/webrtc_logging_handler_host.h |
| +++ b/chrome/browser/media/webrtc_logging_handler_host.h |
| @@ -7,6 +7,7 @@ |
| #include "base/basictypes.h" |
| #include "base/memory/shared_memory.h" |
| +#include "chrome/browser/media/webrtc_rtp_dump_handler.h" |
| #include "chrome/common/media/webrtc_logging_message_data.h" |
| #include "content/public/browser/browser_message_filter.h" |
| #include "net/base/net_util.h" |
| @@ -51,16 +52,16 @@ class WebRtcLoggingHandlerHost : public content::BrowserMessageFilter { |
| // called. Must be called on the IO thread. |
| void StopLogging(const GenericDoneCallback& callback); |
| - // Uploads the log and discards the local copy. May only be called after |
| - // logging has stopped. Must be called on the IO thread. |
| + // Uploads the log and the RTP dumps. Discards the local copy. May only be |
| + // called after logging has stopped. Must be called on the IO thread. |
| void UploadLog(const UploadDoneCallback& callback); |
| // Called by WebRtcLogUploader when uploading has finished. Must be called on |
| // the IO thread. |
| void UploadLogDone(); |
| - // Discards the log. May only be called after logging has stopped. Must be |
| - // called on the IO thread. |
| + // Discards the log and the RTP dumps. May only be called after logging has |
| + // stopped. Must be called on the IO thread. |
| void DiscardLog(const GenericDoneCallback& callback); |
| // Adds a message to the log. |
| @@ -89,6 +90,13 @@ class WebRtcLoggingHandlerHost : public content::BrowserMessageFilter { |
| bool outgoing, |
| const GenericDoneCallback& callback); |
| + // Called when an RTP packet is sent or received. |
| + // Can be called on any thread as it always posts to the IO thread. |
| + void OnRtpPacket(const uint8* packet_header, |
| + size_t header_length, |
| + size_t packet_length, |
| + bool incoming); |
| + |
| private: |
| // States used for protecting from function calls made at non-allowed points |
| // in time. For example, StartLogging() is only allowed in CLOSED state. |
| @@ -140,12 +148,37 @@ class WebRtcLoggingHandlerHost : public content::BrowserMessageFilter { |
| // called on the FILE thread. |
| base::FilePath GetLogDirectoryAndEnsureExists(); |
| - void TriggerUploadLog(const base::FilePath& log_directory); |
| + void TriggerUpload(const base::FilePath& log_directory); |
| void FireGenericDoneCallback(GenericDoneCallback* callback, |
| bool success, |
| const std::string& error_message); |
| + // Create the RTP dump handler and start dumping. Must be called after making |
| + // sure the log directory exists. |
| + void CreateRtpDumpHandlerAndStart(bool incoming, |
|
Henrik Grunell
2014/05/15 14:36:34
Can you use an enum instead of two bools?
jiayl
2014/05/15 23:06:22
Done.
|
| + bool outgoing, |
| + GenericDoneCallback callback, |
| + const base::FilePath& dump_dir); |
| + |
| + // A helper for starting RTP dump assuming the RTP dump handler has been |
| + // created. |
| + void DoStartRtpDump(bool incoming, |
| + bool outgoing, |
| + GenericDoneCallback* callback); |
| + |
| + // A helper for uploading the log and RTP dumps after the |
| + // WebRtcRtpDumpHandler::ReleaseDump callback. |
| + void DoUploadLogAndDumps( |
| + const base::FilePath& log_directory, |
| + const WebRtcRtpDumpHandler::ReleasedDumps& rtp_dumps); |
| + |
| + // Pass the RTP packet to the RTP dump handler on the IO thread. |
| + void DumpRtpPacketOnIOThread(scoped_ptr<uint8[]> packet_header, |
| + size_t header_length, |
| + size_t packet_length, |
| + bool incoming); |
| + |
| scoped_ptr<unsigned char[]> log_buffer_; |
| scoped_ptr<PartialCircularBuffer> circular_buffer_; |
| @@ -180,6 +213,9 @@ class WebRtcLoggingHandlerHost : public content::BrowserMessageFilter { |
| // changes to STOPPED. |
| base::Time logging_started_time_; |
| + // The RTP dump handler responsible for creating the RTP header dump files. |
| + scoped_ptr<WebRtcRtpDumpHandler> rtp_dump_handler_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost); |
| }; |