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}
This commit is contained in:
Steve Anton 2018-02-26 17:20:29 -08:00 committed by Commit Bot
parent 6bcd7f6618
commit ac7539e2d1
2 changed files with 23 additions and 0 deletions

View File

@ -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 @@ bool StreamParams::GetSecondarySsrc(const std::string& semantics,
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;

View File

@ -146,6 +146,10 @@ struct StreamParams {
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 @@ 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: