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

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

Issue 2947633003: Allow parsing empty RTCP TargetBitrate messages, but stop sending them. (Closed)
Patch Set: Add comment about using ToString only in tests Created 3 years, 6 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/video/payload_router.cc ('k') | no next file » | 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 BitrateAllocation layer1_bitrate; 171 BitrateAllocation layer1_bitrate;
172 layer1_bitrate.SetBitrate(0, 0, 40000); 172 layer1_bitrate.SetBitrate(0, 0, 40000);
173 layer1_bitrate.SetBitrate(0, 1, 80000); 173 layer1_bitrate.SetBitrate(0, 1, 80000);
174 174
175 EXPECT_CALL(rtp_1, SetVideoBitrateAllocation(layer0_bitrate)).Times(1); 175 EXPECT_CALL(rtp_1, SetVideoBitrateAllocation(layer0_bitrate)).Times(1);
176 EXPECT_CALL(rtp_2, SetVideoBitrateAllocation(layer1_bitrate)).Times(1); 176 EXPECT_CALL(rtp_2, SetVideoBitrateAllocation(layer1_bitrate)).Times(1);
177 177
178 payload_router.OnBitrateAllocationUpdated(bitrate); 178 payload_router.OnBitrateAllocationUpdated(bitrate);
179 } 179 }
180 180
181 TEST(PayloadRouterTest, SimulcastTargetBitrateWithInactiveStream) {
182 // Set up two active rtp modules.
183 NiceMock<MockRtpRtcp> rtp_1;
184 NiceMock<MockRtpRtcp> rtp_2;
185 std::vector<RtpRtcp*> modules;
186 modules.push_back(&rtp_1);
187 modules.push_back(&rtp_2);
188 PayloadRouter payload_router(modules, 42);
189 payload_router.SetActive(true);
190
191 // Create bitrate allocation with bitrate only for the first stream.
192 BitrateAllocation bitrate;
193 bitrate.SetBitrate(0, 0, 10000);
194 bitrate.SetBitrate(0, 1, 20000);
195
196 // Expect only the first rtp module to be asked to send a TargetBitrate
197 // message. (No target bitrate with 0bps sent from the second one.)
198 EXPECT_CALL(rtp_1, SetVideoBitrateAllocation(bitrate)).Times(1);
199 EXPECT_CALL(rtp_2, SetVideoBitrateAllocation(_)).Times(0);
200
201 payload_router.OnBitrateAllocationUpdated(bitrate);
202 }
203
181 TEST(PayloadRouterTest, SvcTargetBitrate) { 204 TEST(PayloadRouterTest, SvcTargetBitrate) {
182 NiceMock<MockRtpRtcp> rtp_1; 205 NiceMock<MockRtpRtcp> rtp_1;
183 std::vector<RtpRtcp*> modules; 206 std::vector<RtpRtcp*> modules;
184 modules.push_back(&rtp_1); 207 modules.push_back(&rtp_1);
185 PayloadRouter payload_router(modules, 42); 208 PayloadRouter payload_router(modules, 42);
186 payload_router.SetActive(true); 209 payload_router.SetActive(true);
187 210
188 BitrateAllocation bitrate; 211 BitrateAllocation bitrate;
189 bitrate.SetBitrate(0, 0, 10000); 212 bitrate.SetBitrate(0, 0, 10000);
190 bitrate.SetBitrate(0, 1, 20000); 213 bitrate.SetBitrate(0, 1, 20000);
191 bitrate.SetBitrate(1, 0, 40000); 214 bitrate.SetBitrate(1, 0, 40000);
192 bitrate.SetBitrate(1, 1, 80000); 215 bitrate.SetBitrate(1, 1, 80000);
193 216
194 EXPECT_CALL(rtp_1, SetVideoBitrateAllocation(bitrate)).Times(1); 217 EXPECT_CALL(rtp_1, SetVideoBitrateAllocation(bitrate)).Times(1);
195 218
196 payload_router.OnBitrateAllocationUpdated(bitrate); 219 payload_router.OnBitrateAllocationUpdated(bitrate);
197 } 220 }
198 221
199 } // namespace webrtc 222 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/payload_router.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698