| 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 |
| 11 | #ifndef MEDIA_BASE_TEST_UTILS_H_ |
| 12 | #define MEDIA_BASE_TEST_UTILS_H_ |
| 13 |
| 14 | #include <string> |
| 15 | #include <vector> |
| 16 |
| 17 | #include "media/base/media_channel.h" |
| 18 | #include "media/base/video_common.h" |
| 19 | #include "rtc_base/arraysize.h" |
| 20 |
| 21 | namespace webrtc { |
| 22 | class VideoFrame; |
| 23 | } |
| 24 |
| 25 | namespace cricket { |
| 26 |
| 27 | // Returns size of 420 image with rounding on chroma for odd sizes. |
| 28 | #define I420_SIZE(w, h) (w * h + (((w + 1) / 2) * ((h + 1) / 2)) * 2) |
| 29 | // Returns size of ARGB image. |
| 30 | #define ARGB_SIZE(w, h) (w * h * 4) |
| 31 |
| 32 | template <class T> |
| 33 | inline std::vector<T> MakeVector(const T a[], size_t s) { |
| 34 | return std::vector<T>(a, a + s); |
| 35 | } |
| 36 | #define MAKE_VECTOR(a) cricket::MakeVector(a, arraysize(a)) |
| 37 |
| 38 | // Create Simulcast StreamParams with given `ssrcs` and `cname`. |
| 39 | cricket::StreamParams CreateSimStreamParams(const std::string& cname, |
| 40 | const std::vector<uint32_t>& ssrcs); |
| 41 | // Create Simulcast stream with given `ssrcs` and `rtx_ssrcs`. |
| 42 | // The number of `rtx_ssrcs` must match number of `ssrcs`. |
| 43 | cricket::StreamParams CreateSimWithRtxStreamParams( |
| 44 | const std::string& cname, |
| 45 | const std::vector<uint32_t>& ssrcs, |
| 46 | const std::vector<uint32_t>& rtx_ssrcs); |
| 47 |
| 48 | // Create StreamParams with single primary SSRC and corresponding FlexFEC SSRC. |
| 49 | cricket::StreamParams CreatePrimaryWithFecFrStreamParams( |
| 50 | const std::string& cname, |
| 51 | uint32_t primary_ssrc, |
| 52 | uint32_t flexfec_ssrc); |
| 53 |
| 54 | } // namespace cricket |
| 55 |
| 56 | #endif // MEDIA_BASE_TEST_UTILS_H_ |
| 57 |