blob: eca67a7855b334440f70a0c15f59142c0a3cd2ea [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} {
20 // TODO(amithi, bugs.webrtc.org/10073): Validate rid format.
21 RTC_DCHECK(!rid.empty());
22}
23
24void SimulcastLayerList::AddLayer(const SimulcastLayer& layer) {
25 list_.push_back({layer});
26}
27
28void SimulcastLayerList::AddLayerWithAlternatives(
29 const std::vector<SimulcastLayer>& rids) {
30 RTC_DCHECK(!rids.empty());
31 list_.push_back(rids);
32}
33
34const std::vector<SimulcastLayer>& SimulcastLayerList::operator[](
35 size_t index) const {
36 RTC_DCHECK_LT(index, list_.size());
37 return list_[index];
38}
39
40bool SimulcastDescription::empty() const {
41 return send_layers_.empty() && receive_layers_.empty();
42}
43
44} // namespace cricket