| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 #include "webrtc/voice_engine/transport_feedback_packet_loss_tracker.h" | 11 #include "webrtc/voice_engine/transport_feedback_packet_loss_tracker.h" |
| 12 | 12 |
| 13 #include <limits> | 13 #include <limits> |
| 14 #include <utility> | 14 #include <utility> |
| 15 | 15 |
| 16 #include "webrtc/base/checks.h" | |
| 17 #include "webrtc/base/mod_ops.h" | |
| 18 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 16 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" | 17 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" |
| 18 #include "webrtc/rtc_base/checks.h" |
| 19 #include "webrtc/rtc_base/mod_ops.h" |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 constexpr uint16_t kSeqNumHalf = 0x8000u; | 22 constexpr uint16_t kSeqNumHalf = 0x8000u; |
| 23 void UpdateCounter(size_t* counter, bool increment) { | 23 void UpdateCounter(size_t* counter, bool increment) { |
| 24 if (increment) { | 24 if (increment) { |
| 25 RTC_DCHECK_LT(*counter, std::numeric_limits<std::size_t>::max()); | 25 RTC_DCHECK_LT(*counter, std::numeric_limits<std::size_t>::max()); |
| 26 ++(*counter); | 26 ++(*counter); |
| 27 } else { | 27 } else { |
| 28 RTC_DCHECK_GT(*counter, 0); | 28 RTC_DCHECK_GT(*counter, 0); |
| 29 --(*counter); | 29 --(*counter); |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 TransportFeedbackPacketLossTracker::RplrState::GetMetric() const { | 359 TransportFeedbackPacketLossTracker::RplrState::GetMetric() const { |
| 360 if (num_acked_pairs_ < min_num_acked_pairs_) { | 360 if (num_acked_pairs_ < min_num_acked_pairs_) { |
| 361 return rtc::Optional<float>(); | 361 return rtc::Optional<float>(); |
| 362 } else { | 362 } else { |
| 363 return rtc::Optional<float>( | 363 return rtc::Optional<float>( |
| 364 static_cast<float>(num_recoverable_losses_) / num_acked_pairs_); | 364 static_cast<float>(num_recoverable_losses_) / num_acked_pairs_); |
| 365 } | 365 } |
| 366 } | 366 } |
| 367 | 367 |
| 368 } // namespace webrtc | 368 } // namespace webrtc |
| OLD | NEW |