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

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

Issue 1855193002: Move the call to enable the WebRTC event log from PeerConnectionFactory to PeerConnection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Introduced WebRTCCallbackInterface. Created 4 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_event_log_handler.h
diff --git a/chrome/browser/media/webrtc_event_log_handler.h b/chrome/browser/media/webrtc_event_log_handler.h
index 33eaa5cf1a1263304f4e88d9936932e22732be65..0ba9aea5ee8bc340738810c77dac4cfde0438230 100644
--- a/chrome/browser/media/webrtc_event_log_handler.h
+++ b/chrome/browser/media/webrtc_event_log_handler.h
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <set>
#include <string>
#include "base/callback.h"
@@ -34,10 +35,11 @@ class WebRtcEventLogHandler
// Key used to attach the handler to the RenderProcessHost.
static const char kWebRtcEventLogHandlerKey[];
- explicit WebRtcEventLogHandler(Profile* profile);
+ WebRtcEventLogHandler(int process_id, Profile* profile);
- // Starts an RTC event log. The call writes the most recent events to a
- // file and then starts logging events for the given |delay|.
+ // Starts an RTC event log for each peerconnection on the specified |host|.
+ // The call writes the most recent events to a file and then starts logging
+ // events for the given |delay|.
// If |delay| is zero, the logging will continue until
// StopWebRtcEventLogging()
// is explicitly invoked.
@@ -50,6 +52,13 @@ class WebRtcEventLogHandler
const RecordingDoneCallback& callback,
const RecordingErrorCallback& error_callback);
+ // Starts an RTC event log for each peerconnection on the specified |host|.
+ // A base file_path can be supplied, which will be extended to include several
+ // identifiers to ensure uniqueness. If a recording was already in progress,
+ // this call will be ignored.
+ void StartWebRtcEventLogging(content::RenderProcessHost* host,
+ const base::FilePath& file_path);
+
// Stops an RTC event log. |callback| is invoked once recording
// stops. If no recording was in progress, |error_callback| is invoked instead
// of |callback|.
@@ -57,6 +66,18 @@ class WebRtcEventLogHandler
const RecordingDoneCallback& callback,
const RecordingErrorCallback& error_callback);
+ // Stops an RTC event log for each peerconnection on the specified |host|.
+ // If no recording was in progress, this call has no effect.
+ void StopWebRtcEventLogging(content::RenderProcessHost* host);
+
+ // Signal that a PeerConnection was added to the RenderProcessHost
+ // identified by |process_id|.
+ void OnPeerConnectionAdded(int process_id, int connection_id);
+
+ // Signal that a PeerConnection was removed from the RenderProcessHost
+ // identified by |process_id|.
+ void OnPeerConnectionRemoved(int process_id, int connection_id);
+
private:
friend class base::RefCountedThreadSafe<WebRtcEventLogHandler>;
virtual ~WebRtcEventLogHandler();
@@ -84,6 +105,17 @@ class WebRtcEventLogHandler
// Must be accessed on the UI thread.
bool is_rtc_event_logging_in_progress_;
+ // In case new PeerConnections are created during logging, the path is needed
+ // to enable logging for them.
+ base::FilePath base_file_path_;
+
+ // The local identifiers of all the currently active PeerConnections.
+ std::set<int> active_peer_connection_local_id_;
+
+ // Number of log files that can still be created before the maximum is
+ // reached. Each time a log file is opened, this value is decreased by one.
+ int number_log_files_;
+
// This counter allows saving each log in a separate file.
uint64_t current_rtc_event_log_id_;

Powered by Google App Engine
This is Rietveld 408576698