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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type, | 43 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type, |
44 encoded_image._timeStamp, | 44 encoded_image._timeStamp, |
45 encoded_image.capture_time_ms_, &payload, | 45 encoded_image.capture_time_ms_, &payload, |
46 encoded_image._length, nullptr, _, _)) | 46 encoded_image._length, nullptr, _, _)) |
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.SetActive(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 .WillOnce(Return(true)); |
59 EXPECT_EQ( | 59 EXPECT_EQ( |
60 EncodedImageCallback::Result::OK, | 60 EncodedImageCallback::Result::OK, |
61 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error); | 61 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error); |
62 | 62 |
63 payload_router.set_active(false); | 63 payload_router.SetActive(false); |
64 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type, | 64 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type, |
65 encoded_image._timeStamp, | 65 encoded_image._timeStamp, |
66 encoded_image.capture_time_ms_, &payload, | 66 encoded_image.capture_time_ms_, &payload, |
67 encoded_image._length, nullptr, _, _)) | 67 encoded_image._length, nullptr, _, _)) |
68 .Times(0); | 68 .Times(0); |
69 EXPECT_NE( | 69 EXPECT_NE( |
70 EncodedImageCallback::Result::OK, | 70 EncodedImageCallback::Result::OK, |
71 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error); | 71 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error); |
72 | 72 |
73 payload_router.set_active(true); | 73 payload_router.SetActive(true); |
74 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type, | 74 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type, |
75 encoded_image._timeStamp, | 75 encoded_image._timeStamp, |
76 encoded_image.capture_time_ms_, &payload, | 76 encoded_image.capture_time_ms_, &payload, |
77 encoded_image._length, nullptr, _, _)) | 77 encoded_image._length, nullptr, _, _)) |
78 .Times(1) | 78 .Times(1) |
79 .WillOnce(Return(true)); | 79 .WillOnce(Return(true)); |
80 EXPECT_EQ( | 80 EXPECT_EQ( |
81 EncodedImageCallback::Result::OK, | 81 EncodedImageCallback::Result::OK, |
82 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error); | 82 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error); |
83 } | 83 } |
(...skipping 15 matching lines...) Expand all Loading... |
99 encoded_image._buffer = &payload; | 99 encoded_image._buffer = &payload; |
100 encoded_image._length = 1; | 100 encoded_image._length = 1; |
101 | 101 |
102 PayloadRouter payload_router(modules, payload_type); | 102 PayloadRouter payload_router(modules, payload_type); |
103 | 103 |
104 CodecSpecificInfo codec_info_1; | 104 CodecSpecificInfo codec_info_1; |
105 memset(&codec_info_1, 0, sizeof(CodecSpecificInfo)); | 105 memset(&codec_info_1, 0, sizeof(CodecSpecificInfo)); |
106 codec_info_1.codecType = kVideoCodecVP8; | 106 codec_info_1.codecType = kVideoCodecVP8; |
107 codec_info_1.codecSpecific.VP8.simulcastIdx = 0; | 107 codec_info_1.codecSpecific.VP8.simulcastIdx = 0; |
108 | 108 |
109 payload_router.set_active(true); | 109 payload_router.SetActive(true); |
110 EXPECT_CALL(rtp_1, SendOutgoingData(encoded_image._frameType, payload_type, | 110 EXPECT_CALL(rtp_1, SendOutgoingData(encoded_image._frameType, payload_type, |
111 encoded_image._timeStamp, | 111 encoded_image._timeStamp, |
112 encoded_image.capture_time_ms_, &payload, | 112 encoded_image.capture_time_ms_, &payload, |
113 encoded_image._length, nullptr, _, _)) | 113 encoded_image._length, nullptr, _, _)) |
114 .Times(1) | 114 .Times(1) |
115 .WillOnce(Return(true)); | 115 .WillOnce(Return(true)); |
116 EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _, _)).Times(0); | 116 EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _, _)).Times(0); |
117 EXPECT_EQ(EncodedImageCallback::Result::OK, | 117 EXPECT_EQ(EncodedImageCallback::Result::OK, |
118 payload_router.OnEncodedImage(encoded_image, &codec_info_1, nullptr) | 118 payload_router.OnEncodedImage(encoded_image, &codec_info_1, nullptr) |
119 .error); | 119 .error); |
120 | 120 |
121 CodecSpecificInfo codec_info_2; | 121 CodecSpecificInfo codec_info_2; |
122 memset(&codec_info_2, 0, sizeof(CodecSpecificInfo)); | 122 memset(&codec_info_2, 0, sizeof(CodecSpecificInfo)); |
123 codec_info_2.codecType = kVideoCodecVP8; | 123 codec_info_2.codecType = kVideoCodecVP8; |
124 codec_info_2.codecSpecific.VP8.simulcastIdx = 1; | 124 codec_info_2.codecSpecific.VP8.simulcastIdx = 1; |
125 | 125 |
126 EXPECT_CALL(rtp_2, SendOutgoingData(encoded_image._frameType, payload_type, | 126 EXPECT_CALL(rtp_2, SendOutgoingData(encoded_image._frameType, payload_type, |
127 encoded_image._timeStamp, | 127 encoded_image._timeStamp, |
128 encoded_image.capture_time_ms_, &payload, | 128 encoded_image.capture_time_ms_, &payload, |
129 encoded_image._length, nullptr, _, _)) | 129 encoded_image._length, nullptr, _, _)) |
130 .Times(1) | 130 .Times(1) |
131 .WillOnce(Return(true)); | 131 .WillOnce(Return(true)); |
132 EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _, _)) | 132 EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _, _)) |
133 .Times(0); | 133 .Times(0); |
134 EXPECT_EQ(EncodedImageCallback::Result::OK, | 134 EXPECT_EQ(EncodedImageCallback::Result::OK, |
135 payload_router.OnEncodedImage(encoded_image, &codec_info_2, nullptr) | 135 payload_router.OnEncodedImage(encoded_image, &codec_info_2, nullptr) |
136 .error); | 136 .error); |
137 | 137 |
138 // Inactive. | 138 // Inactive. |
139 payload_router.set_active(false); | 139 payload_router.SetActive(false); |
140 EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _, _)) | 140 EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _, _)) |
141 .Times(0); | 141 .Times(0); |
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); |
(...skipping 26 matching lines...) Expand all Loading... |
176 const size_t kTestMinPayloadLength = 1001; | 176 const size_t kTestMinPayloadLength = 1001; |
177 EXPECT_CALL(rtp_1, MaxDataPayloadLength()) | 177 EXPECT_CALL(rtp_1, MaxDataPayloadLength()) |
178 .Times(1) | 178 .Times(1) |
179 .WillOnce(Return(kTestMinPayloadLength + 10)); | 179 .WillOnce(Return(kTestMinPayloadLength + 10)); |
180 EXPECT_CALL(rtp_2, MaxDataPayloadLength()) | 180 EXPECT_CALL(rtp_2, MaxDataPayloadLength()) |
181 .Times(1) | 181 .Times(1) |
182 .WillOnce(Return(kTestMinPayloadLength)); | 182 .WillOnce(Return(kTestMinPayloadLength)); |
183 EXPECT_EQ(kTestMinPayloadLength, payload_router.MaxPayloadLength()); | 183 EXPECT_EQ(kTestMinPayloadLength, payload_router.MaxPayloadLength()); |
184 } | 184 } |
185 } // namespace webrtc | 185 } // namespace webrtc |
OLD | NEW |