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

Side by Side Diff: webrtc/modules/pacing/packet_router_unittest.cc

Issue 2675703002: Reland of Enable audio streams to send padding. (patchset #4 id:60001 of https://codereview.webrtc.… (Closed)
Patch Set: Comments addressed. Created 3 years, 10 months 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/modules/pacing/packet_router.cc ('k') | webrtc/modules/rtp_rtcp/include/rtp_rtcp.h » ('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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 EXPECT_CALL(rtp_2, RtxSendStatus()).WillOnce(Return(kRtxRedundantPayloads)); 115 EXPECT_CALL(rtp_2, RtxSendStatus()).WillOnce(Return(kRtxRedundantPayloads));
116 EXPECT_CALL(rtp_2, SSRC()).WillRepeatedly(Return(kSsrc2)); 116 EXPECT_CALL(rtp_2, SSRC()).WillRepeatedly(Return(kSsrc2));
117 packet_router_->AddRtpModule(&rtp_1); 117 packet_router_->AddRtpModule(&rtp_1);
118 packet_router_->AddRtpModule(&rtp_2); 118 packet_router_->AddRtpModule(&rtp_2);
119 119
120 // Default configuration, sending padding on all modules sending media, 120 // Default configuration, sending padding on all modules sending media,
121 // ordered by priority (based on rtx mode). 121 // ordered by priority (based on rtx mode).
122 const size_t requested_padding_bytes = 1000; 122 const size_t requested_padding_bytes = 1000;
123 const size_t sent_padding_bytes = 890; 123 const size_t sent_padding_bytes = 890;
124 EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(true)); 124 EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(true));
125 EXPECT_CALL(rtp_2, HasBweExtensions()).Times(1).WillOnce(Return(true));
125 EXPECT_CALL(rtp_2, TimeToSendPadding(requested_padding_bytes, 111)) 126 EXPECT_CALL(rtp_2, TimeToSendPadding(requested_padding_bytes, 111))
126 .Times(1) 127 .Times(1)
127 .WillOnce(Return(sent_padding_bytes)); 128 .WillOnce(Return(sent_padding_bytes));
128 EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(true)); 129 EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(true));
130 EXPECT_CALL(rtp_1, HasBweExtensions()).Times(1).WillOnce(Return(true));
129 EXPECT_CALL(rtp_1, TimeToSendPadding( 131 EXPECT_CALL(rtp_1, TimeToSendPadding(
130 requested_padding_bytes - sent_padding_bytes, 111)) 132 requested_padding_bytes - sent_padding_bytes, 111))
131 .Times(1) 133 .Times(1)
132 .WillOnce(Return(requested_padding_bytes - sent_padding_bytes)); 134 .WillOnce(Return(requested_padding_bytes - sent_padding_bytes));
133 EXPECT_EQ(requested_padding_bytes, 135 EXPECT_EQ(requested_padding_bytes,
134 packet_router_->TimeToSendPadding(requested_padding_bytes, 111)); 136 packet_router_->TimeToSendPadding(requested_padding_bytes, 111));
135 137
136 // Let only the lower priority module be sending and verify the padding 138 // Let only the lower priority module be sending and verify the padding
137 // request is routed there. 139 // request is routed there.
138 EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(false)); 140 EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(false));
139 EXPECT_CALL(rtp_2, TimeToSendPadding(requested_padding_bytes, _)).Times(0); 141 EXPECT_CALL(rtp_2, TimeToSendPadding(requested_padding_bytes, _)).Times(0);
140 EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(true)); 142 EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(true));
143 EXPECT_CALL(rtp_1, HasBweExtensions()).Times(1).WillOnce(Return(true));
141 EXPECT_CALL(rtp_1, TimeToSendPadding(_, _)) 144 EXPECT_CALL(rtp_1, TimeToSendPadding(_, _))
142 .Times(1) 145 .Times(1)
143 .WillOnce(Return(sent_padding_bytes)); 146 .WillOnce(Return(sent_padding_bytes));
144 EXPECT_EQ(sent_padding_bytes, 147 EXPECT_EQ(sent_padding_bytes,
145 packet_router_->TimeToSendPadding(requested_padding_bytes, 148 packet_router_->TimeToSendPadding(requested_padding_bytes,
146 PacketInfo::kNotAProbe)); 149 PacketInfo::kNotAProbe));
147 150
148 // No sending module at all. 151 // No sending module at all.
149 EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(false)); 152 EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(false));
150 EXPECT_CALL(rtp_1, TimeToSendPadding(requested_padding_bytes, _)).Times(0); 153 EXPECT_CALL(rtp_1, TimeToSendPadding(requested_padding_bytes, _)).Times(0);
151 EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(false)); 154 EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(false));
152 EXPECT_CALL(rtp_2, TimeToSendPadding(_, _)).Times(0); 155 EXPECT_CALL(rtp_2, TimeToSendPadding(_, _)).Times(0);
153 EXPECT_EQ(0u, packet_router_->TimeToSendPadding(requested_padding_bytes, 156 EXPECT_EQ(0u, packet_router_->TimeToSendPadding(requested_padding_bytes,
154 PacketInfo::kNotAProbe)); 157 PacketInfo::kNotAProbe));
155 158
159 // Only one module has BWE extensions.
160 EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(true));
161 EXPECT_CALL(rtp_1, HasBweExtensions()).Times(1).WillOnce(Return(false));
162 EXPECT_CALL(rtp_1, TimeToSendPadding(requested_padding_bytes, _)).Times(0);
163 EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(true));
164 EXPECT_CALL(rtp_2, HasBweExtensions()).Times(1).WillOnce(Return(true));
165 EXPECT_CALL(rtp_2, TimeToSendPadding(requested_padding_bytes, _))
166 .Times(1)
167 .WillOnce(Return(sent_padding_bytes));
168 EXPECT_EQ(sent_padding_bytes,
169 packet_router_->TimeToSendPadding(requested_padding_bytes,
170 PacketInfo::kNotAProbe));
171
156 packet_router_->RemoveRtpModule(&rtp_1); 172 packet_router_->RemoveRtpModule(&rtp_1);
157 173
158 // rtp_1 has been removed, try sending padding and make sure rtp_1 isn't asked 174 // rtp_1 has been removed, try sending padding and make sure rtp_1 isn't asked
159 // to send by not expecting any calls. Instead verify rtp_2 is called. 175 // to send by not expecting any calls. Instead verify rtp_2 is called.
160 EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(true)); 176 EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(true));
177 EXPECT_CALL(rtp_2, HasBweExtensions()).Times(1).WillOnce(Return(true));
161 EXPECT_CALL(rtp_2, TimeToSendPadding(requested_padding_bytes, _)).Times(1); 178 EXPECT_CALL(rtp_2, TimeToSendPadding(requested_padding_bytes, _)).Times(1);
162 EXPECT_EQ(0u, packet_router_->TimeToSendPadding(requested_padding_bytes, 179 EXPECT_EQ(0u, packet_router_->TimeToSendPadding(requested_padding_bytes,
163 PacketInfo::kNotAProbe)); 180 PacketInfo::kNotAProbe));
164 181
165 packet_router_->RemoveRtpModule(&rtp_2); 182 packet_router_->RemoveRtpModule(&rtp_2);
166 } 183 }
167 184
168 TEST_F(PacketRouterTest, SenderOnlyFunctionsRespectSendingMedia) { 185 TEST_F(PacketRouterTest, SenderOnlyFunctionsRespectSendingMedia) {
169 MockRtpRtcp rtp; 186 MockRtpRtcp rtp;
170 packet_router_->AddRtpModule(&rtp); 187 packet_router_->AddRtpModule(&rtp);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 221
205 rtcp::TransportFeedback feedback; 222 rtcp::TransportFeedback feedback;
206 EXPECT_CALL(rtp_1, SendFeedbackPacket(_)).Times(1); 223 EXPECT_CALL(rtp_1, SendFeedbackPacket(_)).Times(1);
207 packet_router_->SendFeedback(&feedback); 224 packet_router_->SendFeedback(&feedback);
208 packet_router_->RemoveRtpModule(&rtp_1); 225 packet_router_->RemoveRtpModule(&rtp_1);
209 EXPECT_CALL(rtp_2, SendFeedbackPacket(_)).Times(1); 226 EXPECT_CALL(rtp_2, SendFeedbackPacket(_)).Times(1);
210 packet_router_->SendFeedback(&feedback); 227 packet_router_->SendFeedback(&feedback);
211 packet_router_->RemoveRtpModule(&rtp_2); 228 packet_router_->RemoveRtpModule(&rtp_2);
212 } 229 }
213 } // namespace webrtc 230 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/pacing/packet_router.cc ('k') | webrtc/modules/rtp_rtcp/include/rtp_rtcp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698