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

Unified Diff: content/browser/renderer_host/p2p/socket_host_udp.cc

Issue 1345583004: Wire up transport sequence number and send time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Matching changes in .h file. Created 5 years, 3 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: content/browser/renderer_host/p2p/socket_host_udp.cc
diff --git a/content/browser/renderer_host/p2p/socket_host_udp.cc b/content/browser/renderer_host/p2p/socket_host_udp.cc
index 5137972ebb0d9edb3d6f02cfd820135a39caaff1..2ec7038d415cd5ed6aebc5d5ac77ecd304741754 100644
--- a/content/browser/renderer_host/p2p/socket_host_udp.cc
+++ b/content/browser/renderer_host/p2p/socket_host_udp.cc
@@ -291,50 +291,45 @@ void P2PSocketHostUdp::DoSend(const PendingPacket& packet) {
}
}
- uint64 tick_received = base::TimeTicks::Now().ToInternalValue();
+ base::TimeTicks time_received = base::TimeTicks::Now();
packet_processing_helpers::ApplyPacketOptions(
packet.data->data(), packet.size, packet.packet_options, 0);
- int result = socket_->SendTo(packet.data.get(),
- packet.size,
- packet.to,
- base::Bind(&P2PSocketHostUdp::OnSend,
- base::Unretained(this),
- packet.id,
- tick_received));
+ auto callback_binding = base::Bind(
+ &P2PSocketHostUdp::OnSend, base::Unretained(this), packet.id,
+ packet.packet_options.transport_sequence_number, time_received);
+ int result = socket_->SendTo(packet.data.get(), packet.size, packet.to,
+ callback_binding);
// sendto() may return an error, e.g. if we've received an ICMP Destination
// Unreachable message. When this happens try sending the same packet again,
// and just drop it if it fails again.
if (IsTransientError(result)) {
- result = socket_->SendTo(packet.data.get(),
- packet.size,
- packet.to,
- base::Bind(&P2PSocketHostUdp::OnSend,
- base::Unretained(this),
- packet.id,
- tick_received));
+ result = socket_->SendTo(packet.data.get(), packet.size, packet.to,
+ callback_binding);
}
if (result == net::ERR_IO_PENDING) {
send_pending_ = true;
} else {
- HandleSendResult(packet.id, tick_received, result);
+ HandleSendResult(packet.id, packet.packet_options.transport_sequence_number,
+ time_received, result);
}
if (dump_outgoing_rtp_packet_)
DumpRtpPacket(packet.data->data(), packet.size, false);
}
-void P2PSocketHostUdp::OnSend(uint64 packet_id,
- uint64 tick_received,
+void P2PSocketHostUdp::OnSend(uint64_t packet_id,
+ int32_t transport_sequence_number,
+ base::TimeTicks time_received,
int result) {
DCHECK(send_pending_);
DCHECK_NE(result, net::ERR_IO_PENDING);
send_pending_ = false;
- HandleSendResult(packet_id, tick_received, result);
+ HandleSendResult(packet_id, transport_sequence_number, time_received, result);
// Send next packets if we have them waiting in the buffer.
while (state_ == STATE_OPEN && !send_queue_.empty() && !send_pending_) {
@@ -345,8 +340,9 @@ void P2PSocketHostUdp::OnSend(uint64 packet_id,
}
}
-void P2PSocketHostUdp::HandleSendResult(uint64 packet_id,
- uint64 tick_received,
+void P2PSocketHostUdp::HandleSendResult(uint64_t packet_id,
+ int32_t transport_sequence_number,
+ base::TimeTicks time_received,
Sergey Ulanov 2015/09/18 21:16:11 Should this be called send_time, or something like
Stefan 2015/09/22 07:51:36 I definitely agree. Changing.
int result) {
TRACE_EVENT_ASYNC_END1("p2p", "Send", packet_id,
"result", result);
@@ -363,13 +359,12 @@ void P2PSocketHostUdp::HandleSendResult(uint64 packet_id,
// UMA to track the histograms from 1ms to 1 sec for how long a packet spends
// in the browser process.
- UMA_HISTOGRAM_TIMES(
- "WebRTC.SystemSendPacketDuration_UDP" /* name */,
- base::TimeTicks::Now() -
- base::TimeTicks::FromInternalValue(tick_received) /* sample */);
+ UMA_HISTOGRAM_TIMES("WebRTC.SystemSendPacketDuration_UDP" /* name */,
+ base::TimeTicks::Now() - time_received /* sample */);
- message_sender_->Send(
- new P2PMsg_OnSendComplete(id_, P2PSendPacketMetrics(packet_id)));
+ message_sender_->Send(new P2PMsg_OnSendComplete(
+ id_, P2PSendPacketMetrics(packet_id, transport_sequence_number,
+ time_received)));
}
P2PSocketHost* P2PSocketHostUdp::AcceptIncomingTcpConnection(

Powered by Google App Engine
This is Rietveld 408576698