OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _)) | 134 EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _)) |
135 .Times(0); | 135 .Times(0); |
136 rtp_hdr_1.simulcastIdx = 2; | 136 rtp_hdr_1.simulcastIdx = 2; |
137 EXPECT_FALSE(payload_router_->RoutePayload(frame_type_1, payload_type_1, 0, 0, | 137 EXPECT_FALSE(payload_router_->RoutePayload(frame_type_1, payload_type_1, 0, 0, |
138 &payload_1, 1, NULL, &rtp_hdr_1)); | 138 &payload_1, 1, NULL, &rtp_hdr_1)); |
139 } | 139 } |
140 | 140 |
141 TEST_F(PayloadRouterTest, MaxPayloadLength) { | 141 TEST_F(PayloadRouterTest, MaxPayloadLength) { |
142 // Without any limitations from the modules, verify we get the max payload | 142 // Without any limitations from the modules, verify we get the max payload |
143 // length for IP/UDP/SRTP with a MTU of 150 bytes. | 143 // length for IP/UDP/SRTP with a MTU of 150 bytes. |
144 const uint16_t kDefaultMaxLength = 1500 - 20 - 8 - 12 - 4; | 144 const size_t kDefaultMaxLength = 1500 - 20 - 8 - 12 - 4; |
145 EXPECT_EQ(kDefaultMaxLength, payload_router_->DefaultMaxPayloadLength()); | 145 EXPECT_EQ(kDefaultMaxLength, payload_router_->DefaultMaxPayloadLength()); |
146 EXPECT_EQ(kDefaultMaxLength, payload_router_->MaxPayloadLength()); | 146 EXPECT_EQ(kDefaultMaxLength, payload_router_->MaxPayloadLength()); |
147 | 147 |
148 MockRtpRtcp rtp_1; | 148 MockRtpRtcp rtp_1; |
149 MockRtpRtcp rtp_2; | 149 MockRtpRtcp rtp_2; |
150 std::list<RtpRtcp*> modules; | 150 std::list<RtpRtcp*> modules; |
151 modules.push_back(&rtp_1); | 151 modules.push_back(&rtp_1); |
152 modules.push_back(&rtp_2); | 152 modules.push_back(&rtp_2); |
153 payload_router_->SetSendingRtpModules(modules); | 153 payload_router_->SetSendingRtpModules(modules); |
154 | 154 |
155 // Modules return a higher length than the default value. | 155 // Modules return a higher length than the default value. |
156 EXPECT_CALL(rtp_1, MaxDataPayloadLength()) | 156 EXPECT_CALL(rtp_1, MaxDataPayloadLength()) |
157 .Times(1) | 157 .Times(1) |
158 .WillOnce(Return(kDefaultMaxLength + 10)); | 158 .WillOnce(Return(kDefaultMaxLength + 10)); |
159 EXPECT_CALL(rtp_2, MaxDataPayloadLength()) | 159 EXPECT_CALL(rtp_2, MaxDataPayloadLength()) |
160 .Times(1) | 160 .Times(1) |
161 .WillOnce(Return(kDefaultMaxLength + 10)); | 161 .WillOnce(Return(kDefaultMaxLength + 10)); |
162 EXPECT_EQ(kDefaultMaxLength, payload_router_->MaxPayloadLength()); | 162 EXPECT_EQ(kDefaultMaxLength, payload_router_->MaxPayloadLength()); |
163 | 163 |
164 // The modules return a value lower than default. | 164 // The modules return a value lower than default. |
165 const uint16_t kTestMinPayloadLength = 1001; | 165 const size_t kTestMinPayloadLength = 1001; |
166 EXPECT_CALL(rtp_1, MaxDataPayloadLength()) | 166 EXPECT_CALL(rtp_1, MaxDataPayloadLength()) |
167 .Times(1) | 167 .Times(1) |
168 .WillOnce(Return(kTestMinPayloadLength + 10)); | 168 .WillOnce(Return(kTestMinPayloadLength + 10)); |
169 EXPECT_CALL(rtp_2, MaxDataPayloadLength()) | 169 EXPECT_CALL(rtp_2, MaxDataPayloadLength()) |
170 .Times(1) | 170 .Times(1) |
171 .WillOnce(Return(kTestMinPayloadLength)); | 171 .WillOnce(Return(kTestMinPayloadLength)); |
172 EXPECT_EQ(kTestMinPayloadLength, payload_router_->MaxPayloadLength()); | 172 EXPECT_EQ(kTestMinPayloadLength, payload_router_->MaxPayloadLength()); |
173 } | 173 } |
174 | 174 |
175 TEST_F(PayloadRouterTest, SetTargetSendBitrates) { | 175 TEST_F(PayloadRouterTest, SetTargetSendBitrates) { |
(...skipping 24 matching lines...) Expand all Loading... |
200 bitrates.resize(3); | 200 bitrates.resize(3); |
201 bitrates[1] = bitrate_2; | 201 bitrates[1] = bitrate_2; |
202 bitrates[2] = bitrate_1 + bitrate_2; | 202 bitrates[2] = bitrate_1 + bitrate_2; |
203 EXPECT_CALL(rtp_1, SetTargetSendBitrate(bitrate_1)) | 203 EXPECT_CALL(rtp_1, SetTargetSendBitrate(bitrate_1)) |
204 .Times(1); | 204 .Times(1); |
205 EXPECT_CALL(rtp_2, SetTargetSendBitrate(bitrate_2)) | 205 EXPECT_CALL(rtp_2, SetTargetSendBitrate(bitrate_2)) |
206 .Times(1); | 206 .Times(1); |
207 payload_router_->SetTargetSendBitrates(bitrates); | 207 payload_router_->SetTargetSendBitrates(bitrates); |
208 } | 208 } |
209 } // namespace webrtc | 209 } // namespace webrtc |
OLD | NEW |