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

Side by Side Diff: content/browser/renderer_host/p2p/socket_host_udp.cc

Issue 159353002: This CL adds methods to manipulate RTP header extension, particularly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/p2p/socket_host_udp.h" 5 #include "content/browser/renderer_host/p2p/socket_host_udp.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/renderer_host/p2p/socket_host_throttler.h" 10 #include "content/browser/renderer_host/p2p/socket_host_throttler.h"
11 #include "content/common/p2p_messages.h" 11 #include "content/common/p2p_messages.h"
12 #include "content/public/browser/content_browser_client.h" 12 #include "content/public/browser/content_browser_client.h"
13 #include "content/public/common/content_client.h" 13 #include "content/public/common/content_client.h"
14 #include "ipc/ipc_sender.h" 14 #include "ipc/ipc_sender.h"
15 #include "net/base/io_buffer.h" 15 #include "net/base/io_buffer.h"
16 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
17 #include "net/base/net_util.h" 17 #include "net/base/net_util.h"
18 #include "third_party/libjingle/source/talk/base/asyncpacketsocket.h"
18 19
19 namespace { 20 namespace {
20 21
21 // UDP packets cannot be bigger than 64k. 22 // UDP packets cannot be bigger than 64k.
22 const int kReadBufferSize = 65536; 23 const int kReadBufferSize = 65536;
23 // Socket receive buffer size. 24 // Socket receive buffer size.
24 const int kRecvSocketBufferSize = 65536; // 64K 25 const int kRecvSocketBufferSize = 65536; // 64K
25 26
26 // Defines set of transient errors. These errors are ignored when we get them 27 // Defines set of transient errors. These errors are ignored when we get them
27 // from sendto() or recvfrom() calls. 28 // from sendto() or recvfrom() calls.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 int result = socket_->SetDiffServCodePoint(dscp); 228 int result = socket_->SetDiffServCodePoint(dscp);
228 if (result == net::OK) { 229 if (result == net::OK) {
229 last_dscp_ = dscp; 230 last_dscp_ = dscp;
230 } else if (!IsTransientError(result) && last_dscp_ != net::DSCP_CS0) { 231 } else if (!IsTransientError(result) && last_dscp_ != net::DSCP_CS0) {
231 // We receieved a non-transient error, and it seems we have 232 // We receieved a non-transient error, and it seems we have
232 // not changed the DSCP in the past, disable DSCP as it unlikely 233 // not changed the DSCP in the past, disable DSCP as it unlikely
233 // to work in the future. 234 // to work in the future.
234 last_dscp_ = net::DSCP_NO_CHANGE; 235 last_dscp_ = net::DSCP_NO_CHANGE;
235 } 236 }
236 } 237 }
238 packet_processing_helpers::ApplyPacketOptions(
239 packet.data->data(), packet.size, packet.packet_options, 0);
237 int result = socket_->SendTo( 240 int result = socket_->SendTo(
238 packet.data.get(), 241 packet.data.get(),
239 packet.size, 242 packet.size,
240 packet.to, 243 packet.to,
241 base::Bind(&P2PSocketHostUdp::OnSend, base::Unretained(this), packet.id)); 244 base::Bind(&P2PSocketHostUdp::OnSend, base::Unretained(this), packet.id));
242 245
243 // sendto() may return an error, e.g. if we've received an ICMP Destination 246 // sendto() may return an error, e.g. if we've received an ICMP Destination
244 // Unreachable message. When this happens try sending the same packet again, 247 // Unreachable message. When this happens try sending the same packet again,
245 // and just drop it if it fails again. 248 // and just drop it if it fails again.
246 if (IsTransientError(result)) { 249 if (IsTransientError(result)) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 case P2P_SOCKET_OPT_DSCP: 308 case P2P_SOCKET_OPT_DSCP:
306 return (net::OK == socket_->SetDiffServCodePoint( 309 return (net::OK == socket_->SetDiffServCodePoint(
307 static_cast<net::DiffServCodePoint>(value))) ? true : false; 310 static_cast<net::DiffServCodePoint>(value))) ? true : false;
308 default: 311 default:
309 NOTREACHED(); 312 NOTREACHED();
310 return false; 313 return false;
311 } 314 }
312 } 315 }
313 316
314 } // namespace content 317 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_tcp.cc ('k') | content/browser/renderer_host/p2p/socket_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698