| 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/criticalsection.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" | |
| 22 #include "webrtc/system_wrappers/include/ntp_time.h" | 21 #include "webrtc/system_wrappers/include/ntp_time.h" |
| 23 | 22 |
| 24 namespace webrtc { | 23 namespace webrtc { |
| 25 | 24 |
| 26 class CriticalSectionWrapper; | |
| 27 | |
| 28 class StreamStatisticianImpl : public StreamStatistician { | 25 class StreamStatisticianImpl : public StreamStatistician { |
| 29 public: | 26 public: |
| 30 StreamStatisticianImpl(Clock* clock, | 27 StreamStatisticianImpl(Clock* clock, |
| 31 RtcpStatisticsCallback* rtcp_callback, | 28 RtcpStatisticsCallback* rtcp_callback, |
| 32 StreamDataCountersCallback* rtp_callback); | 29 StreamDataCountersCallback* rtp_callback); |
| 33 virtual ~StreamStatisticianImpl() {} | 30 virtual ~StreamStatisticianImpl() {} |
| 34 | 31 |
| 35 bool GetStatistics(RtcpStatistics* statistics, bool reset) override; | 32 bool GetStatistics(RtcpStatistics* statistics, bool reset) override; |
| 36 void GetDataCounters(size_t* bytes_received, | 33 void GetDataCounters(size_t* bytes_received, |
| 37 uint32_t* packets_received) const override; | 34 uint32_t* packets_received) const override; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 50 void ProcessBitrate(); | 47 void ProcessBitrate(); |
| 51 virtual void LastReceiveTimeNtp(uint32_t* secs, uint32_t* frac) const; | 48 virtual void LastReceiveTimeNtp(uint32_t* secs, uint32_t* frac) const; |
| 52 | 49 |
| 53 private: | 50 private: |
| 54 bool InOrderPacketInternal(uint16_t sequence_number) const; | 51 bool InOrderPacketInternal(uint16_t sequence_number) const; |
| 55 RtcpStatistics CalculateRtcpStatistics(); | 52 RtcpStatistics CalculateRtcpStatistics(); |
| 56 void UpdateJitter(const RTPHeader& header, NtpTime receive_time); | 53 void UpdateJitter(const RTPHeader& header, NtpTime receive_time); |
| 57 void UpdateCounters(const RTPHeader& rtp_header, | 54 void UpdateCounters(const RTPHeader& rtp_header, |
| 58 size_t packet_length, | 55 size_t packet_length, |
| 59 bool retransmitted); | 56 bool retransmitted); |
| 60 void NotifyRtpCallback() LOCKS_EXCLUDED(stream_lock_.get()); | 57 void NotifyRtpCallback() LOCKS_EXCLUDED(stream_lock_); |
| 61 void NotifyRtcpCallback() LOCKS_EXCLUDED(stream_lock_.get()); | 58 void NotifyRtcpCallback() LOCKS_EXCLUDED(stream_lock_); |
| 62 | 59 |
| 63 Clock* clock_; | 60 Clock* clock_; |
| 64 rtc::scoped_ptr<CriticalSectionWrapper> stream_lock_; | 61 rtc::CriticalSection stream_lock_; |
| 65 Bitrate incoming_bitrate_; | 62 Bitrate incoming_bitrate_; |
| 66 uint32_t ssrc_; | 63 uint32_t ssrc_; |
| 67 int max_reordering_threshold_; // In number of packets or sequence numbers. | 64 int max_reordering_threshold_; // In number of packets or sequence numbers. |
| 68 | 65 |
| 69 // Stats on received RTP packets. | 66 // Stats on received RTP packets. |
| 70 uint32_t jitter_q4_; | 67 uint32_t jitter_q4_; |
| 71 uint32_t cumulative_loss_; | 68 uint32_t cumulative_loss_; |
| 72 uint32_t jitter_q4_transmission_time_offset_; | 69 uint32_t jitter_q4_transmission_time_offset_; |
| 73 | 70 |
| 74 int64_t last_receive_time_ms_; | 71 int64_t last_receive_time_ms_; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 private: | 121 private: |
| 125 void StatisticsUpdated(const RtcpStatistics& statistics, | 122 void StatisticsUpdated(const RtcpStatistics& statistics, |
| 126 uint32_t ssrc) override; | 123 uint32_t ssrc) override; |
| 127 void CNameChanged(const char* cname, uint32_t ssrc) override; | 124 void CNameChanged(const char* cname, uint32_t ssrc) override; |
| 128 void DataCountersUpdated(const StreamDataCounters& counters, | 125 void DataCountersUpdated(const StreamDataCounters& counters, |
| 129 uint32_t ssrc) override; | 126 uint32_t ssrc) override; |
| 130 | 127 |
| 131 typedef std::map<uint32_t, StreamStatisticianImpl*> StatisticianImplMap; | 128 typedef std::map<uint32_t, StreamStatisticianImpl*> StatisticianImplMap; |
| 132 | 129 |
| 133 Clock* clock_; | 130 Clock* clock_; |
| 134 rtc::scoped_ptr<CriticalSectionWrapper> receive_statistics_lock_; | 131 rtc::CriticalSection receive_statistics_lock_; |
| 135 int64_t last_rate_update_ms_; | 132 int64_t last_rate_update_ms_; |
| 136 StatisticianImplMap statisticians_; | 133 StatisticianImplMap statisticians_; |
| 137 | 134 |
| 138 RtcpStatisticsCallback* rtcp_stats_callback_; | 135 RtcpStatisticsCallback* rtcp_stats_callback_; |
| 139 StreamDataCountersCallback* rtp_stats_callback_; | 136 StreamDataCountersCallback* rtp_stats_callback_; |
| 140 }; | 137 }; |
| 141 } // namespace webrtc | 138 } // namespace webrtc |
| 142 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RECEIVE_STATISTICS_IMPL_H_ | 139 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RECEIVE_STATISTICS_IMPL_H_ |
| OLD | NEW |