Per Kjellander | 0a69daf | 2024-11-25 19:57:13 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2024 The WebRTC Project Authors. All rights reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | #include "api/test/network_emulation/ecn_marking_counter.h" |
| 11 | |
| 12 | namespace webrtc { |
| 13 | |
| 14 | void EcnMarkingCounter::Add(EcnMarking ecn) { |
| 15 | switch (ecn) { |
| 16 | case EcnMarking::kNotEct: |
| 17 | ++not_ect_; |
| 18 | break; |
| 19 | case EcnMarking::kEct0: |
| 20 | ++ect_0_; |
| 21 | break; |
| 22 | case EcnMarking::kEct1: |
| 23 | ++ect_1_; |
| 24 | break; |
| 25 | case EcnMarking::kCe: |
| 26 | ++ce_; |
| 27 | break; |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | EcnMarkingCounter& EcnMarkingCounter::operator+=( |
| 32 | const EcnMarkingCounter& counter) { |
| 33 | not_ect_ += counter.not_ect(); |
| 34 | ect_0_ += counter.ect_0(); |
| 35 | ect_1_ += counter.ect_1(); |
| 36 | ce_ += counter.ce(); |
| 37 | return *this; |
| 38 | } |
| 39 | |
| 40 | } // namespace webrtc |