video_adaptation_counters.cc (1339B)
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 <string> 14 15 #include "rtc_base/strings/string_builder.h" 16 17 namespace webrtc { 18 19 bool VideoAdaptationCounters::operator==( 20 const VideoAdaptationCounters& rhs) const { 21 return fps_adaptations == rhs.fps_adaptations && 22 resolution_adaptations == rhs.resolution_adaptations; 23 } 24 25 bool VideoAdaptationCounters::operator!=( 26 const VideoAdaptationCounters& rhs) const { 27 return !(rhs == *this); 28 } 29 30 VideoAdaptationCounters VideoAdaptationCounters::operator+( 31 const VideoAdaptationCounters& other) const { 32 return VideoAdaptationCounters( 33 resolution_adaptations + other.resolution_adaptations, 34 fps_adaptations + other.fps_adaptations); 35 } 36 37 std::string VideoAdaptationCounters::ToString() const { 38 StringBuilder ss; 39 ss << "{ res=" << resolution_adaptations << " fps=" << fps_adaptations 40 << " }"; 41 return ss.Release(); 42 } 43 44 } // namespace webrtc