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

Unified Diff: chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc

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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
diff --git a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
index 9d02674b65a561a2a92fde4c19d7f6d97cb503c2..d12289f3d1add1a2d940fcd88a92304ecc266f44 100644
--- a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
+++ b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
@@ -279,6 +279,16 @@ bool WebrtcLoggingPrivateStartRtpDumpFunction::RunAsync() {
scoped_ptr<StartRtpDump::Params> params(StartRtpDump::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
+ if (!params->incoming && !params->outgoing) {
+ StartRtpDumpCallback(false, "Either incoming or outgoing must be true.");
+ return true;
+ }
+
+ RtpDumpType type =
+ (params->incoming && params->outgoing)
+ ? RTP_DUMP_BOTH
+ : (params->incoming ? RTP_DUMP_INCOMING : RTP_DUMP_OUTGOING);
+
content::RenderProcessHost* host =
RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin);
if (!host)
@@ -290,14 +300,20 @@ bool WebrtcLoggingPrivateStartRtpDumpFunction::RunAsync() {
WebRtcLoggingHandlerHost::GenericDoneCallback callback = base::Bind(
&WebrtcLoggingPrivateStartRtpDumpFunction::StartRtpDumpCallback, this);
+ // This call cannot fail.
+ content::RenderProcessHost::WebRtcStopRtpDumpCallback stop_callback =
+ host->StartRtpDump(params->incoming,
+ params->outgoing,
+ base::Bind(&WebRtcLoggingHandlerHost::OnRtpPacket,
+ webrtc_logging_handler_host));
+
BrowserThread::PostTask(BrowserThread::IO,
FROM_HERE,
base::Bind(&WebRtcLoggingHandlerHost::StartRtpDump,
webrtc_logging_handler_host,
- params->incoming,
- params->outgoing,
- callback));
-
+ type,
+ callback,
+ stop_callback));
return true;
}
@@ -320,6 +336,16 @@ bool WebrtcLoggingPrivateStopRtpDumpFunction::RunAsync() {
scoped_ptr<StopRtpDump::Params> params(StopRtpDump::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
+ if (!params->incoming && !params->outgoing) {
+ StopRtpDumpCallback(false, "Either incoming or outgoing must be true.");
+ return true;
+ }
+
+ RtpDumpType type =
+ (params->incoming && params->outgoing)
+ ? RTP_DUMP_BOTH
+ : (params->incoming ? RTP_DUMP_INCOMING : RTP_DUMP_OUTGOING);
+
content::RenderProcessHost* host =
RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin);
if (!host)
@@ -335,10 +361,8 @@ bool WebrtcLoggingPrivateStopRtpDumpFunction::RunAsync() {
FROM_HERE,
base::Bind(&WebRtcLoggingHandlerHost::StopRtpDump,
webrtc_logging_handler_host,
- params->incoming,
- params->outgoing,
+ type,
callback));
-
return true;
}
« no previous file with comments | « no previous file | chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698