Chromium Code Reviews| 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 635 if (rtx_ == kRtxOff) { | 635 if (rtx_ == kRtxOff) { |
| 636 // Without RTX we can't send padding in the middle of frames. | 636 // Without RTX we can't send padding in the middle of frames. |
| 637 if (!last_packet_marker_bit_) | 637 if (!last_packet_marker_bit_) |
| 638 return 0; | 638 return 0; |
| 639 ssrc = ssrc_; | 639 ssrc = ssrc_; |
| 640 sequence_number = sequence_number_; | 640 sequence_number = sequence_number_; |
| 641 ++sequence_number_; | 641 ++sequence_number_; |
| 642 payload_type = payload_type_; | 642 payload_type = payload_type_; |
| 643 over_rtx = false; | 643 over_rtx = false; |
| 644 } else { | 644 } else { |
| 645 // Without abs-send-time a media packet must be sent before padding so | 645 // Without abs-send-time or transport sequence number a media packet |
| 646 // that the timestamps used for estimation are correct. | 646 // must be sent before padding so that the timestamps used for |
| 647 if (!media_has_been_sent_ && !rtp_header_extension_map_.IsRegistered( | 647 // estimation are correct. |
| 648 kRtpExtensionAbsoluteSendTime)) | 648 if (!media_has_been_sent_ && !(rtp_header_extension_map_.IsRegistered( |
| 649 kRtpExtensionAbsoluteSendTime) || using_transport_seq)) { | |
| 649 return 0; | 650 return 0; |
| 651 } | |
| 650 // Only change change the timestamp of padding packets sent over RTX. | 652 // Only change change the timestamp of padding packets sent over RTX. |
| 651 // Padding only packets over RTP has to be sent as part of a media | 653 // Padding only packets over RTP has to be sent as part of a media |
| 652 // frame (and therefore the same timestamp). | 654 // frame (and therefore the same timestamp). |
| 653 if (last_timestamp_time_ms_ > 0) { | 655 if (last_timestamp_time_ms_ > 0) { |
| 654 timestamp += | 656 timestamp += |
| 655 (clock_->TimeInMilliseconds() - last_timestamp_time_ms_) * 90; | 657 (clock_->TimeInMilliseconds() - last_timestamp_time_ms_) * 90; |
| 656 capture_time_ms += | 658 capture_time_ms += |
| 657 (clock_->TimeInMilliseconds() - last_timestamp_time_ms_); | 659 (clock_->TimeInMilliseconds() - last_timestamp_time_ms_); |
| 658 } | 660 } |
| 659 ssrc = ssrc_rtx_; | 661 ssrc = ssrc_rtx_; |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1072 TRACE_EVENT_ASYNC_BEGIN1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | 1074 TRACE_EVENT_ASYNC_BEGIN1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
| 1073 "PacedSend", corrected_time_ms, | 1075 "PacedSend", corrected_time_ms, |
| 1074 "capture_time_ms", corrected_time_ms); | 1076 "capture_time_ms", corrected_time_ms); |
| 1075 } | 1077 } |
| 1076 return 0; | 1078 return 0; |
| 1077 } | 1079 } |
| 1078 if (capture_time_ms > 0) { | 1080 if (capture_time_ms > 0) { |
| 1079 UpdateDelayStatistics(capture_time_ms, now_ms); | 1081 UpdateDelayStatistics(capture_time_ms, now_ms); |
| 1080 } | 1082 } |
| 1081 | 1083 |
| 1082 bool sent = SendPacketToNetwork(buffer, length, PacketOptions()); | 1084 // TODO(sprang): Potentially too much overhead in IsRegistered()? |
| 1085 bool using_transport_seq = rtp_header_extension_map_.IsRegistered( | |
| 1086 kRtpExtensionTransportSequenceNumber) && | |
| 1087 transport_sequence_number_allocator_; | |
| 1088 | |
| 1089 PacketOptions options; | |
| 1090 if (using_transport_seq) { | |
| 1091 options.packet_id = | |
| 1092 UpdateTransportSequenceNumber(buffer, length, rtp_header); | |
| 1093 } | |
| 1094 | |
| 1095 if (using_transport_seq && transport_feedback_observer_) { | |
|
sprang_webrtc
2016/01/27 11:32:17
Nit: Wrap in same if-block as if (using_transport_
stefan-webrtc
2016/01/27 11:39:41
Done.
| |
| 1096 transport_feedback_observer_->AddPacket(options.packet_id, length, true); | |
| 1097 } | |
| 1098 | |
| 1099 bool sent = SendPacketToNetwork(buffer, length, options); | |
| 1083 | 1100 |
| 1084 // Mark the packet as sent in the history even if send failed. Dropping a | 1101 // Mark the packet as sent in the history even if send failed. Dropping a |
| 1085 // packet here should be treated as any other packet drop so we should be | 1102 // packet here should be treated as any other packet drop so we should be |
| 1086 // ready for a retransmission. | 1103 // ready for a retransmission. |
| 1087 packet_history_.SetSent(rtp_header.sequenceNumber); | 1104 packet_history_.SetSent(rtp_header.sequenceNumber); |
| 1088 | 1105 |
| 1089 if (!sent) | 1106 if (!sent) |
| 1090 return -1; | 1107 return -1; |
| 1091 | 1108 |
| 1092 { | 1109 { |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1905 CriticalSectionScoped lock(send_critsect_.get()); | 1922 CriticalSectionScoped lock(send_critsect_.get()); |
| 1906 | 1923 |
| 1907 RtpState state; | 1924 RtpState state; |
| 1908 state.sequence_number = sequence_number_rtx_; | 1925 state.sequence_number = sequence_number_rtx_; |
| 1909 state.start_timestamp = start_timestamp_; | 1926 state.start_timestamp = start_timestamp_; |
| 1910 | 1927 |
| 1911 return state; | 1928 return state; |
| 1912 } | 1929 } |
| 1913 | 1930 |
| 1914 } // namespace webrtc | 1931 } // namespace webrtc |
| OLD | NEW |