OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 const uint8_t* packet, | 229 const uint8_t* packet, |
230 size_t length, | 230 size_t length, |
231 const PacketTime& packet_time); | 231 const PacketTime& packet_time); |
232 void ConfigureSync(const std::string& sync_group) | 232 void ConfigureSync(const std::string& sync_group) |
233 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); | 233 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); |
234 | 234 |
235 void NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, | 235 void NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, |
236 MediaType media_type) | 236 MediaType media_type) |
237 SHARED_LOCKS_REQUIRED(receive_crit_); | 237 SHARED_LOCKS_REQUIRED(receive_crit_); |
238 | 238 |
239 rtc::Optional<RtpPacketReceived> ParseRtpPacket(const uint8_t* packet, | 239 rtc::Optional<RtpPacketReceived> ParseRtpPacket( |
240 size_t length, | 240 const uint8_t* packet, |
241 const PacketTime* packet_time) | 241 size_t length, |
242 SHARED_LOCKS_REQUIRED(receive_crit_); | 242 const PacketTime* packet_time) const; |
243 | 243 |
244 void UpdateSendHistograms(int64_t first_sent_packet_ms) | 244 void UpdateSendHistograms(int64_t first_sent_packet_ms) |
245 EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); | 245 EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); |
246 void UpdateReceiveHistograms(); | 246 void UpdateReceiveHistograms(); |
247 void UpdateHistograms(); | 247 void UpdateHistograms(); |
248 void UpdateAggregateNetworkState(); | 248 void UpdateAggregateNetworkState(); |
249 | 249 |
250 // Applies update to the BitrateConfig cached in |config_|, restarting | 250 // Applies update to the BitrateConfig cached in |config_|, restarting |
251 // bandwidth estimation from |new_start| if set. | 251 // bandwidth estimation from |new_start| if set. |
252 void UpdateCurrentBitrateConfig(const rtc::Optional<int>& new_start); | 252 void UpdateCurrentBitrateConfig(const rtc::Optional<int>& new_start); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
478 } | 478 } |
479 UpdateReceiveHistograms(); | 479 UpdateReceiveHistograms(); |
480 UpdateHistograms(); | 480 UpdateHistograms(); |
481 | 481 |
482 Trace::ReturnTrace(); | 482 Trace::ReturnTrace(); |
483 } | 483 } |
484 | 484 |
485 rtc::Optional<RtpPacketReceived> Call::ParseRtpPacket( | 485 rtc::Optional<RtpPacketReceived> Call::ParseRtpPacket( |
486 const uint8_t* packet, | 486 const uint8_t* packet, |
487 size_t length, | 487 size_t length, |
488 const PacketTime* packet_time) { | 488 const PacketTime* packet_time) const { |
489 RtpPacketReceived parsed_packet; | 489 RtpPacketReceived parsed_packet; |
490 if (!parsed_packet.Parse(packet, length)) | 490 if (!parsed_packet.Parse(packet, length)) |
491 return rtc::Optional<RtpPacketReceived>(); | 491 return rtc::Optional<RtpPacketReceived>(); |
492 | 492 |
493 int64_t arrival_time_ms; | 493 int64_t arrival_time_ms; |
494 if (packet_time && packet_time->timestamp != -1) { | 494 if (packet_time && packet_time->timestamp != -1) { |
495 arrival_time_ms = (packet_time->timestamp + 500) / 1000; | 495 arrival_time_ms = (packet_time->timestamp + 500) / 1000; |
496 } else { | 496 } else { |
497 arrival_time_ms = clock_->TimeInMilliseconds(); | 497 arrival_time_ms = clock_->TimeInMilliseconds(); |
498 } | 498 } |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1292 | 1292 |
1293 return rtcp_delivered ? DELIVERY_OK : DELIVERY_PACKET_ERROR; | 1293 return rtcp_delivered ? DELIVERY_OK : DELIVERY_PACKET_ERROR; |
1294 } | 1294 } |
1295 | 1295 |
1296 PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type, | 1296 PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type, |
1297 const uint8_t* packet, | 1297 const uint8_t* packet, |
1298 size_t length, | 1298 size_t length, |
1299 const PacketTime& packet_time) { | 1299 const PacketTime& packet_time) { |
1300 TRACE_EVENT0("webrtc", "Call::DeliverRtp"); | 1300 TRACE_EVENT0("webrtc", "Call::DeliverRtp"); |
1301 | 1301 |
1302 RTC_DCHECK(media_type == MediaType::AUDIO || media_type == MediaType::VIDEO); | |
1303 | |
1304 ReadLockScoped read_lock(*receive_crit_); | |
1305 // TODO(nisse): We should parse the RTP header only here, and pass | 1302 // TODO(nisse): We should parse the RTP header only here, and pass |
1306 // on parsed_packet to the receive streams. | 1303 // on parsed_packet to the receive streams. |
1307 rtc::Optional<RtpPacketReceived> parsed_packet = | 1304 rtc::Optional<RtpPacketReceived> parsed_packet = |
1308 ParseRtpPacket(packet, length, &packet_time); | 1305 ParseRtpPacket(packet, length, &packet_time); |
1306 const bool is_keep_alive_packet = | |
pbos-webrtc
2017/07/10 22:36:31
Can you put some reference to keepalive packets to
pbos-webrtc
2017/07/10 22:39:16
Reading the other CL, please check config_.rtp.kee
sprang_webrtc
2017/07/11 08:33:06
This is based on https://tools.ietf.org/html/rfc62
| |
1307 parsed_packet && parsed_packet->payload_size() == 0; | |
1308 | |
1309 RTC_DCHECK(media_type == MediaType::AUDIO || media_type == MediaType::VIDEO || | |
1310 is_keep_alive_packet); | |
1309 | 1311 |
1310 if (!parsed_packet) | 1312 if (!parsed_packet) |
1311 return DELIVERY_PACKET_ERROR; | 1313 return DELIVERY_PACKET_ERROR; |
1312 | 1314 |
1315 ReadLockScoped read_lock(*receive_crit_); | |
1313 auto it = receive_rtp_config_.find(parsed_packet->Ssrc()); | 1316 auto it = receive_rtp_config_.find(parsed_packet->Ssrc()); |
1314 if (it == receive_rtp_config_.end()) { | 1317 if (it == receive_rtp_config_.end()) { |
1315 LOG(LS_ERROR) << "receive_rtp_config_ lookup failed for ssrc " | 1318 LOG(LS_ERROR) << "receive_rtp_config_ lookup failed for ssrc " |
1316 << parsed_packet->Ssrc(); | 1319 << parsed_packet->Ssrc(); |
1317 // Destruction of the receive stream, including deregistering from the | 1320 // Destruction of the receive stream, including deregistering from the |
1318 // RtpDemuxer, is not protected by the |receive_crit_| lock. But | 1321 // RtpDemuxer, is not protected by the |receive_crit_| lock. But |
1319 // deregistering in the |receive_rtp_config_| map is protected by that lock. | 1322 // deregistering in the |receive_rtp_config_| map is protected by that lock. |
1320 // So by not passing the packet on to demuxing in this case, we prevent | 1323 // So by not passing the packet on to demuxing in this case, we prevent |
1321 // incoming packets to be passed on via the demuxer to a receive stream | 1324 // incoming packets to be passed on via the demuxer to a receive stream |
1322 // which is being torned down. | 1325 // which is being torned down. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1407 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { | 1410 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { |
1408 receive_side_cc_.OnReceivedPacket( | 1411 receive_side_cc_.OnReceivedPacket( |
1409 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), | 1412 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), |
1410 header); | 1413 header); |
1411 } | 1414 } |
1412 } | 1415 } |
1413 | 1416 |
1414 } // namespace internal | 1417 } // namespace internal |
1415 | 1418 |
1416 } // namespace webrtc | 1419 } // namespace webrtc |
OLD | NEW |