From ac7539e2d1868dd68c184682e75c0f190b8ea876 Mon Sep 17 00:00:00 2001 From: Steve Anton Date: Mon, 26 Feb 2018 17:20:29 -0800 Subject: [PATCH] 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 Commit-Queue: Steve Anton Cr-Commit-Position: refs/heads/master@{#22213} --- media/base/streamparams.cc | 18 ++++++++++++++++++ media/base/streamparams.h | 5 +++++ 2 files changed, 23 insertions(+) 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: