| 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_ && |
| 649 !(rtp_header_extension_map_.IsRegistered( |
| 650 kRtpExtensionAbsoluteSendTime) || |
| 651 using_transport_seq)) { |
| 649 return 0; | 652 return 0; |
| 653 } |
| 650 // Only change change the timestamp of padding packets sent over RTX. | 654 // 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 | 655 // Padding only packets over RTP has to be sent as part of a media |
| 652 // frame (and therefore the same timestamp). | 656 // frame (and therefore the same timestamp). |
| 653 if (last_timestamp_time_ms_ > 0) { | 657 if (last_timestamp_time_ms_ > 0) { |
| 654 timestamp += | 658 timestamp += |
| 655 (clock_->TimeInMilliseconds() - last_timestamp_time_ms_) * 90; | 659 (clock_->TimeInMilliseconds() - last_timestamp_time_ms_) * 90; |
| 656 capture_time_ms += | 660 capture_time_ms += |
| 657 (clock_->TimeInMilliseconds() - last_timestamp_time_ms_); | 661 (clock_->TimeInMilliseconds() - last_timestamp_time_ms_); |
| 658 } | 662 } |
| 659 ssrc = ssrc_rtx_; | 663 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"), | 1076 TRACE_EVENT_ASYNC_BEGIN1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
| 1073 "PacedSend", corrected_time_ms, | 1077 "PacedSend", corrected_time_ms, |
| 1074 "capture_time_ms", corrected_time_ms); | 1078 "capture_time_ms", corrected_time_ms); |
| 1075 } | 1079 } |
| 1076 return 0; | 1080 return 0; |
| 1077 } | 1081 } |
| 1078 if (capture_time_ms > 0) { | 1082 if (capture_time_ms > 0) { |
| 1079 UpdateDelayStatistics(capture_time_ms, now_ms); | 1083 UpdateDelayStatistics(capture_time_ms, now_ms); |
| 1080 } | 1084 } |
| 1081 | 1085 |
| 1082 bool sent = SendPacketToNetwork(buffer, length, PacketOptions()); | 1086 // TODO(sprang): Potentially too much overhead in IsRegistered()? |
| 1087 bool using_transport_seq = rtp_header_extension_map_.IsRegistered( |
| 1088 kRtpExtensionTransportSequenceNumber) && |
| 1089 transport_sequence_number_allocator_; |
| 1090 |
| 1091 PacketOptions options; |
| 1092 if (using_transport_seq) { |
| 1093 options.packet_id = |
| 1094 UpdateTransportSequenceNumber(buffer, length, rtp_header); |
| 1095 if (transport_feedback_observer_) { |
| 1096 transport_feedback_observer_->AddPacket(options.packet_id, length, true); |
| 1097 } |
| 1098 } |
| 1099 |
| 1100 bool sent = SendPacketToNetwork(buffer, length, options); |
| 1083 | 1101 |
| 1084 // Mark the packet as sent in the history even if send failed. Dropping a | 1102 // 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 | 1103 // packet here should be treated as any other packet drop so we should be |
| 1086 // ready for a retransmission. | 1104 // ready for a retransmission. |
| 1087 packet_history_.SetSent(rtp_header.sequenceNumber); | 1105 packet_history_.SetSent(rtp_header.sequenceNumber); |
| 1088 | 1106 |
| 1089 if (!sent) | 1107 if (!sent) |
| 1090 return -1; | 1108 return -1; |
| 1091 | 1109 |
| 1092 { | 1110 { |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1905 CriticalSectionScoped lock(send_critsect_.get()); | 1923 CriticalSectionScoped lock(send_critsect_.get()); |
| 1906 | 1924 |
| 1907 RtpState state; | 1925 RtpState state; |
| 1908 state.sequence_number = sequence_number_rtx_; | 1926 state.sequence_number = sequence_number_rtx_; |
| 1909 state.start_timestamp = start_timestamp_; | 1927 state.start_timestamp = start_timestamp_; |
| 1910 | 1928 |
| 1911 return state; | 1929 return state; |
| 1912 } | 1930 } |
| 1913 | 1931 |
| 1914 } // namespace webrtc | 1932 } // namespace webrtc |
| OLD | NEW |