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

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

Issue 2655033002: Prioritize video packets when sending padding or preemptive retransmits. (Closed)
Patch Set: . 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/video/video_send_stream.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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 PacketInfo::kNotAProbe)); 101 PacketInfo::kNotAProbe));
102 102
103 packet_router_->RemoveRtpModule(&rtp_2); 103 packet_router_->RemoveRtpModule(&rtp_2);
104 } 104 }
105 105
106 TEST_F(PacketRouterTest, TimeToSendPadding) { 106 TEST_F(PacketRouterTest, TimeToSendPadding) {
107 const uint16_t kSsrc1 = 1234; 107 const uint16_t kSsrc1 = 1234;
108 const uint16_t kSsrc2 = 4567; 108 const uint16_t kSsrc2 = 4567;
109 109
110 MockRtpRtcp rtp_1; 110 MockRtpRtcp rtp_1;
111 EXPECT_CALL(rtp_1, RtxSendStatus()).WillOnce(Return(kRtxOff));
111 EXPECT_CALL(rtp_1, SSRC()).WillRepeatedly(Return(kSsrc1)); 112 EXPECT_CALL(rtp_1, SSRC()).WillRepeatedly(Return(kSsrc1));
112 MockRtpRtcp rtp_2; 113 MockRtpRtcp rtp_2;
114 // rtp_2 will be prioritized for padding.
115 EXPECT_CALL(rtp_2, RtxSendStatus()).WillOnce(Return(kRtxRedundantPayloads));
113 EXPECT_CALL(rtp_2, SSRC()).WillRepeatedly(Return(kSsrc2)); 116 EXPECT_CALL(rtp_2, SSRC()).WillRepeatedly(Return(kSsrc2));
114 packet_router_->AddRtpModule(&rtp_1); 117 packet_router_->AddRtpModule(&rtp_1);
115 packet_router_->AddRtpModule(&rtp_2); 118 packet_router_->AddRtpModule(&rtp_2);
116 119
117 // Default configuration, sending padding on all modules sending media, 120 // Default configuration, sending padding on all modules sending media,
118 // ordered by SSRC. 121 // ordered by priority (based on rtx mode).
119 const size_t requested_padding_bytes = 1000; 122 const size_t requested_padding_bytes = 1000;
120 const size_t sent_padding_bytes = 890; 123 const size_t sent_padding_bytes = 890;
121 EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(true)); 124 EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(true));
122 EXPECT_CALL(rtp_1, TimeToSendPadding(requested_padding_bytes, 111)) 125 EXPECT_CALL(rtp_2, TimeToSendPadding(requested_padding_bytes, 111))
123 .Times(1) 126 .Times(1)
124 .WillOnce(Return(sent_padding_bytes)); 127 .WillOnce(Return(sent_padding_bytes));
125 EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(true)); 128 EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(true));
126 EXPECT_CALL(rtp_2, TimeToSendPadding( 129 EXPECT_CALL(rtp_1, TimeToSendPadding(
127 requested_padding_bytes - sent_padding_bytes, 111)) 130 requested_padding_bytes - sent_padding_bytes, 111))
128 .Times(1) 131 .Times(1)
129 .WillOnce(Return(requested_padding_bytes - sent_padding_bytes)); 132 .WillOnce(Return(requested_padding_bytes - sent_padding_bytes));
130 EXPECT_EQ(requested_padding_bytes, 133 EXPECT_EQ(requested_padding_bytes,
131 packet_router_->TimeToSendPadding(requested_padding_bytes, 111)); 134 packet_router_->TimeToSendPadding(requested_padding_bytes, 111));
132 135
133 // Let only the second module be sending and verify the padding request is 136 // Let only the lower priority module be sending and verify the padding
134 // routed there. 137 // request is routed there.
135 EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(false)); 138 EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(false));
136 EXPECT_CALL(rtp_1, TimeToSendPadding(requested_padding_bytes, _)).Times(0); 139 EXPECT_CALL(rtp_2, TimeToSendPadding(requested_padding_bytes, _)).Times(0);
137 EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(true)); 140 EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(true));
138 EXPECT_CALL(rtp_2, TimeToSendPadding(_, _)) 141 EXPECT_CALL(rtp_1, TimeToSendPadding(_, _))
139 .Times(1) 142 .Times(1)
140 .WillOnce(Return(sent_padding_bytes)); 143 .WillOnce(Return(sent_padding_bytes));
141 EXPECT_EQ(sent_padding_bytes, 144 EXPECT_EQ(sent_padding_bytes,
142 packet_router_->TimeToSendPadding(requested_padding_bytes, 145 packet_router_->TimeToSendPadding(requested_padding_bytes,
143 PacketInfo::kNotAProbe)); 146 PacketInfo::kNotAProbe));
144 147
145 // No sending module at all. 148 // No sending module at all.
146 EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(false)); 149 EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(false));
147 EXPECT_CALL(rtp_1, TimeToSendPadding(requested_padding_bytes, _)).Times(0); 150 EXPECT_CALL(rtp_1, TimeToSendPadding(requested_padding_bytes, _)).Times(0);
148 EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(false)); 151 EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(false));
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 204
202 rtcp::TransportFeedback feedback; 205 rtcp::TransportFeedback feedback;
203 EXPECT_CALL(rtp_1, SendFeedbackPacket(_)).Times(1); 206 EXPECT_CALL(rtp_1, SendFeedbackPacket(_)).Times(1);
204 packet_router_->SendFeedback(&feedback); 207 packet_router_->SendFeedback(&feedback);
205 packet_router_->RemoveRtpModule(&rtp_1); 208 packet_router_->RemoveRtpModule(&rtp_1);
206 EXPECT_CALL(rtp_2, SendFeedbackPacket(_)).Times(1); 209 EXPECT_CALL(rtp_2, SendFeedbackPacket(_)).Times(1);
207 packet_router_->SendFeedback(&feedback); 210 packet_router_->SendFeedback(&feedback);
208 packet_router_->RemoveRtpModule(&rtp_2); 211 packet_router_->RemoveRtpModule(&rtp_2);
209 } 212 }
210 } // namespace webrtc 213 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/pacing/packet_router.cc ('k') | webrtc/video/video_send_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698