Add getter/setter for stream_labels on StreamParams
This allows clients to move to these new accessors and off of the
sync_label field which is deprecated.
Bug: webrtc:7932
Change-Id: I32b30087bf1be380d607a649bd90fa9617dafeb9
Reviewed-on: https://webrtc-review.googlesource.com/58020
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22213}
diff --git a/media/base/streamparams.cc b/media/base/streamparams.cc
index fd61a87..e59479d 100644
--- a/media/base/streamparams.cc
+++ b/media/base/streamparams.cc
@@ -13,6 +13,8 @@
#include <list>
#include <sstream>
+#include "rtc_base/checks.h"
+
namespace cricket {
namespace {
// NOTE: There is no check here for duplicate streams, so check before
@@ -197,6 +199,22 @@
return false;
}
+std::vector<std::string> StreamParams::stream_labels() const {
+ if (sync_label.empty()) {
+ return {};
+ }
+ return {sync_label};
+}
+
+void StreamParams::set_stream_labels(
+ const std::vector<std::string>& stream_labels) {
+ // TODO(steveanton): Support an arbitrary number of stream labels.
+ RTC_DCHECK_LE(stream_labels.size(), 1) << "set_stream_labels currently only "
+ "supports exactly 0 or 1 stream "
+ "label.";
+ sync_label = (stream_labels.empty() ? "" : stream_labels[0]);
+}
+
bool IsOneSsrcStream(const StreamParams& sp) {
if (sp.ssrcs.size() == 1 && sp.ssrc_groups.empty()) {
return true;
diff --git a/media/base/streamparams.h b/media/base/streamparams.h
index 1b2ebfa..9060515 100644
--- a/media/base/streamparams.h
+++ b/media/base/streamparams.h
@@ -146,6 +146,10 @@
void GetFidSsrcs(const std::vector<uint32_t>& primary_ssrcs,
std::vector<uint32_t>* fid_ssrcs) const;
+ // Stream labels serialized to SDP.
+ std::vector<std::string> stream_labels() const;
+ void set_stream_labels(const std::vector<std::string>& stream_labels);
+
std::string ToString() const;
// Resource of the MUC jid of the participant of with this stream.
@@ -161,6 +165,7 @@
// Friendly name describing stream
std::string display;
std::string cname; // RTCP CNAME
+ // TODO(steveanton): Move callers to |stream_labels()| and make private.
std::string sync_label; // Friendly name of cname.
private: