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