| 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..e2c1ff1128edd6be917b22de1e116ff5dd896b4f 100644
|
| --- a/chrome/browser/media/webrtc_logging_handler_host.h
|
| +++ b/chrome/browser/media/webrtc_logging_handler_host.h
|
| @@ -7,8 +7,11 @@
|
|
|
| #include "base/basictypes.h"
|
| #include "base/memory/shared_memory.h"
|
| +#include "chrome/browser/media/rtp_dump_type.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 "content/public/browser/render_process_host.h"
|
| #include "net/base/net_util.h"
|
|
|
| namespace net {
|
| @@ -17,7 +20,6 @@ class URLRequestContextGetter;
|
|
|
| class PartialCircularBuffer;
|
| class Profile;
|
| -class RenderProcessHost;
|
|
|
| typedef std::map<std::string, std::string> MetaDataMap;
|
|
|
| @@ -51,16 +53,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.
|
| @@ -74,20 +76,26 @@ class WebRtcLoggingHandlerHost : public content::BrowserMessageFilter {
|
| }
|
|
|
| // Starts dumping the RTP headers for the specified direction. Must be called
|
| - // on the IO thread. |incoming| and |outgoing| specifies which direction(s) of
|
| - // RTP packets should be dumped. |callback| will be called when starting the
|
| - // dump is done.
|
| - void StartRtpDump(bool incoming,
|
| - bool outgoing,
|
| - const GenericDoneCallback& callback);
|
| + // on the IO thread. |type| specifies which direction(s) of RTP packets should
|
| + // be dumped. |callback| will be called when starting the dump is done.
|
| + // |stop_callback| will be called when StopRtpDump is called.
|
| + void StartRtpDump(RtpDumpType type,
|
| + const GenericDoneCallback& callback,
|
| + const content::RenderProcessHost::WebRtcStopRtpDumpCallback&
|
| + stop_callback);
|
|
|
| // Stops dumping the RTP headers for the specified direction. Must be called
|
| - // on the IO thread. |incoming| and |outgoing| specifies which direction(s) of
|
| - // RTP packet dumping should be stopped. |callback| will be called when
|
| - // stopping the dump is done.
|
| - void StopRtpDump(bool incoming,
|
| - bool outgoing,
|
| - const GenericDoneCallback& callback);
|
| + // on the IO thread. |type| specifies which direction(s) of RTP packet dumping
|
| + // should be stopped. |callback| will be called when stopping the dump is
|
| + // done.
|
| + void StopRtpDump(RtpDumpType type, 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
|
| @@ -140,12 +148,34 @@ 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(RtpDumpType type,
|
| + GenericDoneCallback callback,
|
| + const base::FilePath& dump_dir);
|
| +
|
| + // A helper for starting RTP dump assuming the RTP dump handler has been
|
| + // created.
|
| + void DoStartRtpDump(RtpDumpType type, 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 +210,11 @@ 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_;
|
| +
|
| + content::RenderProcessHost::WebRtcStopRtpDumpCallback stop_rtp_dump_callback_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost);
|
| };
|
|
|
|
|