OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RECEIVE_STATISTICS_IMPL_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RECEIVE_STATISTICS_IMPL_H_ |
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RECEIVE_STATISTICS_IMPL_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RECEIVE_STATISTICS_IMPL_H_ |
13 | 13 |
14 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" | 14 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" |
15 | 15 |
16 #include <algorithm> | 16 #include <algorithm> |
17 #include <map> | 17 #include <map> |
18 | 18 |
19 #include "webrtc/base/scoped_ptr.h" | 19 #include "webrtc/base/scoped_ptr.h" |
20 #include "webrtc/modules/rtp_rtcp/source/bitrate.h" | 20 #include "webrtc/modules/rtp_rtcp/source/bitrate.h" |
21 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 21 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| 22 #include "webrtc/system_wrappers/include/ntp_time.h" |
22 | 23 |
23 namespace webrtc { | 24 namespace webrtc { |
24 | 25 |
25 class CriticalSectionWrapper; | 26 class CriticalSectionWrapper; |
26 | 27 |
27 class StreamStatisticianImpl : public StreamStatistician { | 28 class StreamStatisticianImpl : public StreamStatistician { |
28 public: | 29 public: |
29 StreamStatisticianImpl(Clock* clock, | 30 StreamStatisticianImpl(Clock* clock, |
30 RtcpStatisticsCallback* rtcp_callback, | 31 RtcpStatisticsCallback* rtcp_callback, |
31 StreamDataCountersCallback* rtp_callback); | 32 StreamDataCountersCallback* rtp_callback); |
(...skipping 13 matching lines...) Expand all Loading... |
45 size_t packet_length, | 46 size_t packet_length, |
46 bool retransmitted); | 47 bool retransmitted); |
47 void FecPacketReceived(const RTPHeader& header, size_t packet_length); | 48 void FecPacketReceived(const RTPHeader& header, size_t packet_length); |
48 void SetMaxReorderingThreshold(int max_reordering_threshold); | 49 void SetMaxReorderingThreshold(int max_reordering_threshold); |
49 void ProcessBitrate(); | 50 void ProcessBitrate(); |
50 virtual void LastReceiveTimeNtp(uint32_t* secs, uint32_t* frac) const; | 51 virtual void LastReceiveTimeNtp(uint32_t* secs, uint32_t* frac) const; |
51 | 52 |
52 private: | 53 private: |
53 bool InOrderPacketInternal(uint16_t sequence_number) const; | 54 bool InOrderPacketInternal(uint16_t sequence_number) const; |
54 RtcpStatistics CalculateRtcpStatistics(); | 55 RtcpStatistics CalculateRtcpStatistics(); |
55 void UpdateJitter(const RTPHeader& header, | 56 void UpdateJitter(const RTPHeader& header, NtpTime receive_time); |
56 uint32_t receive_time_secs, | |
57 uint32_t receive_time_frac); | |
58 void UpdateCounters(const RTPHeader& rtp_header, | 57 void UpdateCounters(const RTPHeader& rtp_header, |
59 size_t packet_length, | 58 size_t packet_length, |
60 bool retransmitted); | 59 bool retransmitted); |
61 void NotifyRtpCallback() LOCKS_EXCLUDED(stream_lock_.get()); | 60 void NotifyRtpCallback() LOCKS_EXCLUDED(stream_lock_.get()); |
62 void NotifyRtcpCallback() LOCKS_EXCLUDED(stream_lock_.get()); | 61 void NotifyRtcpCallback() LOCKS_EXCLUDED(stream_lock_.get()); |
63 | 62 |
64 Clock* clock_; | 63 Clock* clock_; |
65 rtc::scoped_ptr<CriticalSectionWrapper> stream_lock_; | 64 rtc::scoped_ptr<CriticalSectionWrapper> stream_lock_; |
66 Bitrate incoming_bitrate_; | 65 Bitrate incoming_bitrate_; |
67 uint32_t ssrc_; | 66 uint32_t ssrc_; |
68 int max_reordering_threshold_; // In number of packets or sequence numbers. | 67 int max_reordering_threshold_; // In number of packets or sequence numbers. |
69 | 68 |
70 // Stats on received RTP packets. | 69 // Stats on received RTP packets. |
71 uint32_t jitter_q4_; | 70 uint32_t jitter_q4_; |
72 uint32_t cumulative_loss_; | 71 uint32_t cumulative_loss_; |
73 uint32_t jitter_q4_transmission_time_offset_; | 72 uint32_t jitter_q4_transmission_time_offset_; |
74 | 73 |
75 int64_t last_receive_time_ms_; | 74 int64_t last_receive_time_ms_; |
76 uint32_t last_receive_time_secs_; | 75 NtpTime last_receive_time_ntp_; |
77 uint32_t last_receive_time_frac_; | |
78 uint32_t last_received_timestamp_; | 76 uint32_t last_received_timestamp_; |
79 int32_t last_received_transmission_time_offset_; | 77 int32_t last_received_transmission_time_offset_; |
80 uint16_t received_seq_first_; | 78 uint16_t received_seq_first_; |
81 uint16_t received_seq_max_; | 79 uint16_t received_seq_max_; |
82 uint16_t received_seq_wraps_; | 80 uint16_t received_seq_wraps_; |
83 | 81 |
84 // Current counter values. | 82 // Current counter values. |
85 size_t received_packet_overhead_; | 83 size_t received_packet_overhead_; |
86 StreamDataCounters receive_counters_; | 84 StreamDataCounters receive_counters_; |
87 | 85 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 Clock* clock_; | 133 Clock* clock_; |
136 rtc::scoped_ptr<CriticalSectionWrapper> receive_statistics_lock_; | 134 rtc::scoped_ptr<CriticalSectionWrapper> receive_statistics_lock_; |
137 int64_t last_rate_update_ms_; | 135 int64_t last_rate_update_ms_; |
138 StatisticianImplMap statisticians_; | 136 StatisticianImplMap statisticians_; |
139 | 137 |
140 RtcpStatisticsCallback* rtcp_stats_callback_; | 138 RtcpStatisticsCallback* rtcp_stats_callback_; |
141 StreamDataCountersCallback* rtp_stats_callback_; | 139 StreamDataCountersCallback* rtp_stats_callback_; |
142 }; | 140 }; |
143 } // namespace webrtc | 141 } // namespace webrtc |
144 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RECEIVE_STATISTICS_IMPL_H_ | 142 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RECEIVE_STATISTICS_IMPL_H_ |
OLD | NEW |