You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.6 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. #include "pc/simulcast_description.h"
  11. #include <utility>
  12. #include "rtc_base/checks.h"
  13. namespace cricket {
  14. SimulcastLayer::SimulcastLayer(const std::string& rid, bool is_paused)
  15. : rid{rid}, is_paused{is_paused} {
  16. RTC_DCHECK(!rid.empty());
  17. }
  18. bool SimulcastLayer::operator==(const SimulcastLayer& other) const {
  19. return rid == other.rid && is_paused == other.is_paused;
  20. }
  21. void SimulcastLayerList::AddLayer(const SimulcastLayer& layer) {
  22. list_.push_back({layer});
  23. }
  24. void SimulcastLayerList::AddLayerWithAlternatives(
  25. const std::vector<SimulcastLayer>& rids) {
  26. RTC_DCHECK(!rids.empty());
  27. list_.push_back(rids);
  28. }
  29. const std::vector<SimulcastLayer>& SimulcastLayerList::operator[](
  30. size_t index) const {
  31. RTC_DCHECK_LT(index, list_.size());
  32. return list_[index];
  33. }
  34. bool SimulcastDescription::empty() const {
  35. return send_layers_.empty() && receive_layers_.empty();
  36. }
  37. std::vector<SimulcastLayer> SimulcastLayerList::GetAllLayers() const {
  38. std::vector<SimulcastLayer> result;
  39. for (auto groupIt = begin(); groupIt != end(); groupIt++) {
  40. for (auto it = groupIt->begin(); it != groupIt->end(); it++) {
  41. result.push_back(*it);
  42. }
  43. }
  44. return result;
  45. }
  46. } // namespace cricket