| 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 20 matching lines...) Expand all Loading... |
| 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" | 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" |
| 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h" | 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h" |
| 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h" | 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h" |
| 34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h" | 34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h" |
| 35 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" | 35 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" |
| 36 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" | 36 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" |
| 37 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h" | 37 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h" |
| 38 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" | 38 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" |
| 39 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" | 39 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" |
| 40 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" | 40 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" |
| 41 #include "webrtc/modules/rtp_rtcp/source/time_util.h" |
| 41 #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h" | 42 #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h" |
| 42 | 43 |
| 43 namespace webrtc { | 44 namespace webrtc { |
| 44 | 45 |
| 45 namespace { | 46 namespace { |
| 46 const uint32_t kRtcpAnyExtendedReports = | 47 const uint32_t kRtcpAnyExtendedReports = |
| 47 kRtcpXrVoipMetric | kRtcpXrReceiverReferenceTime | kRtcpXrDlrrReportBlock | | 48 kRtcpXrVoipMetric | kRtcpXrReceiverReferenceTime | kRtcpXrDlrrReportBlock | |
| 48 kRtcpXrTargetBitrate; | 49 kRtcpXrTargetBitrate; |
| 49 } // namespace | 50 } // namespace |
| 50 | 51 |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 report_blocks_.erase(ssrc); | 900 report_blocks_.erase(ssrc); |
| 900 LOG(LS_WARNING) << "Cumulative lost is oversized."; | 901 LOG(LS_WARNING) << "Cumulative lost is oversized."; |
| 901 return false; | 902 return false; |
| 902 } | 903 } |
| 903 block->SetExtHighestSeqNum(stats.extended_max_sequence_number); | 904 block->SetExtHighestSeqNum(stats.extended_max_sequence_number); |
| 904 block->SetJitter(stats.jitter); | 905 block->SetJitter(stats.jitter); |
| 905 block->SetLastSr(feedback_state.remote_sr); | 906 block->SetLastSr(feedback_state.remote_sr); |
| 906 | 907 |
| 907 // TODO(sprang): Do we really need separate time stamps for each report? | 908 // TODO(sprang): Do we really need separate time stamps for each report? |
| 908 // Get our NTP as late as possible to avoid a race. | 909 // Get our NTP as late as possible to avoid a race. |
| 909 uint32_t ntp_secs; | 910 NtpTime ntp = clock_->CurrentNtpTime(); |
| 910 uint32_t ntp_frac; | |
| 911 clock_->CurrentNtp(ntp_secs, ntp_frac); | |
| 912 | 911 |
| 913 // Delay since last received report. | 912 // Delay since last received report. |
| 914 if ((feedback_state.last_rr_ntp_secs != 0) || | 913 if ((feedback_state.last_rr_ntp_secs != 0) || |
| 915 (feedback_state.last_rr_ntp_frac != 0)) { | 914 (feedback_state.last_rr_ntp_frac != 0)) { |
| 916 // Get the 16 lowest bits of seconds and the 16 highest bits of fractions. | 915 // Get the 16 lowest bits of seconds and the 16 highest bits of fractions. |
| 917 uint32_t now = ntp_secs & 0x0000FFFF; | 916 uint32_t now = CompactNtp(ntp); |
| 918 now <<= 16; | |
| 919 now += (ntp_frac & 0xffff0000) >> 16; | |
| 920 | 917 |
| 921 uint32_t receiveTime = feedback_state.last_rr_ntp_secs & 0x0000FFFF; | 918 uint32_t receiveTime = feedback_state.last_rr_ntp_secs & 0x0000FFFF; |
| 922 receiveTime <<= 16; | 919 receiveTime <<= 16; |
| 923 receiveTime += (feedback_state.last_rr_ntp_frac & 0xffff0000) >> 16; | 920 receiveTime += (feedback_state.last_rr_ntp_frac & 0xffff0000) >> 16; |
| 924 | 921 |
| 925 block->SetDelayLastSr(now - receiveTime); | 922 block->SetDelayLastSr(now - receiveTime); |
| 926 } | 923 } |
| 927 return true; | 924 return true; |
| 928 } | 925 } |
| 929 | 926 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 return false; | 1046 return false; |
| 1050 } | 1047 } |
| 1051 | 1048 |
| 1052 RTC_DCHECK_LE(max_packet_size_, IP_PACKET_SIZE); | 1049 RTC_DCHECK_LE(max_packet_size_, IP_PACKET_SIZE); |
| 1053 uint8_t buffer[IP_PACKET_SIZE]; | 1050 uint8_t buffer[IP_PACKET_SIZE]; |
| 1054 return packet.BuildExternalBuffer(buffer, max_packet_size_, &sender) && | 1051 return packet.BuildExternalBuffer(buffer, max_packet_size_, &sender) && |
| 1055 !sender.send_failure_; | 1052 !sender.send_failure_; |
| 1056 } | 1053 } |
| 1057 | 1054 |
| 1058 } // namespace webrtc | 1055 } // namespace webrtc |
| OLD | NEW |