| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 .Times(0); | 47 .Times(0); |
| 48 EXPECT_NE( | 48 EXPECT_NE( |
| 49 EncodedImageCallback::Result::OK, | 49 EncodedImageCallback::Result::OK, |
| 50 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error); | 50 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error); |
| 51 | 51 |
| 52 payload_router.set_active(true); | 52 payload_router.set_active(true); |
| 53 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type, | 53 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type, |
| 54 encoded_image._timeStamp, | 54 encoded_image._timeStamp, |
| 55 encoded_image.capture_time_ms_, &payload, | 55 encoded_image.capture_time_ms_, &payload, |
| 56 encoded_image._length, nullptr, _, _)) | 56 encoded_image._length, nullptr, _, _)) |
| 57 .Times(1); | 57 .Times(1) |
| 58 .WillOnce(Return(true)); |
| 58 EXPECT_EQ( | 59 EXPECT_EQ( |
| 59 EncodedImageCallback::Result::OK, | 60 EncodedImageCallback::Result::OK, |
| 60 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error); | 61 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error); |
| 61 | 62 |
| 62 payload_router.set_active(false); | 63 payload_router.set_active(false); |
| 63 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type, | 64 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type, |
| 64 encoded_image._timeStamp, | 65 encoded_image._timeStamp, |
| 65 encoded_image.capture_time_ms_, &payload, | 66 encoded_image.capture_time_ms_, &payload, |
| 66 encoded_image._length, nullptr, _, _)) | 67 encoded_image._length, nullptr, _, _)) |
| 67 .Times(0); | 68 .Times(0); |
| 68 EXPECT_NE( | 69 EXPECT_NE( |
| 69 EncodedImageCallback::Result::OK, | 70 EncodedImageCallback::Result::OK, |
| 70 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error); | 71 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error); |
| 71 | 72 |
| 72 payload_router.set_active(true); | 73 payload_router.set_active(true); |
| 73 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type, | 74 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type, |
| 74 encoded_image._timeStamp, | 75 encoded_image._timeStamp, |
| 75 encoded_image.capture_time_ms_, &payload, | 76 encoded_image.capture_time_ms_, &payload, |
| 76 encoded_image._length, nullptr, _, _)) | 77 encoded_image._length, nullptr, _, _)) |
| 77 .Times(1); | 78 .Times(1) |
| 79 .WillOnce(Return(true)); |
| 78 EXPECT_EQ( | 80 EXPECT_EQ( |
| 79 EncodedImageCallback::Result::OK, | 81 EncodedImageCallback::Result::OK, |
| 80 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error); | 82 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error); |
| 81 } | 83 } |
| 82 | 84 |
| 83 TEST(PayloadRouterTest, SendSimulcast) { | 85 TEST(PayloadRouterTest, SendSimulcast) { |
| 84 NiceMock<MockRtpRtcp> rtp_1; | 86 NiceMock<MockRtpRtcp> rtp_1; |
| 85 NiceMock<MockRtpRtcp> rtp_2; | 87 NiceMock<MockRtpRtcp> rtp_2; |
| 86 std::vector<RtpRtcp*> modules; | 88 std::vector<RtpRtcp*> modules; |
| 87 modules.push_back(&rtp_1); | 89 modules.push_back(&rtp_1); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 102 CodecSpecificInfo codec_info_1; | 104 CodecSpecificInfo codec_info_1; |
| 103 memset(&codec_info_1, 0, sizeof(CodecSpecificInfo)); | 105 memset(&codec_info_1, 0, sizeof(CodecSpecificInfo)); |
| 104 codec_info_1.codecType = kVideoCodecVP8; | 106 codec_info_1.codecType = kVideoCodecVP8; |
| 105 codec_info_1.codecSpecific.VP8.simulcastIdx = 0; | 107 codec_info_1.codecSpecific.VP8.simulcastIdx = 0; |
| 106 | 108 |
| 107 payload_router.set_active(true); | 109 payload_router.set_active(true); |
| 108 EXPECT_CALL(rtp_1, SendOutgoingData(encoded_image._frameType, payload_type, | 110 EXPECT_CALL(rtp_1, SendOutgoingData(encoded_image._frameType, payload_type, |
| 109 encoded_image._timeStamp, | 111 encoded_image._timeStamp, |
| 110 encoded_image.capture_time_ms_, &payload, | 112 encoded_image.capture_time_ms_, &payload, |
| 111 encoded_image._length, nullptr, _, _)) | 113 encoded_image._length, nullptr, _, _)) |
| 112 .Times(1); | 114 .Times(1) |
| 115 .WillOnce(Return(true)); |
| 113 EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _, _)).Times(0); | 116 EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _, _)).Times(0); |
| 114 EXPECT_EQ(EncodedImageCallback::Result::OK, | 117 EXPECT_EQ(EncodedImageCallback::Result::OK, |
| 115 payload_router.OnEncodedImage(encoded_image, &codec_info_1, nullptr) | 118 payload_router.OnEncodedImage(encoded_image, &codec_info_1, nullptr) |
| 116 .error); | 119 .error); |
| 117 | 120 |
| 118 CodecSpecificInfo codec_info_2; | 121 CodecSpecificInfo codec_info_2; |
| 119 memset(&codec_info_2, 0, sizeof(CodecSpecificInfo)); | 122 memset(&codec_info_2, 0, sizeof(CodecSpecificInfo)); |
| 120 codec_info_2.codecType = kVideoCodecVP8; | 123 codec_info_2.codecType = kVideoCodecVP8; |
| 121 codec_info_2.codecSpecific.VP8.simulcastIdx = 1; | 124 codec_info_2.codecSpecific.VP8.simulcastIdx = 1; |
| 122 | 125 |
| 123 EXPECT_CALL(rtp_2, SendOutgoingData(encoded_image._frameType, payload_type, | 126 EXPECT_CALL(rtp_2, SendOutgoingData(encoded_image._frameType, payload_type, |
| 124 encoded_image._timeStamp, | 127 encoded_image._timeStamp, |
| 125 encoded_image.capture_time_ms_, &payload, | 128 encoded_image.capture_time_ms_, &payload, |
| 126 encoded_image._length, nullptr, _, _)) | 129 encoded_image._length, nullptr, _, _)) |
| 127 .Times(1); | 130 .Times(1) |
| 131 .WillOnce(Return(true)); |
| 128 EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _, _)) | 132 EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _, _)) |
| 129 .Times(0); | 133 .Times(0); |
| 130 EXPECT_EQ(EncodedImageCallback::Result::OK, | 134 EXPECT_EQ(EncodedImageCallback::Result::OK, |
| 131 payload_router.OnEncodedImage(encoded_image, &codec_info_2, nullptr) | 135 payload_router.OnEncodedImage(encoded_image, &codec_info_2, nullptr) |
| 132 .error); | 136 .error); |
| 133 | 137 |
| 134 // Inactive. | 138 // Inactive. |
| 135 payload_router.set_active(false); | 139 payload_router.set_active(false); |
| 136 EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _, _)) | 140 EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _, _)) |
| 137 .Times(0); | 141 .Times(0); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 const size_t kTestMinPayloadLength = 1001; | 176 const size_t kTestMinPayloadLength = 1001; |
| 173 EXPECT_CALL(rtp_1, MaxDataPayloadLength()) | 177 EXPECT_CALL(rtp_1, MaxDataPayloadLength()) |
| 174 .Times(1) | 178 .Times(1) |
| 175 .WillOnce(Return(kTestMinPayloadLength + 10)); | 179 .WillOnce(Return(kTestMinPayloadLength + 10)); |
| 176 EXPECT_CALL(rtp_2, MaxDataPayloadLength()) | 180 EXPECT_CALL(rtp_2, MaxDataPayloadLength()) |
| 177 .Times(1) | 181 .Times(1) |
| 178 .WillOnce(Return(kTestMinPayloadLength)); | 182 .WillOnce(Return(kTestMinPayloadLength)); |
| 179 EXPECT_EQ(kTestMinPayloadLength, payload_router.MaxPayloadLength()); | 183 EXPECT_EQ(kTestMinPayloadLength, payload_router.MaxPayloadLength()); |
| 180 } | 184 } |
| 181 } // namespace webrtc | 185 } // namespace webrtc |
| OLD | NEW |