OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_CAST_NET_RTP_RECEIVER_STATS_H_ | 5 #ifndef MEDIA_CAST_NET_RTP_RECEIVER_STATS_H_ |
6 #define MEDIA_CAST_NET_RTP_RECEIVER_STATS_H_ | 6 #define MEDIA_CAST_NET_RTP_RECEIVER_STATS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/time/tick_clock.h" | 11 #include "base/time/tick_clock.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "media/cast/common/rtp_time.h" |
13 #include "media/cast/net/rtcp/rtcp.h" | 14 #include "media/cast/net/rtcp/rtcp.h" |
14 #include "media/cast/net/rtp/rtp_defines.h" | 15 #include "media/cast/net/rtp/rtp_defines.h" |
15 | 16 |
16 namespace media { | 17 namespace media { |
17 namespace cast { | 18 namespace cast { |
18 | 19 |
| 20 // TODO(miu): Document this class. |
19 class ReceiverStats { | 21 class ReceiverStats { |
20 public: | 22 public: |
21 explicit ReceiverStats(base::TickClock* clock); | 23 explicit ReceiverStats(base::TickClock* clock); |
22 | 24 |
23 RtpReceiverStatistics GetStatistics(); | 25 RtpReceiverStatistics GetStatistics(); |
24 void UpdateStatistics(const RtpCastHeader& header); | 26 void UpdateStatistics(const RtpCastHeader& header, int rtp_timebase); |
25 | 27 |
26 private: | 28 private: |
27 base::TickClock* const clock_; // Not owned by this class. | 29 base::TickClock* const clock_; // Not owned by this class. |
28 | 30 |
29 // Global metrics. | 31 // Global metrics. |
30 uint16_t min_sequence_number_; | 32 uint16_t min_sequence_number_; |
31 uint16_t max_sequence_number_; | 33 uint16_t max_sequence_number_; |
32 uint32_t total_number_packets_; | 34 uint32_t total_number_packets_; |
33 uint16_t sequence_number_cycles_; | 35 uint16_t sequence_number_cycles_; |
34 base::TimeDelta last_received_timestamp_; | 36 RtpTimeTicks last_received_rtp_timestamp_; |
35 base::TimeTicks last_received_packet_time_; | 37 base::TimeTicks last_received_packet_time_; |
36 base::TimeDelta jitter_; | 38 base::TimeDelta jitter_; |
37 | 39 |
38 // Intermediate metrics - between RTCP reports. | 40 // Intermediate metrics - between RTCP reports. |
39 int interval_min_sequence_number_; | 41 int interval_min_sequence_number_; |
40 int interval_number_packets_; | 42 int interval_number_packets_; |
41 int interval_wrap_count_; | 43 int interval_wrap_count_; |
42 | 44 |
43 DISALLOW_COPY_AND_ASSIGN(ReceiverStats); | 45 DISALLOW_COPY_AND_ASSIGN(ReceiverStats); |
44 }; | 46 }; |
45 | 47 |
46 } // namespace cast | 48 } // namespace cast |
47 } // namespace media | 49 } // namespace media |
48 | 50 |
49 #endif // MEDIA_CAST_NET_RTP_RECEIVER_STATS_H_ | 51 #endif // MEDIA_CAST_NET_RTP_RECEIVER_STATS_H_ |
OLD | NEW |