• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <utility>
14 
15 #include "rtc_base/checks.h"
16 
17 namespace cricket {
18 
SimulcastLayer(const std::string & rid,bool is_paused)19 SimulcastLayer::SimulcastLayer(const std::string& rid, bool is_paused)
20     : rid{rid}, is_paused{is_paused} {
21   RTC_DCHECK(!rid.empty());
22 }
23 
operator ==(const SimulcastLayer & other) const24 bool SimulcastLayer::operator==(const SimulcastLayer& other) const {
25   return rid == other.rid && is_paused == other.is_paused;
26 }
27 
AddLayer(const SimulcastLayer & layer)28 void SimulcastLayerList::AddLayer(const SimulcastLayer& layer) {
29   list_.push_back({layer});
30 }
31 
AddLayerWithAlternatives(const std::vector<SimulcastLayer> & rids)32 void SimulcastLayerList::AddLayerWithAlternatives(
33     const std::vector<SimulcastLayer>& rids) {
34   RTC_DCHECK(!rids.empty());
35   list_.push_back(rids);
36 }
37 
operator [](size_t index) const38 const std::vector<SimulcastLayer>& SimulcastLayerList::operator[](
39     size_t index) const {
40   RTC_DCHECK_LT(index, list_.size());
41   return list_[index];
42 }
43 
empty() const44 bool SimulcastDescription::empty() const {
45   return send_layers_.empty() && receive_layers_.empty();
46 }
47 
GetAllLayers() const48 std::vector<SimulcastLayer> SimulcastLayerList::GetAllLayers() const {
49   std::vector<SimulcastLayer> result;
50   for (auto groupIt = begin(); groupIt != end(); groupIt++) {
51     for (auto it = groupIt->begin(); it != groupIt->end(); it++) {
52       result.push_back(*it);
53     }
54   }
55 
56   return result;
57 }
58 
59 }  // namespace cricket
60