| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _, _)) | 142 EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _, _)) |
| 143 .Times(0); | 143 .Times(0); |
| 144 EXPECT_NE(EncodedImageCallback::Result::OK, | 144 EXPECT_NE(EncodedImageCallback::Result::OK, |
| 145 payload_router.OnEncodedImage(encoded_image, &codec_info_1, nullptr) | 145 payload_router.OnEncodedImage(encoded_image, &codec_info_1, nullptr) |
| 146 .error); | 146 .error); |
| 147 EXPECT_NE(EncodedImageCallback::Result::OK, | 147 EXPECT_NE(EncodedImageCallback::Result::OK, |
| 148 payload_router.OnEncodedImage(encoded_image, &codec_info_2, nullptr) | 148 payload_router.OnEncodedImage(encoded_image, &codec_info_2, nullptr) |
| 149 .error); | 149 .error); |
| 150 } | 150 } |
| 151 | 151 |
| 152 TEST(PayloadRouterTest, MaxPayloadLength) { | |
| 153 // Without any limitations from the modules, verify we get the max payload | |
| 154 // length for IP/UDP/SRTP with a MTU of 150 bytes. | |
| 155 const size_t kDefaultMaxLength = 1500 - 20 - 8 - 12 - 4; | |
| 156 NiceMock<MockRtpRtcp> rtp_1; | |
| 157 NiceMock<MockRtpRtcp> rtp_2; | |
| 158 std::vector<RtpRtcp*> modules; | |
| 159 modules.push_back(&rtp_1); | |
| 160 modules.push_back(&rtp_2); | |
| 161 PayloadRouter payload_router(modules, 42); | |
| 162 | |
| 163 EXPECT_EQ(kDefaultMaxLength, PayloadRouter::DefaultMaxPayloadLength()); | |
| 164 std::vector<VideoStream> streams(2); | |
| 165 | |
| 166 // Modules return a higher length than the default value. | |
| 167 EXPECT_CALL(rtp_1, MaxDataPayloadLength()) | |
| 168 .Times(1) | |
| 169 .WillOnce(Return(kDefaultMaxLength + 10)); | |
| 170 EXPECT_CALL(rtp_2, MaxDataPayloadLength()) | |
| 171 .Times(1) | |
| 172 .WillOnce(Return(kDefaultMaxLength + 10)); | |
| 173 EXPECT_EQ(kDefaultMaxLength, payload_router.MaxPayloadLength()); | |
| 174 | |
| 175 // The modules return a value lower than default. | |
| 176 const size_t kTestMinPayloadLength = 1001; | |
| 177 EXPECT_CALL(rtp_1, MaxDataPayloadLength()) | |
| 178 .Times(1) | |
| 179 .WillOnce(Return(kTestMinPayloadLength + 10)); | |
| 180 EXPECT_CALL(rtp_2, MaxDataPayloadLength()) | |
| 181 .Times(1) | |
| 182 .WillOnce(Return(kTestMinPayloadLength)); | |
| 183 EXPECT_EQ(kTestMinPayloadLength, payload_router.MaxPayloadLength()); | |
| 184 } | |
| 185 | |
| 186 TEST(PayloadRouterTest, SimulcastTargetBitrate) { | 152 TEST(PayloadRouterTest, SimulcastTargetBitrate) { |
| 187 NiceMock<MockRtpRtcp> rtp_1; | 153 NiceMock<MockRtpRtcp> rtp_1; |
| 188 NiceMock<MockRtpRtcp> rtp_2; | 154 NiceMock<MockRtpRtcp> rtp_2; |
| 189 std::vector<RtpRtcp*> modules; | 155 std::vector<RtpRtcp*> modules; |
| 190 modules.push_back(&rtp_1); | 156 modules.push_back(&rtp_1); |
| 191 modules.push_back(&rtp_2); | 157 modules.push_back(&rtp_2); |
| 192 PayloadRouter payload_router(modules, 42); | 158 PayloadRouter payload_router(modules, 42); |
| 193 payload_router.SetActive(true); | 159 payload_router.SetActive(true); |
| 194 | 160 |
| 195 BitrateAllocation bitrate; | 161 BitrateAllocation bitrate; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 224 bitrate.SetBitrate(0, 1, 20000); | 190 bitrate.SetBitrate(0, 1, 20000); |
| 225 bitrate.SetBitrate(1, 0, 40000); | 191 bitrate.SetBitrate(1, 0, 40000); |
| 226 bitrate.SetBitrate(1, 1, 80000); | 192 bitrate.SetBitrate(1, 1, 80000); |
| 227 | 193 |
| 228 EXPECT_CALL(rtp_1, SetVideoBitrateAllocation(bitrate)).Times(1); | 194 EXPECT_CALL(rtp_1, SetVideoBitrateAllocation(bitrate)).Times(1); |
| 229 | 195 |
| 230 payload_router.OnBitrateAllocationUpdated(bitrate); | 196 payload_router.OnBitrateAllocationUpdated(bitrate); |
| 231 } | 197 } |
| 232 | 198 |
| 233 } // namespace webrtc | 199 } // namespace webrtc |
| OLD | NEW |