Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: webrtc/video/payload_router_unittest.cc

Issue 2405173006: Remove deprected functions from EncodedImageCallback and RtpRtcp (Closed)
Patch Set: fix android Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/test/fake_encoder.cc ('k') | webrtc/video/video_send_stream_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 27 matching lines...) Expand all
38 encoded_image._buffer = &payload; 38 encoded_image._buffer = &payload;
39 encoded_image._length = 1; 39 encoded_image._length = 1;
40 40
41 PayloadRouter payload_router(modules, payload_type); 41 PayloadRouter payload_router(modules, payload_type);
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_EQ(-1, payload_router.Encoded(encoded_image, nullptr, nullptr)); 48 EXPECT_NE(
49 EncodedImageCallback::Result::OK,
50 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error);
49 51
50 payload_router.set_active(true); 52 payload_router.set_active(true);
51 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type, 53 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type,
52 encoded_image._timeStamp, 54 encoded_image._timeStamp,
53 encoded_image.capture_time_ms_, &payload, 55 encoded_image.capture_time_ms_, &payload,
54 encoded_image._length, nullptr, _, _)) 56 encoded_image._length, nullptr, _, _))
55 .Times(1); 57 .Times(1);
56 EXPECT_EQ(0, payload_router.Encoded(encoded_image, nullptr, nullptr)); 58 EXPECT_EQ(
59 EncodedImageCallback::Result::OK,
60 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error);
57 61
58 payload_router.set_active(false); 62 payload_router.set_active(false);
59 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type, 63 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type,
60 encoded_image._timeStamp, 64 encoded_image._timeStamp,
61 encoded_image.capture_time_ms_, &payload, 65 encoded_image.capture_time_ms_, &payload,
62 encoded_image._length, nullptr, _, _)) 66 encoded_image._length, nullptr, _, _))
63 .Times(0); 67 .Times(0);
64 EXPECT_EQ(-1, payload_router.Encoded(encoded_image, nullptr, nullptr)); 68 EXPECT_NE(
69 EncodedImageCallback::Result::OK,
70 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error);
65 71
66 payload_router.set_active(true); 72 payload_router.set_active(true);
67 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type, 73 EXPECT_CALL(rtp, SendOutgoingData(encoded_image._frameType, payload_type,
68 encoded_image._timeStamp, 74 encoded_image._timeStamp,
69 encoded_image.capture_time_ms_, &payload, 75 encoded_image.capture_time_ms_, &payload,
70 encoded_image._length, nullptr, _, _)) 76 encoded_image._length, nullptr, _, _))
71 .Times(1); 77 .Times(1);
72 EXPECT_EQ(0, payload_router.Encoded(encoded_image, nullptr, nullptr)); 78 EXPECT_EQ(
79 EncodedImageCallback::Result::OK,
80 payload_router.OnEncodedImage(encoded_image, nullptr, nullptr).error);
73 } 81 }
74 82
75 TEST(PayloadRouterTest, SendSimulcast) { 83 TEST(PayloadRouterTest, SendSimulcast) {
76 NiceMock<MockRtpRtcp> rtp_1; 84 NiceMock<MockRtpRtcp> rtp_1;
77 NiceMock<MockRtpRtcp> rtp_2; 85 NiceMock<MockRtpRtcp> rtp_2;
78 std::vector<RtpRtcp*> modules; 86 std::vector<RtpRtcp*> modules;
79 modules.push_back(&rtp_1); 87 modules.push_back(&rtp_1);
80 modules.push_back(&rtp_2); 88 modules.push_back(&rtp_2);
81 std::vector<VideoStream> streams(2); 89 std::vector<VideoStream> streams(2);
82 90
(...skipping 13 matching lines...) Expand all
96 codec_info_1.codecType = kVideoCodecVP8; 104 codec_info_1.codecType = kVideoCodecVP8;
97 codec_info_1.codecSpecific.VP8.simulcastIdx = 0; 105 codec_info_1.codecSpecific.VP8.simulcastIdx = 0;
98 106
99 payload_router.set_active(true); 107 payload_router.set_active(true);
100 EXPECT_CALL(rtp_1, SendOutgoingData(encoded_image._frameType, payload_type, 108 EXPECT_CALL(rtp_1, SendOutgoingData(encoded_image._frameType, payload_type,
101 encoded_image._timeStamp, 109 encoded_image._timeStamp,
102 encoded_image.capture_time_ms_, &payload, 110 encoded_image.capture_time_ms_, &payload,
103 encoded_image._length, nullptr, _, _)) 111 encoded_image._length, nullptr, _, _))
104 .Times(1); 112 .Times(1);
105 EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _, _)).Times(0); 113 EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _, _)).Times(0);
106 EXPECT_EQ(0, payload_router.Encoded(encoded_image, &codec_info_1, nullptr)); 114 EXPECT_EQ(EncodedImageCallback::Result::OK,
115 payload_router.OnEncodedImage(encoded_image, &codec_info_1, nullptr)
116 .error);
107 117
108 CodecSpecificInfo codec_info_2; 118 CodecSpecificInfo codec_info_2;
109 memset(&codec_info_2, 0, sizeof(CodecSpecificInfo)); 119 memset(&codec_info_2, 0, sizeof(CodecSpecificInfo));
110 codec_info_2.codecType = kVideoCodecVP8; 120 codec_info_2.codecType = kVideoCodecVP8;
111 codec_info_2.codecSpecific.VP8.simulcastIdx = 1; 121 codec_info_2.codecSpecific.VP8.simulcastIdx = 1;
112 122
113 EXPECT_CALL(rtp_2, SendOutgoingData(encoded_image._frameType, payload_type, 123 EXPECT_CALL(rtp_2, SendOutgoingData(encoded_image._frameType, payload_type,
114 encoded_image._timeStamp, 124 encoded_image._timeStamp,
115 encoded_image.capture_time_ms_, &payload, 125 encoded_image.capture_time_ms_, &payload,
116 encoded_image._length, nullptr, _, _)) 126 encoded_image._length, nullptr, _, _))
117 .Times(1); 127 .Times(1);
118 EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _, _)) 128 EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _, _))
119 .Times(0); 129 .Times(0);
120 EXPECT_EQ(0, payload_router.Encoded(encoded_image, &codec_info_2, nullptr)); 130 EXPECT_EQ(EncodedImageCallback::Result::OK,
131 payload_router.OnEncodedImage(encoded_image, &codec_info_2, nullptr)
132 .error);
121 133
122 // Inactive. 134 // Inactive.
123 payload_router.set_active(false); 135 payload_router.set_active(false);
124 EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _, _)) 136 EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _, _))
125 .Times(0); 137 .Times(0);
126 EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _, _)) 138 EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _, _))
127 .Times(0); 139 .Times(0);
128 EXPECT_EQ(-1, payload_router.Encoded(encoded_image, &codec_info_1, nullptr)); 140 EXPECT_NE(EncodedImageCallback::Result::OK,
129 EXPECT_EQ(-1, payload_router.Encoded(encoded_image, &codec_info_2, nullptr)); 141 payload_router.OnEncodedImage(encoded_image, &codec_info_1, nullptr)
142 .error);
143 EXPECT_NE(EncodedImageCallback::Result::OK,
144 payload_router.OnEncodedImage(encoded_image, &codec_info_2, nullptr)
145 .error);
130 } 146 }
131 147
132 TEST(PayloadRouterTest, MaxPayloadLength) { 148 TEST(PayloadRouterTest, MaxPayloadLength) {
133 // Without any limitations from the modules, verify we get the max payload 149 // Without any limitations from the modules, verify we get the max payload
134 // length for IP/UDP/SRTP with a MTU of 150 bytes. 150 // length for IP/UDP/SRTP with a MTU of 150 bytes.
135 const size_t kDefaultMaxLength = 1500 - 20 - 8 - 12 - 4; 151 const size_t kDefaultMaxLength = 1500 - 20 - 8 - 12 - 4;
136 NiceMock<MockRtpRtcp> rtp_1; 152 NiceMock<MockRtpRtcp> rtp_1;
137 NiceMock<MockRtpRtcp> rtp_2; 153 NiceMock<MockRtpRtcp> rtp_2;
138 std::vector<RtpRtcp*> modules; 154 std::vector<RtpRtcp*> modules;
139 modules.push_back(&rtp_1); 155 modules.push_back(&rtp_1);
(...skipping 16 matching lines...) Expand all
156 const size_t kTestMinPayloadLength = 1001; 172 const size_t kTestMinPayloadLength = 1001;
157 EXPECT_CALL(rtp_1, MaxDataPayloadLength()) 173 EXPECT_CALL(rtp_1, MaxDataPayloadLength())
158 .Times(1) 174 .Times(1)
159 .WillOnce(Return(kTestMinPayloadLength + 10)); 175 .WillOnce(Return(kTestMinPayloadLength + 10));
160 EXPECT_CALL(rtp_2, MaxDataPayloadLength()) 176 EXPECT_CALL(rtp_2, MaxDataPayloadLength())
161 .Times(1) 177 .Times(1)
162 .WillOnce(Return(kTestMinPayloadLength)); 178 .WillOnce(Return(kTestMinPayloadLength));
163 EXPECT_EQ(kTestMinPayloadLength, payload_router.MaxPayloadLength()); 179 EXPECT_EQ(kTestMinPayloadLength, payload_router.MaxPayloadLength());
164 } 180 }
165 } // namespace webrtc 181 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/fake_encoder.cc ('k') | webrtc/video/video_send_stream_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698