OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 |
11 #ifndef WEBRTC_MEDIA_BASE_TESTUTILS_H_ | 11 #ifndef WEBRTC_MEDIA_BASE_TESTUTILS_H_ |
12 #define WEBRTC_MEDIA_BASE_TESTUTILS_H_ | 12 #define WEBRTC_MEDIA_BASE_TESTUTILS_H_ |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "libyuv/compare.h" | 17 #include "libyuv/compare.h" |
18 #include "webrtc/base/arraysize.h" | 18 #include "webrtc/base/arraysize.h" |
19 #include "webrtc/base/basictypes.h" | 19 #include "webrtc/base/basictypes.h" |
20 #include "webrtc/base/sigslot.h" | 20 #include "webrtc/base/sigslot.h" |
21 #include "webrtc/base/window.h" | 21 #include "webrtc/base/window.h" |
22 #include "webrtc/media/base/mediachannel.h" | 22 #include "webrtc/media/base/mediachannel.h" |
23 #include "webrtc/media/base/videocapturer.h" | 23 #include "webrtc/media/base/videocapturer.h" |
24 #include "webrtc/media/base/videocommon.h" | 24 #include "webrtc/media/base/videocommon.h" |
25 | 25 |
26 namespace rtc { | 26 namespace rtc { |
27 class ByteBuffer; | 27 class ByteBufferReader; |
| 28 class ByteBufferWriter; |
28 class StreamInterface; | 29 class StreamInterface; |
29 } | 30 } |
30 | 31 |
31 namespace cricket { | 32 namespace cricket { |
32 | 33 |
33 // Returns size of 420 image with rounding on chroma for odd sizes. | 34 // Returns size of 420 image with rounding on chroma for odd sizes. |
34 #define I420_SIZE(w, h) (w * h + (((w + 1) / 2) * ((h + 1) / 2)) * 2) | 35 #define I420_SIZE(w, h) (w * h + (((w + 1) / 2) * ((h + 1) / 2)) * 2) |
35 // Returns size of ARGB image. | 36 // Returns size of ARGB image. |
36 #define ARGB_SIZE(w, h) (w * h * 4) | 37 #define ARGB_SIZE(w, h) (w * h * 4) |
37 | 38 |
38 template <class T> inline std::vector<T> MakeVector(const T a[], size_t s) { | 39 template <class T> inline std::vector<T> MakeVector(const T a[], size_t s) { |
39 return std::vector<T>(a, a + s); | 40 return std::vector<T>(a, a + s); |
40 } | 41 } |
41 #define MAKE_VECTOR(a) cricket::MakeVector(a, arraysize(a)) | 42 #define MAKE_VECTOR(a) cricket::MakeVector(a, arraysize(a)) |
42 | 43 |
43 struct RtpDumpPacket; | 44 struct RtpDumpPacket; |
44 class RtpDumpWriter; | 45 class RtpDumpWriter; |
45 class VideoFrame; | 46 class VideoFrame; |
46 | 47 |
47 struct RawRtpPacket { | 48 struct RawRtpPacket { |
48 void WriteToByteBuffer(uint32_t in_ssrc, rtc::ByteBuffer* buf) const; | 49 void WriteToByteBuffer(uint32_t in_ssrc, rtc::ByteBufferWriter* buf) const; |
49 bool ReadFromByteBuffer(rtc::ByteBuffer* buf); | 50 bool ReadFromByteBuffer(rtc::ByteBufferReader* buf); |
50 // Check if this packet is the same as the specified packet except the | 51 // Check if this packet is the same as the specified packet except the |
51 // sequence number and timestamp, which should be the same as the specified | 52 // sequence number and timestamp, which should be the same as the specified |
52 // parameters. | 53 // parameters. |
53 bool SameExceptSeqNumTimestampSsrc(const RawRtpPacket& packet, | 54 bool SameExceptSeqNumTimestampSsrc(const RawRtpPacket& packet, |
54 uint16_t seq, | 55 uint16_t seq, |
55 uint32_t ts, | 56 uint32_t ts, |
56 uint32_t ssc) const; | 57 uint32_t ssc) const; |
57 int size() const { return 28; } | 58 int size() const { return 28; } |
58 | 59 |
59 uint8_t ver_to_cc; | 60 uint8_t ver_to_cc; |
60 uint8_t m_to_pt; | 61 uint8_t m_to_pt; |
61 uint16_t sequence_number; | 62 uint16_t sequence_number; |
62 uint32_t timestamp; | 63 uint32_t timestamp; |
63 uint32_t ssrc; | 64 uint32_t ssrc; |
64 char payload[16]; | 65 char payload[16]; |
65 }; | 66 }; |
66 | 67 |
67 struct RawRtcpPacket { | 68 struct RawRtcpPacket { |
68 void WriteToByteBuffer(rtc::ByteBuffer* buf) const; | 69 void WriteToByteBuffer(rtc::ByteBufferWriter* buf) const; |
69 bool ReadFromByteBuffer(rtc::ByteBuffer* buf); | 70 bool ReadFromByteBuffer(rtc::ByteBufferReader* buf); |
70 bool EqualsTo(const RawRtcpPacket& packet) const; | 71 bool EqualsTo(const RawRtcpPacket& packet) const; |
71 | 72 |
72 uint8_t ver_to_count; | 73 uint8_t ver_to_count; |
73 uint8_t type; | 74 uint8_t type; |
74 uint16_t length; | 75 uint16_t length; |
75 char payload[16]; | 76 char payload[16]; |
76 }; | 77 }; |
77 | 78 |
78 class RtpTestUtility { | 79 class RtpTestUtility { |
79 public: | 80 public: |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // Create Simulcast stream with given |ssrcs| and |rtx_ssrcs|. | 224 // Create Simulcast stream with given |ssrcs| and |rtx_ssrcs|. |
224 // The number of |rtx_ssrcs| must match number of |ssrcs|. | 225 // The number of |rtx_ssrcs| must match number of |ssrcs|. |
225 cricket::StreamParams CreateSimWithRtxStreamParams( | 226 cricket::StreamParams CreateSimWithRtxStreamParams( |
226 const std::string& cname, | 227 const std::string& cname, |
227 const std::vector<uint32_t>& ssrcs, | 228 const std::vector<uint32_t>& ssrcs, |
228 const std::vector<uint32_t>& rtx_ssrcs); | 229 const std::vector<uint32_t>& rtx_ssrcs); |
229 | 230 |
230 } // namespace cricket | 231 } // namespace cricket |
231 | 232 |
232 #endif // WEBRTC_MEDIA_BASE_TESTUTILS_H_ | 233 #endif // WEBRTC_MEDIA_BASE_TESTUTILS_H_ |
OLD | NEW |