| 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 |
| 17 | SimulcastLayer::SimulcastLayer(absl::string_view rid, bool is_paused) |
| 18 | : rid{rid}, is_paused{is_paused} { |
| 19 | RTC_DCHECK(!rid.empty()); |
| 20 | } |
| 21 |
| 22 | bool SimulcastLayer::operator==(const SimulcastLayer& other) const { |
| 23 | return rid == other.rid && is_paused == other.is_paused; |
| 24 | } |
| 25 |
| 26 | void SimulcastLayerList::AddLayer(const SimulcastLayer& layer) { |
| 27 | list_.push_back({layer}); |
| 28 | } |
| 29 |
| 30 | void SimulcastLayerList::AddLayerWithAlternatives( |
| 31 | const std::vector<SimulcastLayer>& rids) { |
| 32 | RTC_DCHECK(!rids.empty()); |
| 33 | list_.push_back(rids); |
| 34 | } |
| 35 |
| 36 | const std::vector<SimulcastLayer>& SimulcastLayerList::operator[]( |
| 37 | size_t index) const { |
| 38 | RTC_DCHECK_LT(index, list_.size()); |
| 39 | return list_[index]; |
| 40 | } |
| 41 |
| 42 | bool SimulcastDescription::empty() const { |
| 43 | return send_layers_.empty() && receive_layers_.empty(); |
| 44 | } |
| 45 |
| 46 | std::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 |