OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 SctpDataMediaChannel* channel = static_cast<SctpDataMediaChannel*>(addr); | 195 SctpDataMediaChannel* channel = static_cast<SctpDataMediaChannel*>(addr); |
196 LOG(LS_VERBOSE) << "global OnSctpOutboundPacket():" | 196 LOG(LS_VERBOSE) << "global OnSctpOutboundPacket():" |
197 << "addr: " << addr << "; length: " << length | 197 << "addr: " << addr << "; length: " << length |
198 << "; tos: " << std::hex << static_cast<int>(tos) | 198 << "; tos: " << std::hex << static_cast<int>(tos) |
199 << "; set_df: " << std::hex << static_cast<int>(set_df); | 199 << "; set_df: " << std::hex << static_cast<int>(set_df); |
200 | 200 |
201 VerboseLogPacket(addr, length, SCTP_DUMP_OUTBOUND); | 201 VerboseLogPacket(addr, length, SCTP_DUMP_OUTBOUND); |
202 // Note: We have to copy the data; the caller will delete it. | 202 // Note: We have to copy the data; the caller will delete it. |
203 auto* msg = new OutboundPacketMessage( | 203 auto* msg = new OutboundPacketMessage( |
204 new rtc::CopyOnWriteBuffer(reinterpret_cast<uint8_t*>(data), length)); | 204 new rtc::CopyOnWriteBuffer(reinterpret_cast<uint8_t*>(data), length)); |
205 channel->worker_thread()->Post(channel, MSG_SCTPOUTBOUNDPACKET, msg); | 205 channel->worker_thread()->Post(RTC_FROM_HERE, channel, MSG_SCTPOUTBOUNDPACKET, |
| 206 msg); |
206 return 0; | 207 return 0; |
207 } | 208 } |
208 | 209 |
209 // This is the callback called from usrsctp when data has been received, after | 210 // This is the callback called from usrsctp when data has been received, after |
210 // a packet has been interpreted and parsed by usrsctp and found to contain | 211 // a packet has been interpreted and parsed by usrsctp and found to contain |
211 // payload data. It is called by a usrsctp thread. It is assumed this function | 212 // payload data. It is called by a usrsctp thread. It is assumed this function |
212 // will free the memory used by 'data'. | 213 // will free the memory used by 'data'. |
213 int OnSctpInboundPacket(struct socket* sock, | 214 int OnSctpInboundPacket(struct socket* sock, |
214 union sctp_sockstore addr, | 215 union sctp_sockstore addr, |
215 void* data, | 216 void* data, |
(...skipping 16 matching lines...) Expand all Loading... |
232 } else { | 233 } else { |
233 SctpInboundPacket* packet = new SctpInboundPacket; | 234 SctpInboundPacket* packet = new SctpInboundPacket; |
234 packet->buffer.SetData(reinterpret_cast<uint8_t*>(data), length); | 235 packet->buffer.SetData(reinterpret_cast<uint8_t*>(data), length); |
235 packet->params.ssrc = rcv.rcv_sid; | 236 packet->params.ssrc = rcv.rcv_sid; |
236 packet->params.seq_num = rcv.rcv_ssn; | 237 packet->params.seq_num = rcv.rcv_ssn; |
237 packet->params.timestamp = rcv.rcv_tsn; | 238 packet->params.timestamp = rcv.rcv_tsn; |
238 packet->params.type = type; | 239 packet->params.type = type; |
239 packet->flags = flags; | 240 packet->flags = flags; |
240 // The ownership of |packet| transfers to |msg|. | 241 // The ownership of |packet| transfers to |msg|. |
241 InboundPacketMessage* msg = new InboundPacketMessage(packet); | 242 InboundPacketMessage* msg = new InboundPacketMessage(packet); |
242 channel->worker_thread()->Post(channel, MSG_SCTPINBOUNDPACKET, msg); | 243 channel->worker_thread()->Post(RTC_FROM_HERE, channel, |
| 244 MSG_SCTPINBOUNDPACKET, msg); |
243 } | 245 } |
244 free(data); | 246 free(data); |
245 return 1; | 247 return 1; |
246 } | 248 } |
247 | 249 |
248 void InitializeUsrSctp() { | 250 void InitializeUsrSctp() { |
249 LOG(LS_INFO) << __FUNCTION__; | 251 LOG(LS_INFO) << __FUNCTION__; |
250 // First argument is udp_encapsulation_port, which is not releveant for our | 252 // First argument is udp_encapsulation_port, which is not releveant for our |
251 // AF_CONN use of sctp. | 253 // AF_CONN use of sctp. |
252 usrsctp_init(0, &OnSctpOutboundPacket, &DebugSctpPrintf); | 254 usrsctp_init(0, &OnSctpOutboundPacket, &DebugSctpPrintf); |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 } | 1068 } |
1067 case MSG_SCTPOUTBOUNDPACKET: { | 1069 case MSG_SCTPOUTBOUNDPACKET: { |
1068 std::unique_ptr<OutboundPacketMessage> pdata( | 1070 std::unique_ptr<OutboundPacketMessage> pdata( |
1069 static_cast<OutboundPacketMessage*>(msg->pdata)); | 1071 static_cast<OutboundPacketMessage*>(msg->pdata)); |
1070 OnPacketFromSctpToNetwork(pdata->data().get()); | 1072 OnPacketFromSctpToNetwork(pdata->data().get()); |
1071 break; | 1073 break; |
1072 } | 1074 } |
1073 } | 1075 } |
1074 } | 1076 } |
1075 } // namespace cricket | 1077 } // namespace cricket |
OLD | NEW |