Adding SDP parsing for Simulcast.
Parsing simulcast according to:
https://tools.ietf.org/html/draft-ietf-mmusic-sdp-simulcast-13#section-5.1
Created SdpSerializer for making serialized components more testable.
Simulcast functionality is still not accessible to users.
Bug: webrtc:10055
Change-Id: Ia6e4cef756cb954521dd19e22911f8eb6498880e
Reviewed-on: https://webrtc-review.googlesource.com/c/112160
Commit-Queue: Amit Hilbuch <amithi@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25883}
diff --git a/pc/simulcastdescription.cc b/pc/simulcastdescription.cc
new file mode 100644
index 0000000..eca67a7
--- /dev/null
+++ b/pc/simulcastdescription.cc
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2018 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include <utility>
+
+#include "pc/simulcastdescription.h"
+#include "rtc_base/checks.h"
+
+namespace cricket {
+
+SimulcastLayer::SimulcastLayer(const std::string& rid, bool is_paused)
+ : rid{rid}, is_paused{is_paused} {
+ // TODO(amithi, bugs.webrtc.org/10073): Validate rid format.
+ RTC_DCHECK(!rid.empty());
+}
+
+void SimulcastLayerList::AddLayer(const SimulcastLayer& layer) {
+ list_.push_back({layer});
+}
+
+void SimulcastLayerList::AddLayerWithAlternatives(
+ const std::vector<SimulcastLayer>& rids) {
+ RTC_DCHECK(!rids.empty());
+ list_.push_back(rids);
+}
+
+const std::vector<SimulcastLayer>& SimulcastLayerList::operator[](
+ size_t index) const {
+ RTC_DCHECK_LT(index, list_.size());
+ return list_[index];
+}
+
+bool SimulcastDescription::empty() const {
+ return send_layers_.empty() && receive_layers_.empty();
+}
+
+} // namespace cricket