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 |
(...skipping 22 matching lines...) Expand all Loading... |
33 // This function returns true if a delta was computed, or false if the current | 33 // This function returns true if a delta was computed, or false if the current |
34 // group is still incomplete or if only one group has been completed. | 34 // group is still incomplete or if only one group has been completed. |
35 // |timestamp| is the timestamp. | 35 // |timestamp| is the timestamp. |
36 // |arrival_time_ms| is the local time at which the packet arrived. | 36 // |arrival_time_ms| is the local time at which the packet arrived. |
37 // |packet_size| is the size of the packet. | 37 // |packet_size| is the size of the packet. |
38 // |timestamp_delta| (output) is the computed timestamp delta. | 38 // |timestamp_delta| (output) is the computed timestamp delta. |
39 // |arrival_time_delta_ms| (output) is the computed arrival-time delta. | 39 // |arrival_time_delta_ms| (output) is the computed arrival-time delta. |
40 // |packet_size_delta| (output) is the computed size delta. | 40 // |packet_size_delta| (output) is the computed size delta. |
41 bool ComputeDeltas(uint32_t timestamp, | 41 bool ComputeDeltas(uint32_t timestamp, |
42 int64_t arrival_time_ms, | 42 int64_t arrival_time_ms, |
| 43 int64_t system_time_ms, |
43 size_t packet_size, | 44 size_t packet_size, |
44 uint32_t* timestamp_delta, | 45 uint32_t* timestamp_delta, |
45 int64_t* arrival_time_delta_ms, | 46 int64_t* arrival_time_delta_ms, |
46 int* packet_size_delta); | 47 int* packet_size_delta); |
47 | 48 |
48 private: | 49 private: |
49 struct TimestampGroup { | 50 struct TimestampGroup { |
50 TimestampGroup() | 51 TimestampGroup() |
51 : size(0), | 52 : size(0), |
52 first_timestamp(0), | 53 first_timestamp(0), |
53 timestamp(0), | 54 timestamp(0), |
54 complete_time_ms(-1) {} | 55 complete_time_ms(-1) {} |
55 | 56 |
56 bool IsFirstPacket() const { | 57 bool IsFirstPacket() const { |
57 return complete_time_ms == -1; | 58 return complete_time_ms == -1; |
58 } | 59 } |
59 | 60 |
60 size_t size; | 61 size_t size; |
61 uint32_t first_timestamp; | 62 uint32_t first_timestamp; |
62 uint32_t timestamp; | 63 uint32_t timestamp; |
63 int64_t complete_time_ms; | 64 int64_t complete_time_ms; |
| 65 int64_t last_system_time_ms; |
64 }; | 66 }; |
65 | 67 |
66 // Returns true if the packet with timestamp |timestamp| arrived in order. | 68 // Returns true if the packet with timestamp |timestamp| arrived in order. |
67 bool PacketInOrder(uint32_t timestamp); | 69 bool PacketInOrder(uint32_t timestamp); |
68 | 70 |
69 // Returns true if the last packet was the end of the current batch and the | 71 // Returns true if the last packet was the end of the current batch and the |
70 // packet with |timestamp| is the first of a new batch. | 72 // packet with |timestamp| is the first of a new batch. |
71 bool NewTimestampGroup(int64_t arrival_time_ms, uint32_t timestamp) const; | 73 bool NewTimestampGroup(int64_t arrival_time_ms, uint32_t timestamp) const; |
72 | 74 |
73 bool BelongsToBurst(int64_t arrival_time_ms, uint32_t timestamp) const; | 75 bool BelongsToBurst(int64_t arrival_time_ms, uint32_t timestamp) const; |
74 | 76 |
| 77 void Reset(); |
| 78 |
75 const uint32_t kTimestampGroupLengthTicks; | 79 const uint32_t kTimestampGroupLengthTicks; |
76 TimestampGroup current_timestamp_group_; | 80 TimestampGroup current_timestamp_group_; |
77 TimestampGroup prev_timestamp_group_; | 81 TimestampGroup prev_timestamp_group_; |
78 double timestamp_to_ms_coeff_; | 82 double timestamp_to_ms_coeff_; |
79 bool burst_grouping_; | 83 bool burst_grouping_; |
| 84 int num_consecutive_reordered_packets_; |
80 | 85 |
81 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(InterArrival); | 86 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(InterArrival); |
82 }; | 87 }; |
83 } // namespace webrtc | 88 } // namespace webrtc |
84 | 89 |
85 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INTER_ARRIVAL_H_ | 90 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INTER_ARRIVAL_H_ |
OLD | NEW |