You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.8 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved.
  3. *
  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
  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.
  9. */
  10. #include "media/base/test_utils.h"
  11. #include <cstdint>
  12. #include "api/video/video_frame.h"
  13. #include "api/video/video_source_interface.h"
  14. namespace cricket {
  15. cricket::StreamParams CreateSimStreamParams(
  16. const std::string& cname,
  17. const std::vector<uint32_t>& ssrcs) {
  18. cricket::StreamParams sp;
  19. cricket::SsrcGroup sg(cricket::kSimSsrcGroupSemantics, ssrcs);
  20. sp.ssrcs = ssrcs;
  21. sp.ssrc_groups.push_back(sg);
  22. sp.cname = cname;
  23. return sp;
  24. }
  25. // There should be an rtx_ssrc per ssrc.
  26. cricket::StreamParams CreateSimWithRtxStreamParams(
  27. const std::string& cname,
  28. const std::vector<uint32_t>& ssrcs,
  29. const std::vector<uint32_t>& rtx_ssrcs) {
  30. cricket::StreamParams sp = CreateSimStreamParams(cname, ssrcs);
  31. for (size_t i = 0; i < ssrcs.size(); ++i) {
  32. sp.ssrcs.push_back(rtx_ssrcs[i]);
  33. std::vector<uint32_t> fid_ssrcs;
  34. fid_ssrcs.push_back(ssrcs[i]);
  35. fid_ssrcs.push_back(rtx_ssrcs[i]);
  36. cricket::SsrcGroup fid_group(cricket::kFidSsrcGroupSemantics, fid_ssrcs);
  37. sp.ssrc_groups.push_back(fid_group);
  38. }
  39. return sp;
  40. }
  41. cricket::StreamParams CreatePrimaryWithFecFrStreamParams(
  42. const std::string& cname,
  43. uint32_t primary_ssrc,
  44. uint32_t flexfec_ssrc) {
  45. cricket::StreamParams sp;
  46. cricket::SsrcGroup sg(cricket::kFecFrSsrcGroupSemantics,
  47. {primary_ssrc, flexfec_ssrc});
  48. sp.ssrcs = {primary_ssrc};
  49. sp.ssrc_groups.push_back(sg);
  50. sp.cname = cname;
  51. return sp;
  52. }
  53. } // namespace cricket