blob: a6d5f61c17d6f2d1cf1363f90662990b95683174 [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
kjellander1afca732016-02-07 20:46:45 -08002 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00003 *
kjellander1afca732016-02-07 20:46:45 -08004 * 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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00009 */
10
Steve Anton10542f22019-01-11 09:11:00 -080011#include "media/base/test_utils.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000012
Yves Gerey3e707812018-11-28 16:47:49 +010013#include <cstdint>
henrike@webrtc.org28e20752013-07-10 00:45:36 +000014
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020015#include "api/video/video_frame.h"
Yves Gerey3e707812018-11-28 16:47:49 +010016#include "api/video/video_source_interface.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000017
18namespace cricket {
19
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +000020cricket::StreamParams CreateSimStreamParams(
Peter Boström0c4e06b2015-10-07 12:23:21 +020021 const std::string& cname,
22 const std::vector<uint32_t>& ssrcs) {
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +000023 cricket::StreamParams sp;
24 cricket::SsrcGroup sg(cricket::kSimSsrcGroupSemantics, ssrcs);
25 sp.ssrcs = ssrcs;
26 sp.ssrc_groups.push_back(sg);
27 sp.cname = cname;
28 return sp;
29}
30
31// There should be an rtx_ssrc per ssrc.
32cricket::StreamParams CreateSimWithRtxStreamParams(
Peter Boström0c4e06b2015-10-07 12:23:21 +020033 const std::string& cname,
34 const std::vector<uint32_t>& ssrcs,
35 const std::vector<uint32_t>& rtx_ssrcs) {
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +000036 cricket::StreamParams sp = CreateSimStreamParams(cname, ssrcs);
37 for (size_t i = 0; i < ssrcs.size(); ++i) {
38 sp.ssrcs.push_back(rtx_ssrcs[i]);
Peter Boström0c4e06b2015-10-07 12:23:21 +020039 std::vector<uint32_t> fid_ssrcs;
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +000040 fid_ssrcs.push_back(ssrcs[i]);
41 fid_ssrcs.push_back(rtx_ssrcs[i]);
42 cricket::SsrcGroup fid_group(cricket::kFidSsrcGroupSemantics, fid_ssrcs);
43 sp.ssrc_groups.push_back(fid_group);
44 }
45 return sp;
46}
47
brandtr9688e382016-11-22 00:59:48 -080048cricket::StreamParams CreatePrimaryWithFecFrStreamParams(
49 const std::string& cname,
50 uint32_t primary_ssrc,
51 uint32_t flexfec_ssrc) {
52 cricket::StreamParams sp;
53 cricket::SsrcGroup sg(cricket::kFecFrSsrcGroupSemantics,
54 {primary_ssrc, flexfec_ssrc});
55 sp.ssrcs = {primary_ssrc};
56 sp.ssrc_groups.push_back(sg);
57 sp.cname = cname;
58 return sp;
59}
60
henrike@webrtc.org28e20752013-07-10 00:45:36 +000061} // namespace cricket