blob: 8fff520fa08f16cf06da3cd101f63525720d1b6f [file] [log] [blame]
Amit Hilbucha2012042018-12-03 11:35:05 -08001/*
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 <utility>
12
13#include "pc/simulcastdescription.h"
14#include "rtc_base/checks.h"
15
16namespace cricket {
17
18SimulcastLayer::SimulcastLayer(const std::string& rid, bool is_paused)
19 : rid{rid}, is_paused{is_paused} {
Amit Hilbucha2012042018-12-03 11:35:05 -080020 RTC_DCHECK(!rid.empty());
21}
22
23void SimulcastLayerList::AddLayer(const SimulcastLayer& layer) {
24 list_.push_back({layer});
25}
26
27void SimulcastLayerList::AddLayerWithAlternatives(
28 const std::vector<SimulcastLayer>& rids) {
29 RTC_DCHECK(!rids.empty());
30 list_.push_back(rids);
31}
32
33const std::vector<SimulcastLayer>& SimulcastLayerList::operator[](
34 size_t index) const {
35 RTC_DCHECK_LT(index, list_.size());
36 return list_[index];
37}
38
39bool SimulcastDescription::empty() const {
40 return send_layers_.empty() && receive_layers_.empty();
41}
42
Amit Hilbuchc57d5732018-12-11 15:30:11 -080043std::vector<SimulcastLayer> SimulcastLayerList::GetAllLayers() const {
44 std::vector<SimulcastLayer> result;
45 for (auto groupIt = begin(); groupIt != end(); groupIt++) {
46 for (auto it = groupIt->begin(); it != groupIt->end(); it++) {
47 result.push_back(*it);
48 }
49 }
50
51 return result;
52}
53
Amit Hilbucha2012042018-12-03 11:35:05 -080054} // namespace cricket