OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 ost << "cname:" << cname << ";"; | 140 ost << "cname:" << cname << ";"; |
141 } | 141 } |
142 if (!sync_label.empty()) { | 142 if (!sync_label.empty()) { |
143 ost << "sync_label:" << sync_label; | 143 ost << "sync_label:" << sync_label; |
144 } | 144 } |
145 ost << "}"; | 145 ost << "}"; |
146 return ost.str(); | 146 return ost.str(); |
147 } | 147 } |
148 void StreamParams::GetPrimarySsrcs(std::vector<uint32_t>* ssrcs) const { | 148 void StreamParams::GetPrimarySsrcs(std::vector<uint32_t>* ssrcs) const { |
149 const SsrcGroup* sim_group = get_ssrc_group(kSimSsrcGroupSemantics); | 149 const SsrcGroup* sim_group = get_ssrc_group(kSimSsrcGroupSemantics); |
150 if (sim_group == NULL) { | 150 if (sim_group == nullptr) { |
151 ssrcs->push_back(first_ssrc()); | 151 ssrcs->push_back(first_ssrc()); |
152 } else { | 152 } else { |
153 for (size_t i = 0; i < sim_group->ssrcs.size(); ++i) { | 153 for (size_t i = 0; i < sim_group->ssrcs.size(); ++i) { |
154 ssrcs->push_back(sim_group->ssrcs[i]); | 154 ssrcs->push_back(sim_group->ssrcs[i]); |
155 } | 155 } |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 void StreamParams::GetFidSsrcs(const std::vector<uint32_t>& primary_ssrcs, | 159 void StreamParams::GetFidSsrcs(const std::vector<uint32_t>& primary_ssrcs, |
160 std::vector<uint32_t>* fid_ssrcs) const { | 160 std::vector<uint32_t>* fid_ssrcs) const { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 static void RemoveFirst(std::list<uint32_t>* ssrcs, uint32_t value) { | 236 static void RemoveFirst(std::list<uint32_t>* ssrcs, uint32_t value) { |
237 std::list<uint32_t>::iterator it = | 237 std::list<uint32_t>::iterator it = |
238 std::find(ssrcs->begin(), ssrcs->end(), value); | 238 std::find(ssrcs->begin(), ssrcs->end(), value); |
239 if (it != ssrcs->end()) { | 239 if (it != ssrcs->end()) { |
240 ssrcs->erase(it); | 240 ssrcs->erase(it); |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
244 bool IsSimulcastStream(const StreamParams& sp) { | 244 bool IsSimulcastStream(const StreamParams& sp) { |
245 const SsrcGroup* const sg = sp.get_ssrc_group(kSimSsrcGroupSemantics); | 245 const SsrcGroup* const sg = sp.get_ssrc_group(kSimSsrcGroupSemantics); |
246 if (sg == NULL || sg->ssrcs.size() < 2) { | 246 if (sg == nullptr || sg->ssrcs.size() < 2) { |
247 return false; | 247 return false; |
248 } | 248 } |
249 // Start with all StreamParams SSRCs. Remove simulcast SSRCs (from sg) and | 249 // Start with all StreamParams SSRCs. Remove simulcast SSRCs (from sg) and |
250 // RTX SSRCs. If we still have SSRCs left, we don't know what they're for. | 250 // RTX SSRCs. If we still have SSRCs left, we don't know what they're for. |
251 // Also we remove first-found SSRCs only. So duplicates should lead to errors. | 251 // Also we remove first-found SSRCs only. So duplicates should lead to errors. |
252 std::list<uint32_t> sp_ssrcs(sp.ssrcs.begin(), sp.ssrcs.end()); | 252 std::list<uint32_t> sp_ssrcs(sp.ssrcs.begin(), sp.ssrcs.end()); |
253 for (size_t i = 0; i < sg->ssrcs.size(); ++i) { | 253 for (size_t i = 0; i < sg->ssrcs.size(); ++i) { |
254 RemoveFirst(&sp_ssrcs, sg->ssrcs[i]); | 254 RemoveFirst(&sp_ssrcs, sg->ssrcs[i]); |
255 } | 255 } |
256 for (size_t i = 0; i < sp.ssrc_groups.size(); ++i) { | 256 for (size_t i = 0; i < sp.ssrc_groups.size(); ++i) { |
257 const SsrcGroup& group = sp.ssrc_groups[i]; | 257 const SsrcGroup& group = sp.ssrc_groups[i]; |
258 if (group.semantics.compare(kFidSsrcGroupSemantics) != 0 || | 258 if (group.semantics.compare(kFidSsrcGroupSemantics) != 0 || |
259 group.ssrcs.size() != 2) { | 259 group.ssrcs.size() != 2) { |
260 continue; | 260 continue; |
261 } | 261 } |
262 RemoveFirst(&sp_ssrcs, group.ssrcs[1]); | 262 RemoveFirst(&sp_ssrcs, group.ssrcs[1]); |
263 } | 263 } |
264 // If there's SSRCs left that we don't know how to handle, we bail out. | 264 // If there's SSRCs left that we don't know how to handle, we bail out. |
265 return sp_ssrcs.size() == 0; | 265 return sp_ssrcs.size() == 0; |
266 } | 266 } |
267 | 267 |
268 } // namespace cricket | 268 } // namespace cricket |
OLD | NEW |