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 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 void WriteToByteBuffer(rtc::ByteBufferWriter* buf) const; | 72 void WriteToByteBuffer(rtc::ByteBufferWriter* buf) const; |
73 bool ReadFromByteBuffer(rtc::ByteBufferReader* buf); | 73 bool ReadFromByteBuffer(rtc::ByteBufferReader* buf); |
74 bool EqualsTo(const RawRtcpPacket& packet) const; | 74 bool EqualsTo(const RawRtcpPacket& packet) const; |
75 | 75 |
76 uint8_t ver_to_count; | 76 uint8_t ver_to_count; |
77 uint8_t type; | 77 uint8_t type; |
78 uint16_t length; | 78 uint16_t length; |
79 char payload[16]; | 79 char payload[16]; |
80 }; | 80 }; |
81 | 81 |
82 class RtpTestUtility { | |
83 public: | |
84 static size_t GetTestPacketCount(); | |
85 | |
86 // Write the first count number of kTestRawRtcpPackets or kTestRawRtpPackets, | |
87 // depending on the flag rtcp. If it is RTP, use the specified SSRC. Return | |
88 // true if successful. | |
89 static bool WriteTestPackets(size_t count, | |
90 bool rtcp, | |
91 uint32_t rtp_ssrc, | |
92 RtpDumpWriter* writer); | |
93 | |
94 // Loop read the first count number of packets from the specified stream. | |
95 // Verify the elapsed time of the dump packets increase monotonically. If the | |
96 // stream is a RTP stream, verify the RTP sequence number, timestamp, and | |
97 // payload. If the stream is a RTCP stream, verify the RTCP header and | |
98 // payload. | |
99 static bool VerifyTestPacketsFromStream(size_t count, | |
100 rtc::StreamInterface* stream, | |
101 uint32_t ssrc); | |
102 | |
103 // Verify the dump packet is the same as the raw RTP packet. | |
104 static bool VerifyPacket(const RtpDumpPacket* dump, | |
105 const RawRtpPacket* raw, | |
106 bool header_only); | |
107 | |
108 static const uint32_t kDefaultSsrc = 1; | |
109 static const uint32_t kRtpTimestampIncrease = 90; | |
110 static const uint32_t kDefaultTimeIncrease = 30; | |
111 static const uint32_t kElapsedTimeInterval = 10; | |
112 static const RawRtpPacket kTestRawRtpPackets[]; | |
113 static const RawRtcpPacket kTestRawRtcpPackets[]; | |
114 | |
115 private: | |
116 RtpTestUtility() {} | |
117 }; | |
118 | |
119 // Test helper for testing VideoCapturer implementations. | 82 // Test helper for testing VideoCapturer implementations. |
120 class VideoCapturerListener | 83 class VideoCapturerListener |
121 : public sigslot::has_slots<>, | 84 : public sigslot::has_slots<>, |
122 public rtc::VideoSinkInterface<webrtc::VideoFrame> { | 85 public rtc::VideoSinkInterface<webrtc::VideoFrame> { |
123 public: | 86 public: |
124 explicit VideoCapturerListener(VideoCapturer* cap); | 87 explicit VideoCapturerListener(VideoCapturer* cap); |
125 ~VideoCapturerListener(); | 88 ~VideoCapturerListener(); |
126 | 89 |
127 CaptureState last_capture_state() const { return last_capture_state_; } | 90 CaptureState last_capture_state() const { return last_capture_state_; } |
128 int frame_count() const { return frame_count_; } | 91 int frame_count() const { return frame_count_; } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 157 |
195 // Create StreamParams with single primary SSRC and corresponding FlexFEC SSRC. | 158 // Create StreamParams with single primary SSRC and corresponding FlexFEC SSRC. |
196 cricket::StreamParams CreatePrimaryWithFecFrStreamParams( | 159 cricket::StreamParams CreatePrimaryWithFecFrStreamParams( |
197 const std::string& cname, | 160 const std::string& cname, |
198 uint32_t primary_ssrc, | 161 uint32_t primary_ssrc, |
199 uint32_t flexfec_ssrc); | 162 uint32_t flexfec_ssrc); |
200 | 163 |
201 } // namespace cricket | 164 } // namespace cricket |
202 | 165 |
203 #endif // WEBRTC_MEDIA_BASE_TESTUTILS_H_ | 166 #endif // WEBRTC_MEDIA_BASE_TESTUTILS_H_ |
OLD | NEW |