diff --git a/media/base/streamparams.cc b/media/base/streamparams.cc index fd61a87ffd..e59479d894 100644 --- a/media/base/streamparams.cc +++ b/media/base/streamparams.cc @@ -13,6 +13,8 @@ #include #include +#include "rtc_base/checks.h" + namespace cricket { namespace { // NOTE: There is no check here for duplicate streams, so check before @@ -197,6 +199,22 @@ bool StreamParams::GetSecondarySsrc(const std::string& semantics, return false; } +std::vector StreamParams::stream_labels() const { + if (sync_label.empty()) { + return {}; + } + return {sync_label}; +} + +void StreamParams::set_stream_labels( + const std::vector& 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 1b2ebfa871..9060515f67 100644 --- a/media/base/streamparams.h +++ b/media/base/streamparams.h @@ -146,6 +146,10 @@ struct StreamParams { void GetFidSsrcs(const std::vector& primary_ssrcs, std::vector* fid_ssrcs) const; + // Stream labels serialized to SDP. + std::vector stream_labels() const; + void set_stream_labels(const std::vector& stream_labels); + std::string ToString() const; // Resource of the MUC jid of the participant of with this stream. @@ -161,6 +165,7 @@ struct StreamParams { // 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: