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 452d3b429dbd1aa196705e48de5683c804853c62..08ed7a25555dc5f303a8360aa4aa438c7f741f2d 100644 |
--- a/content/browser/renderer_host/p2p/socket_host_udp.cc |
+++ b/content/browser/renderer_host/p2p/socket_host_udp.cc |
@@ -50,12 +50,12 @@ namespace content { |
P2PSocketHostUdp::PendingPacket::PendingPacket( |
const net::IPEndPoint& to, |
const std::vector<char>& content, |
- net::DiffServCodePoint dscp_, |
+ const talk_base::PacketOptions& options, |
uint64 id) |
: to(to), |
data(new net::IOBuffer(content.size())), |
size(content.size()), |
- dscp(dscp_), |
+ packet_options(options), |
id(id) { |
memcpy(data->data(), &content[0], size); |
} |
@@ -179,7 +179,7 @@ void P2PSocketHostUdp::HandleReadResult(int result) { |
void P2PSocketHostUdp::Send(const net::IPEndPoint& to, |
const std::vector<char>& data, |
- net::DiffServCodePoint dscp, |
+ const talk_base::PacketOptions& options, |
uint64 packet_id) { |
if (!socket_) { |
// The Send message may be sent after the an OnError message was |
@@ -205,9 +205,10 @@ void P2PSocketHostUdp::Send(const net::IPEndPoint& to, |
} |
if (send_pending_) { |
- send_queue_.push_back(PendingPacket(to, data, dscp, packet_id)); |
+ send_queue_.push_back(PendingPacket(to, data, options, packet_id)); |
} else { |
- PendingPacket packet(to, data, dscp, packet_id); |
+ // TODO(mallinath: Remove unnecessary memcpy in this case. |
+ PendingPacket packet(to, data, options, packet_id); |
DoSend(packet); |
} |
} |
@@ -219,11 +220,13 @@ void P2PSocketHostUdp::DoSend(const PendingPacket& packet) { |
// 1. If the outgoing packet is set to DSCP_NO_CHANGE |
// 2. If no change in DSCP value from last packet |
// 3. If there is any error in setting DSCP on socket. |
- if (packet.dscp != net::DSCP_NO_CHANGE && |
- last_dscp_ != packet.dscp && last_dscp_ != net::DSCP_NO_CHANGE) { |
- int result = socket_->SetDiffServCodePoint(packet.dscp); |
+ net::DiffServCodePoint dscp = |
+ static_cast<net::DiffServCodePoint>(packet.packet_options.dscp); |
+ if (dscp != net::DSCP_NO_CHANGE && last_dscp_ != dscp && |
+ last_dscp_ != net::DSCP_NO_CHANGE) { |
+ int result = socket_->SetDiffServCodePoint(dscp); |
if (result == net::OK) { |
- last_dscp_ = packet.dscp; |
+ last_dscp_ = dscp; |
} else if (!IsTransientError(result) && last_dscp_ != net::DSCP_CS0) { |
// We receieved a non-transient error, and it seems we have |
// not changed the DSCP in the past, disable DSCP as it unlikely |