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

Unified Diff: chrome/browser/media/webrtc_logging_handler_host.h

Issue 264793017: Implements RTP header dumping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix leak Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
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..cc59f5ce494f6ba48306bc4d9940eee188ad3304 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. Must be called on the UI
+ // 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,31 @@ 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);
+
+ // A helper for TriggerUpload to do the real work.
+ void DoUploadLogAndRtpDumps(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);
+
+ // Adds the packet to the dump on 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 +207,12 @@ 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_;
+
+ // The callback to call when StopRtpDump is called.
+ content::RenderProcessHost::WebRtcStopRtpDumpCallback stop_rtp_dump_callback_;
+
DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost);
};
« no previous file with comments | « chrome/browser/media/webrtc_log_uploader_unittest.cc ('k') | chrome/browser/media/webrtc_logging_handler_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698