1 /*
2  *  Copyright 2020 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 
11 #include "api/video/video_adaptation_counters.h"
12 
13 #include "rtc_base/strings/string_builder.h"
14 
15 namespace webrtc {
16 
operator ==(const VideoAdaptationCounters & rhs) const17 bool VideoAdaptationCounters::operator==(
18     const VideoAdaptationCounters& rhs) const {
19   return fps_adaptations == rhs.fps_adaptations &&
20          resolution_adaptations == rhs.resolution_adaptations;
21 }
22 
operator !=(const VideoAdaptationCounters & rhs) const23 bool VideoAdaptationCounters::operator!=(
24     const VideoAdaptationCounters& rhs) const {
25   return !(rhs == *this);
26 }
27 
operator +(const VideoAdaptationCounters & other) const28 VideoAdaptationCounters VideoAdaptationCounters::operator+(
29     const VideoAdaptationCounters& other) const {
30   return VideoAdaptationCounters(
31       resolution_adaptations + other.resolution_adaptations,
32       fps_adaptations + other.fps_adaptations);
33 }
34 
ToString() const35 std::string VideoAdaptationCounters::ToString() const {
36   rtc::StringBuilder ss;
37   ss << "{ res=" << resolution_adaptations << " fps=" << fps_adaptations
38      << " }";
39   return ss.Release();
40 }
41 
42 }  // namespace webrtc
43