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 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 nack_requests += other.nack_requests; | 204 nack_requests += other.nack_requests; |
205 unique_nack_requests += other.unique_nack_requests; | 205 unique_nack_requests += other.unique_nack_requests; |
206 if (other.first_packet_time_ms != -1 && | 206 if (other.first_packet_time_ms != -1 && |
207 (other.first_packet_time_ms < first_packet_time_ms || | 207 (other.first_packet_time_ms < first_packet_time_ms || |
208 first_packet_time_ms == -1)) { | 208 first_packet_time_ms == -1)) { |
209 // Use oldest time. | 209 // Use oldest time. |
210 first_packet_time_ms = other.first_packet_time_ms; | 210 first_packet_time_ms = other.first_packet_time_ms; |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
| 214 RtcpPacketTypeCounter Subtract(const RtcpPacketTypeCounter& other) const { |
| 215 RtcpPacketTypeCounter diff = other; |
| 216 diff.nack_packets -= nack_packets; |
| 217 diff.fir_packets -= fir_packets; |
| 218 diff.pli_packets -= pli_packets; |
| 219 diff.nack_requests -= nack_requests; |
| 220 diff.unique_nack_requests -= unique_nack_requests; |
| 221 if (diff.first_packet_time_ms != -1 && |
| 222 diff.first_packet_time_ms < first_packet_time_ms) { |
| 223 // Use youngest time. |
| 224 diff.first_packet_time_ms = first_packet_time_ms; |
| 225 } |
| 226 return diff; |
| 227 } |
| 228 |
214 int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const { | 229 int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const { |
215 return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms); | 230 return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms); |
216 } | 231 } |
217 | 232 |
218 int UniqueNackRequestsInPercent() const { | 233 int UniqueNackRequestsInPercent() const { |
219 if (nack_requests == 0) { | 234 if (nack_requests == 0) { |
220 return 0; | 235 return 0; |
221 } | 236 } |
222 return static_cast<int>( | 237 return static_cast<int>( |
223 (unique_nack_requests * 100.0f / nack_requests) + 0.5f); | 238 (unique_nack_requests * 100.0f / nack_requests) + 0.5f); |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 uint32_t ssrc) = 0; | 853 uint32_t ssrc) = 0; |
839 }; | 854 }; |
840 | 855 |
841 // RTCP mode to use. Compound mode is described by RFC 4585 and reduced-size | 856 // RTCP mode to use. Compound mode is described by RFC 4585 and reduced-size |
842 // RTCP mode is described by RFC 5506. | 857 // RTCP mode is described by RFC 5506. |
843 enum class RtcpMode { kOff, kCompound, kReducedSize }; | 858 enum class RtcpMode { kOff, kCompound, kReducedSize }; |
844 | 859 |
845 } // namespace webrtc | 860 } // namespace webrtc |
846 | 861 |
847 #endif // WEBRTC_COMMON_TYPES_H_ | 862 #endif // WEBRTC_COMMON_TYPES_H_ |
OLD | NEW |