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 |
11 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h" | 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 #include <string.h> | 14 #include <string.h> |
15 | 15 |
16 #include <algorithm> | |
17 | |
18 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
19 #include "webrtc/base/logging.h" | 17 #include "webrtc/base/logging.h" |
20 #include "webrtc/base/trace_event.h" | 18 #include "webrtc/base/trace_event.h" |
21 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" | 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" |
22 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
23 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" | 21 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" |
24 #include "webrtc/modules/rtp_rtcp/source/time_util.h" | 22 #include "webrtc/modules/rtp_rtcp/source/time_util.h" |
25 #include "webrtc/system_wrappers/include/ntp_time.h" | 23 #include "webrtc/system_wrappers/include/ntp_time.h" |
26 | 24 |
27 namespace webrtc { | 25 namespace webrtc { |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
514 rb.ExtendedHighestSequenceNumber; | 512 rb.ExtendedHighestSequenceNumber; |
515 reportBlock->remoteReceiveBlock.jitter = rb.Jitter; | 513 reportBlock->remoteReceiveBlock.jitter = rb.Jitter; |
516 reportBlock->remoteReceiveBlock.delaySinceLastSR = rb.DelayLastSR; | 514 reportBlock->remoteReceiveBlock.delaySinceLastSR = rb.DelayLastSR; |
517 reportBlock->remoteReceiveBlock.lastSR = rb.LastSR; | 515 reportBlock->remoteReceiveBlock.lastSR = rb.LastSR; |
518 | 516 |
519 if (rtcpPacket.ReportBlockItem.Jitter > reportBlock->remoteMaxJitter) { | 517 if (rtcpPacket.ReportBlockItem.Jitter > reportBlock->remoteMaxJitter) { |
520 reportBlock->remoteMaxJitter = rtcpPacket.ReportBlockItem.Jitter; | 518 reportBlock->remoteMaxJitter = rtcpPacket.ReportBlockItem.Jitter; |
521 } | 519 } |
522 | 520 |
523 uint32_t send_time = rtcpPacket.ReportBlockItem.LastSR; | 521 uint32_t send_time = rtcpPacket.ReportBlockItem.LastSR; |
524 uint32_t rtt = 0; | 522 int64_t rtt = 0; |
525 | 523 |
526 if (send_time > 0) { | 524 if (send_time > 0) { |
527 uint32_t delay = rtcpPacket.ReportBlockItem.DelayLastSR; | 525 uint32_t delay = rtcpPacket.ReportBlockItem.DelayLastSR; |
528 // Local NTP time. | 526 // Local NTP time. |
529 uint32_t receive_time = CompactNtp(NtpTime(*_clock)); | 527 uint32_t receive_time = CompactNtp(NtpTime(*_clock)); |
530 | 528 |
531 // RTT in 1/(2^16) seconds. | 529 // RTT in 1/(2^16) seconds. |
532 uint32_t rtt_ntp = receive_time - delay - send_time; | 530 uint32_t rtt_ntp = receive_time - delay - send_time; |
533 // Convert to 1/1000 seconds (milliseconds). | 531 // Convert to 1/1000 seconds (milliseconds). |
534 uint32_t rtt_ms = CompactNtpIntervalToMs(rtt_ntp); | 532 rtt = CompactNtpRttToMs(rtt_ntp); |
åsapersson
2016/03/08 12:59:44
I think this will now also result in RTT estimates
danilchap
2016/03/08 15:02:02
It shouldn't: send_time should be set to 0 to indi
åsapersson
2016/03/08 15:22:30
The receive stream(s) has the same main_ssrc_ as t
| |
535 rtt = std::max<uint32_t>(rtt_ms, 1); | |
536 if (rtt > reportBlock->maxRTT) { | 533 if (rtt > reportBlock->maxRTT) { |
537 // Store max RTT. | 534 // Store max RTT. |
538 reportBlock->maxRTT = rtt; | 535 reportBlock->maxRTT = rtt; |
539 } | 536 } |
540 if (reportBlock->minRTT == 0) { | 537 if (reportBlock->minRTT == 0) { |
541 // First RTT. | 538 // First RTT. |
542 reportBlock->minRTT = rtt; | 539 reportBlock->minRTT = rtt; |
543 } else if (rtt < reportBlock->minRTT) { | 540 } else if (rtt < reportBlock->minRTT) { |
544 // Store min RTT. | 541 // Store min RTT. |
545 reportBlock->minRTT = rtt; | 542 reportBlock->minRTT = rtt; |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
920 uint32_t send_time = packet.XRDLRRReportBlockItem.LastRR; | 917 uint32_t send_time = packet.XRDLRRReportBlockItem.LastRR; |
921 // RFC3411, section 4.5, LRR field discription states: | 918 // RFC3411, section 4.5, LRR field discription states: |
922 // If no such block has been received, the field is set to zero. | 919 // If no such block has been received, the field is set to zero. |
923 if (send_time == 0) | 920 if (send_time == 0) |
924 return; | 921 return; |
925 | 922 |
926 uint32_t delay_rr = packet.XRDLRRReportBlockItem.DelayLastRR; | 923 uint32_t delay_rr = packet.XRDLRRReportBlockItem.DelayLastRR; |
927 uint32_t now = CompactNtp(NtpTime(*_clock)); | 924 uint32_t now = CompactNtp(NtpTime(*_clock)); |
928 | 925 |
929 uint32_t rtt_ntp = now - delay_rr - send_time; | 926 uint32_t rtt_ntp = now - delay_rr - send_time; |
930 uint32_t rtt_ms = CompactNtpIntervalToMs(rtt_ntp); | 927 xr_rr_rtt_ms_ = CompactNtpRttToMs(rtt_ntp); |
931 xr_rr_rtt_ms_ = std::max<uint32_t>(rtt_ms, 1); | |
932 | 928 |
933 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpXrDlrrReportBlock; | 929 rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpXrDlrrReportBlock; |
934 } | 930 } |
935 | 931 |
936 void | 932 void |
937 RTCPReceiver::HandleXRVOIPMetric(RTCPUtility::RTCPParserV2& rtcpParser, | 933 RTCPReceiver::HandleXRVOIPMetric(RTCPUtility::RTCPParserV2& rtcpParser, |
938 RTCPPacketInformation& rtcpPacketInformation) | 934 RTCPPacketInformation& rtcpPacketInformation) |
939 { | 935 { |
940 const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); | 936 const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); |
941 | 937 |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1445 return -1; | 1441 return -1; |
1446 } | 1442 } |
1447 num += receiveInfo->TmmbrSet.lengthOfSet(); | 1443 num += receiveInfo->TmmbrSet.lengthOfSet(); |
1448 receiveInfoIt++; | 1444 receiveInfoIt++; |
1449 } | 1445 } |
1450 } | 1446 } |
1451 return num; | 1447 return num; |
1452 } | 1448 } |
1453 | 1449 |
1454 } // namespace webrtc | 1450 } // namespace webrtc |
OLD | NEW |