OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 #include <stdlib.h> | 11 #include <stdlib.h> |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <memory> | |
15 #include <vector> | 14 #include <vector> |
16 | 15 |
17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "webrtc/common_types.h" | 17 #include "webrtc/common_types.h" |
19 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" | 18 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" |
20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 19 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
22 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 21 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
23 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_video.h" | 22 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_video.h" |
24 #include "webrtc/modules/rtp_rtcp/test/testAPI/test_api.h" | 23 #include "webrtc/modules/rtp_rtcp/test/testAPI/test_api.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 return padding_bytes_in_packet + header_length; | 120 return padding_bytes_in_packet + header_length; |
122 } | 121 } |
123 | 122 |
124 virtual void TearDown() { | 123 virtual void TearDown() { |
125 delete video_module_; | 124 delete video_module_; |
126 delete transport_; | 125 delete transport_; |
127 delete receiver_; | 126 delete receiver_; |
128 } | 127 } |
129 | 128 |
130 int test_id_; | 129 int test_id_; |
131 std::unique_ptr<ReceiveStatistics> receive_statistics_; | 130 rtc::scoped_ptr<ReceiveStatistics> receive_statistics_; |
132 RTPPayloadRegistry rtp_payload_registry_; | 131 RTPPayloadRegistry rtp_payload_registry_; |
133 std::unique_ptr<RtpReceiver> rtp_receiver_; | 132 rtc::scoped_ptr<RtpReceiver> rtp_receiver_; |
134 RtpRtcp* video_module_; | 133 RtpRtcp* video_module_; |
135 LoopBackTransport* transport_; | 134 LoopBackTransport* transport_; |
136 TestRtpReceiver* receiver_; | 135 TestRtpReceiver* receiver_; |
137 uint32_t test_ssrc_; | 136 uint32_t test_ssrc_; |
138 uint32_t test_timestamp_; | 137 uint32_t test_timestamp_; |
139 uint16_t test_sequence_number_; | 138 uint16_t test_sequence_number_; |
140 uint8_t video_frame_[65000]; | 139 uint8_t video_frame_[65000]; |
141 size_t payload_data_length_; | 140 size_t payload_data_length_; |
142 SimulatedClock fake_clock; | 141 SimulatedClock fake_clock; |
143 }; | 142 }; |
(...skipping 20 matching lines...) Expand all Loading... |
164 codec.plType, | 163 codec.plType, |
165 90000, | 164 90000, |
166 0, | 165 0, |
167 codec.maxBitrate)); | 166 codec.maxBitrate)); |
168 for (int frame_idx = 0; frame_idx < 10; ++frame_idx) { | 167 for (int frame_idx = 0; frame_idx < 10; ++frame_idx) { |
169 for (int packet_idx = 0; packet_idx < 5; ++packet_idx) { | 168 for (int packet_idx = 0; packet_idx < 5; ++packet_idx) { |
170 size_t packet_size = PaddingPacket(padding_packet, timestamp, seq_num, | 169 size_t packet_size = PaddingPacket(padding_packet, timestamp, seq_num, |
171 kPadSize); | 170 kPadSize); |
172 ++seq_num; | 171 ++seq_num; |
173 RTPHeader header; | 172 RTPHeader header; |
174 std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); | 173 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); |
175 EXPECT_TRUE(parser->Parse(padding_packet, packet_size, &header)); | 174 EXPECT_TRUE(parser->Parse(padding_packet, packet_size, &header)); |
176 PayloadUnion payload_specific; | 175 PayloadUnion payload_specific; |
177 EXPECT_TRUE(rtp_payload_registry_.GetPayloadSpecifics(header.payloadType, | 176 EXPECT_TRUE(rtp_payload_registry_.GetPayloadSpecifics(header.payloadType, |
178 &payload_specific)); | 177 &payload_specific)); |
179 const uint8_t* payload = padding_packet + header.headerLength; | 178 const uint8_t* payload = padding_packet + header.headerLength; |
180 const size_t payload_length = packet_size - header.headerLength; | 179 const size_t payload_length = packet_size - header.headerLength; |
181 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, payload, | 180 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, payload, |
182 payload_length, | 181 payload_length, |
183 payload_specific, true)); | 182 payload_specific, true)); |
184 EXPECT_EQ(0u, receiver_->payload_size()); | 183 EXPECT_EQ(0u, receiver_->payload_size()); |
185 EXPECT_EQ(payload_length, receiver_->rtp_header().header.paddingLength); | 184 EXPECT_EQ(payload_length, receiver_->rtp_header().header.paddingLength); |
186 } | 185 } |
187 timestamp += 3000; | 186 timestamp += 3000; |
188 fake_clock.AdvanceTimeMilliseconds(33); | 187 fake_clock.AdvanceTimeMilliseconds(33); |
189 } | 188 } |
190 } | 189 } |
191 | 190 |
192 } // namespace webrtc | 191 } // namespace webrtc |
OLD | NEW |