| 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.h" | 5 #include "content/browser/renderer_host/p2p/socket_host.h" |
| 6 | 6 |
| 7 #include "base/sys_byteorder.h" | 7 #include "base/sys_byteorder.h" |
| 8 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" | 8 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
| 9 #include "content/browser/renderer_host/p2p/socket_host_tcp_server.h" | 9 #include "content/browser/renderer_host/p2p/socket_host_tcp_server.h" |
| 10 #include "content/browser/renderer_host/p2p/socket_host_udp.h" | 10 #include "content/browser/renderer_host/p2p/socket_host_udp.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 } | 214 } |
| 215 | 215 |
| 216 UpdateRtpAuthTag(start, rtp_length, options); | 216 UpdateRtpAuthTag(start, rtp_length, options); |
| 217 return true; | 217 return true; |
| 218 } | 218 } |
| 219 | 219 |
| 220 bool GetRtpPacketStartPositionAndLength(const char* packet, | 220 bool GetRtpPacketStartPositionAndLength(const char* packet, |
| 221 int length, | 221 int length, |
| 222 int* rtp_start_pos, | 222 int* rtp_start_pos, |
| 223 int* rtp_packet_length) { | 223 int* rtp_packet_length) { |
| 224 int rtp_begin, rtp_length; | 224 int rtp_begin; |
| 225 int rtp_length = 0; |
| 225 if (IsTurnChannelData(packet)) { | 226 if (IsTurnChannelData(packet)) { |
| 226 // Turn Channel Message header format. | 227 // Turn Channel Message header format. |
| 227 // 0 1 2 3 | 228 // 0 1 2 3 |
| 228 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 229 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 229 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 230 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 230 // | Channel Number | Length | | 231 // | Channel Number | Length | |
| 231 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 232 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 232 // | | | 233 // | | |
| 233 // / Application Data / | 234 // / Application Data / |
| 234 // / / | 235 // / / |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 return false; | 308 return false; |
| 308 } | 309 } |
| 309 | 310 |
| 310 } else { | 311 } else { |
| 311 // This is a raw RTP packet. | 312 // This is a raw RTP packet. |
| 312 rtp_begin = 0; | 313 rtp_begin = 0; |
| 313 rtp_length = length; | 314 rtp_length = length; |
| 314 } | 315 } |
| 315 | 316 |
| 316 // Making sure we have a valid RTP packet at the end. | 317 // Making sure we have a valid RTP packet at the end. |
| 317 if (!(rtp_length < kMinRtpHdrLen) && | 318 if ((rtp_length >= kMinRtpHdrLen) && |
| 318 IsRtpPacket(packet + rtp_begin, rtp_length) && | 319 IsRtpPacket(packet + rtp_begin, rtp_length) && |
| 319 ValidateRtpHeader(packet + rtp_begin, rtp_length, NULL)) { | 320 ValidateRtpHeader(packet + rtp_begin, rtp_length, NULL)) { |
| 320 *rtp_start_pos = rtp_begin; | 321 *rtp_start_pos = rtp_begin; |
| 321 *rtp_packet_length = rtp_length; | 322 *rtp_packet_length = rtp_length; |
| 322 return true; | 323 return true; |
| 323 } | 324 } |
| 324 return false; | 325 return false; |
| 325 } | 326 } |
| 326 | 327 |
| 327 // ValidateRtpHeader must be called before this method to make sure, we have | 328 // ValidateRtpHeader must be called before this method to make sure, we have |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 BrowserThread::PostTask(BrowserThread::UI, | 577 BrowserThread::PostTask(BrowserThread::UI, |
| 577 FROM_HERE, | 578 FROM_HERE, |
| 578 base::Bind(packet_dump_callback_, | 579 base::Bind(packet_dump_callback_, |
| 579 Passed(&packet_header), | 580 Passed(&packet_header), |
| 580 header_length, | 581 header_length, |
| 581 packet_length, | 582 packet_length, |
| 582 incoming)); | 583 incoming)); |
| 583 } | 584 } |
| 584 | 585 |
| 585 } // namespace content | 586 } // namespace content |
| OLD | NEW |