Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_tcp.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
| 6 | 6 |
| 7 #include "base/sys_byteorder.h" | 7 #include "base/sys_byteorder.h" |
| 8 #include "content/common/p2p_messages.h" | 8 #include "content/common/p2p_messages.h" |
| 9 #include "ipc/ipc_sender.h" | 9 #include "ipc/ipc_sender.h" |
| 10 #include "jingle/glue/fake_ssl_client_socket.h" | 10 #include "jingle/glue/fake_ssl_client_socket.h" |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 511 OnError(); | 511 OnError(); |
| 512 return; | 512 return; |
| 513 } | 513 } |
| 514 | 514 |
| 515 // Add any pad bytes to the total size. | 515 // Add any pad bytes to the total size. |
| 516 int size = data.size() + pad_bytes; | 516 int size = data.size() + pad_bytes; |
| 517 | 517 |
| 518 scoped_refptr<net::DrainableIOBuffer> buffer = | 518 scoped_refptr<net::DrainableIOBuffer> buffer = |
| 519 new net::DrainableIOBuffer(new net::IOBuffer(size), size); | 519 new net::DrainableIOBuffer(new net::IOBuffer(size), size); |
| 520 memcpy(buffer->data(), &data[0], data.size()); | 520 memcpy(buffer->data(), &data[0], data.size()); |
| 521 MaybeUpdateRtpSendTimeExtn(&*data.begin(), data.size()); | |
|
juberti2
2014/02/14 01:53:27
think you need to do this before the memcpy
Solis
2014/02/14 10:05:29
Avoid implicitly returning an iterator by using: &
| |
| 521 | 522 |
| 522 if (pad_bytes) { | 523 if (pad_bytes) { |
| 523 char padding[4] = {0}; | 524 char padding[4] = {0}; |
| 524 DCHECK_LE(pad_bytes, 4); | 525 DCHECK_LE(pad_bytes, 4); |
| 525 memcpy(buffer->data() + data.size(), padding, pad_bytes); | 526 memcpy(buffer->data() + data.size(), padding, pad_bytes); |
| 526 } | 527 } |
| 527 WriteOrQueue(buffer); | 528 WriteOrQueue(buffer); |
| 528 } | 529 } |
| 529 | 530 |
| 530 int P2PSocketHostStunTcp::GetExpectedPacketSize( | 531 int P2PSocketHostStunTcp::GetExpectedPacketSize( |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 544 } else { | 545 } else { |
| 545 packet_size += kTurnChannelDataHeaderSize; | 546 packet_size += kTurnChannelDataHeaderSize; |
| 546 // Calculate any padding if present. | 547 // Calculate any padding if present. |
| 547 if (packet_size % 4) | 548 if (packet_size % 4) |
| 548 *pad_bytes = 4 - packet_size % 4; | 549 *pad_bytes = 4 - packet_size % 4; |
| 549 } | 550 } |
| 550 return packet_size; | 551 return packet_size; |
| 551 } | 552 } |
| 552 | 553 |
| 553 } // namespace content | 554 } // namespace content |
| OLD | NEW |