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 921eac857365bea874c98001e053baac5a184a8f..8303d2bcdba1acb25b5e740e5db8014ae26d1478 100644 |
--- a/content/browser/renderer_host/p2p/socket_host_udp.cc |
+++ b/content/browser/renderer_host/p2p/socket_host_udp.cc |
@@ -55,14 +55,19 @@ 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); |
+ if (!options.packet_time_params.srtp_auth_key.empty()) { |
+ memcpy(&packet_options.packet_time_params.srtp_auth_key[0], |
+ &options.packet_time_params.srtp_auth_key[0], |
+ options.packet_time_params.srtp_auth_key.size()); |
+ } |
} |
P2PSocketHostUdp::PendingPacket::~PendingPacket() { |
@@ -182,7 +187,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 |
@@ -208,9 +213,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); |
} |
} |
@@ -222,11 +228,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 |