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 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 705 if (paced_sender_) { | 705 if (paced_sender_) { |
| 706 RtpUtility::RtpHeaderParser rtp_parser(data_buffer, length); | 706 RtpUtility::RtpHeaderParser rtp_parser(data_buffer, length); |
| 707 RTPHeader header; | 707 RTPHeader header; |
| 708 if (!rtp_parser.Parse(header)) { | 708 if (!rtp_parser.Parse(header)) { |
| 709 assert(false); | 709 assert(false); |
| 710 return -1; | 710 return -1; |
| 711 } | 711 } |
| 712 // Convert from TickTime to Clock since capture_time_ms is based on | 712 // Convert from TickTime to Clock since capture_time_ms is based on |
| 713 // TickTime. | 713 // TickTime. |
| 714 int64_t corrected_capture_tims_ms = capture_time_ms + clock_delta_ms_; | 714 int64_t corrected_capture_tims_ms = capture_time_ms + clock_delta_ms_; |
| 715 if (!paced_sender_->SendPacket( | 715 paced_sender_->InsertPacket( |
| 716 RtpPacketSender::kHighPriority, header.ssrc, header.sequenceNumber, | 716 RtpPacketSender::kHighPriority, header.ssrc, header.sequenceNumber, |
| 717 corrected_capture_tims_ms, length - header.headerLength, true)) { | 717 corrected_capture_tims_ms, length - header.headerLength, true); |
| 718 // We can't send the packet right now. | 718 |
| 719 // We will be called when it is time. | 719 return length; |
| 720 return length; | |
| 721 } | |
| 722 } | 720 } |
| 723 int rtx = kRtxOff; | 721 int rtx = kRtxOff; |
| 724 { | 722 { |
| 725 CriticalSectionScoped lock(send_critsect_.get()); | 723 CriticalSectionScoped lock(send_critsect_.get()); |
| 726 rtx = rtx_; | 724 rtx = rtx_; |
| 727 } | 725 } |
| 728 if (!PrepareAndSendPacket(data_buffer, length, capture_time_ms, | 726 if (!PrepareAndSendPacket(data_buffer, length, capture_time_ms, |
| 729 (rtx & kRtxRetransmitted) > 0, true)) { | 727 (rtx & kRtxRetransmitted) > 0, true)) { |
| 730 return -1; | 728 return -1; |
| 731 } | 729 } |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1030 | 1028 |
| 1031 UpdateAbsoluteSendTime(buffer, payload_length + rtp_header_length, | 1029 UpdateAbsoluteSendTime(buffer, payload_length + rtp_header_length, |
| 1032 rtp_header, now_ms); | 1030 rtp_header, now_ms); |
| 1033 | 1031 |
| 1034 // Used for NACK and to spread out the transmission of packets. | 1032 // Used for NACK and to spread out the transmission of packets. |
| 1035 if (packet_history_.PutRTPPacket(buffer, rtp_header_length + payload_length, | 1033 if (packet_history_.PutRTPPacket(buffer, rtp_header_length + payload_length, |
| 1036 capture_time_ms, storage) != 0) { | 1034 capture_time_ms, storage) != 0) { |
| 1037 return -1; | 1035 return -1; |
| 1038 } | 1036 } |
| 1039 | 1037 |
| 1040 if (paced_sender_ && storage != kDontStore) { | 1038 if (paced_sender_ && storage != kDontStore) { |
|
stefan-webrtc
2015/10/06 14:32:33
It worries me a bit that we allow some packets to
pbos-webrtc
2015/10/06 14:58:25
Done.
| |
| 1041 // Correct offset between implementations of millisecond time stamps in | 1039 // Correct offset between implementations of millisecond time stamps in |
| 1042 // TickTime and Clock. | 1040 // TickTime and Clock. |
| 1043 int64_t corrected_time_ms = capture_time_ms + clock_delta_ms_; | 1041 int64_t corrected_time_ms = capture_time_ms + clock_delta_ms_; |
| 1044 if (!paced_sender_->SendPacket(priority, rtp_header.ssrc, | 1042 paced_sender_->InsertPacket(priority, rtp_header.ssrc, |
| 1045 rtp_header.sequenceNumber, corrected_time_ms, | 1043 rtp_header.sequenceNumber, corrected_time_ms, |
| 1046 payload_length, false)) { | 1044 payload_length, false); |
| 1047 if (last_capture_time_ms_sent_ == 0 || | 1045 if (last_capture_time_ms_sent_ == 0 || |
| 1048 corrected_time_ms > last_capture_time_ms_sent_) { | 1046 corrected_time_ms > last_capture_time_ms_sent_) { |
| 1049 last_capture_time_ms_sent_ = corrected_time_ms; | 1047 last_capture_time_ms_sent_ = corrected_time_ms; |
| 1050 TRACE_EVENT_ASYNC_BEGIN1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | 1048 TRACE_EVENT_ASYNC_BEGIN1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
| 1051 "PacedSend", corrected_time_ms, | 1049 "PacedSend", corrected_time_ms, |
| 1052 "capture_time_ms", corrected_time_ms); | 1050 "capture_time_ms", corrected_time_ms); |
| 1053 } | |
| 1054 // We can't send the packet right now. | |
| 1055 // We will be called when it is time. | |
| 1056 return 0; | |
| 1057 } | 1051 } |
| 1052 return 0; | |
| 1058 } | 1053 } |
| 1059 if (capture_time_ms > 0) { | 1054 if (capture_time_ms > 0) { |
| 1060 UpdateDelayStatistics(capture_time_ms, now_ms); | 1055 UpdateDelayStatistics(capture_time_ms, now_ms); |
| 1061 } | 1056 } |
| 1062 | 1057 |
| 1063 size_t length = payload_length + rtp_header_length; | 1058 size_t length = payload_length + rtp_header_length; |
| 1064 bool sent = SendPacketToNetwork(buffer, length, PacketOptions()); | 1059 bool sent = SendPacketToNetwork(buffer, length, PacketOptions()); |
| 1065 | 1060 |
| 1066 if (storage != kDontStore) { | 1061 if (storage != kDontStore) { |
| 1067 // Mark the packet as sent in the history even if send failed. Dropping a | 1062 // Mark the packet as sent in the history even if send failed. Dropping a |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1904 CriticalSectionScoped lock(send_critsect_.get()); | 1899 CriticalSectionScoped lock(send_critsect_.get()); |
| 1905 | 1900 |
| 1906 RtpState state; | 1901 RtpState state; |
| 1907 state.sequence_number = sequence_number_rtx_; | 1902 state.sequence_number = sequence_number_rtx_; |
| 1908 state.start_timestamp = start_timestamp_; | 1903 state.start_timestamp = start_timestamp_; |
| 1909 | 1904 |
| 1910 return state; | 1905 return state; |
| 1911 } | 1906 } |
| 1912 | 1907 |
| 1913 } // namespace webrtc | 1908 } // namespace webrtc |
| OLD | NEW |