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

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: Comments addressed. 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..5daf7bcd22aad4429608bdc8e4ab784cc3cdcb0d 100644
--- a/content/browser/renderer_host/p2p/socket_host_udp.cc
+++ b/content/browser/renderer_host/p2p/socket_host_udp.cc
@@ -291,50 +291,48 @@ void P2PSocketHostUdp::DoSend(const PendingPacket& packet) {
}
}
- uint64 tick_received = base::TimeTicks::Now().ToInternalValue();
+ base::TimeTicks tick_received = base::TimeTicks::Now();
Sergey Ulanov 2015/09/17 17:19:31 nit: call it time_received?
Stefan 2015/09/18 07:56:51 Done.
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));
+ int result = socket_->SendTo(
+ packet.data.get(), packet.size, packet.to,
+ base::Bind(&P2PSocketHostUdp::OnSend, base::Unretained(this), packet.id,
+ packet.packet_options.transport_sequence_number,
+ tick_received));
// 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,
+ base::Bind(&P2PSocketHostUdp::OnSend, base::Unretained(this), packet.id,
Sergey Ulanov 2015/09/17 17:19:31 This duplicates the code above. Maybe store the re
Stefan 2015/09/18 07:56:51 Done.
+ packet.packet_options.transport_sequence_number,
+ tick_received));
Sergey Ulanov 2015/09/17 17:19:31 So you assign tick_received to sent_time_tick. The
Stefan 2015/09/18 07:56:51 I want this to represent the time when the packet
Sergey Ulanov 2015/09/18 21:16:11 I see. Note that send() completion just means that
}
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,
+ tick_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 tick_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, tick_received, result);
// Send next packets if we have them waiting in the buffer.
while (state_ == STATE_OPEN && !send_queue_.empty() && !send_pending_) {
@@ -346,7 +344,8 @@ void P2PSocketHostUdp::OnSend(uint64 packet_id,
}
void P2PSocketHostUdp::HandleSendResult(uint64 packet_id,
Sergey Ulanov 2015/09/17 17:19:31 Please change this to uint64_t
Stefan 2015/09/18 07:56:51 Done.
- uint64 tick_received,
+ int32_t transport_sequence_number,
+ base::TimeTicks tick_received,
int result) {
TRACE_EVENT_ASYNC_END1("p2p", "Send", packet_id,
"result", result);
@@ -363,13 +362,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() - tick_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,
+ tick_received)));
}
P2PSocketHost* P2PSocketHostUdp::AcceptIncomingTcpConnection(

Powered by Google App Engine
This is Rietveld 408576698