1 /* 2 * Copyright 2018 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 "pc/simulcast_description.h" 12 13 #include "rtc_base/checks.h" 14 15 namespace cricket { 16 SimulcastLayer(absl::string_view rid,bool is_paused)17SimulcastLayer::SimulcastLayer(absl::string_view rid, bool is_paused) 18 : rid{rid}, is_paused{is_paused} { 19 RTC_DCHECK(!rid.empty()); 20 } 21 operator ==(const SimulcastLayer & other) const22bool SimulcastLayer::operator==(const SimulcastLayer& other) const { 23 return rid == other.rid && is_paused == other.is_paused; 24 } 25 AddLayer(const SimulcastLayer & layer)26void SimulcastLayerList::AddLayer(const SimulcastLayer& layer) { 27 list_.push_back({layer}); 28 } 29 AddLayerWithAlternatives(const std::vector<SimulcastLayer> & rids)30void SimulcastLayerList::AddLayerWithAlternatives( 31 const std::vector<SimulcastLayer>& rids) { 32 RTC_DCHECK(!rids.empty()); 33 list_.push_back(rids); 34 } 35 operator [](size_t index) const36const std::vector<SimulcastLayer>& SimulcastLayerList::operator[]( 37 size_t index) const { 38 RTC_DCHECK_LT(index, list_.size()); 39 return list_[index]; 40 } 41 empty() const42bool SimulcastDescription::empty() const { 43 return send_layers_.empty() && receive_layers_.empty(); 44 } 45 GetAllLayers() const46std::vector<SimulcastLayer> SimulcastLayerList::GetAllLayers() const { 47 std::vector<SimulcastLayer> result; 48 for (auto groupIt = begin(); groupIt != end(); groupIt++) { 49 for (auto it = groupIt->begin(); it != groupIt->end(); it++) { 50 result.push_back(*it); 51 } 52 } 53 54 return result; 55 } 56 57 } // namespace cricket 58