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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc

Issue 2122863002: TransportFeedback must be able to start with dropped packets. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Nit Created 4 years, 5 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
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
11 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 #include "webrtc/modules/pacing/packet_router.h" 14 #include "webrtc/modules/pacing/packet_router.h"
15 #include "webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h" 15 #include "webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h"
16 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" 16 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
17 #include "webrtc/system_wrappers/include/clock.h" 17 #include "webrtc/system_wrappers/include/clock.h"
18 18
19 using ::testing::_; 19 using ::testing::_;
20 using ::testing::InSequence; 20 using ::testing::InSequence;
21 using ::testing::Invoke; 21 using ::testing::Invoke;
22 using ::testing::Return;
22 23
23 namespace webrtc { 24 namespace webrtc {
24 25
25 class MockPacketRouter : public PacketRouter { 26 class MockPacketRouter : public PacketRouter {
26 public: 27 public:
27 MOCK_METHOD1(SendFeedback, bool(rtcp::TransportFeedback* packet)); 28 MOCK_METHOD1(SendFeedback, bool(rtcp::TransportFeedback* packet));
28 }; 29 };
29 30
30 class RemoteEstimatorProxyTest : public ::testing::Test { 31 class RemoteEstimatorProxyTest : public ::testing::Test {
31 public: 32 public:
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 status_vec[0]); 101 status_vec[0]);
101 std::vector<int64_t> delta_vec = packet->GetReceiveDeltasUs(); 102 std::vector<int64_t> delta_vec = packet->GetReceiveDeltasUs();
102 EXPECT_EQ(1u, delta_vec.size()); 103 EXPECT_EQ(1u, delta_vec.size());
103 EXPECT_EQ(kBaseTimeMs, (packet->GetBaseTimeUs() + delta_vec[0]) / 1000); 104 EXPECT_EQ(kBaseTimeMs, (packet->GetBaseTimeUs() + delta_vec[0]) / 1000);
104 return true; 105 return true;
105 })); 106 }));
106 107
107 Process(); 108 Process();
108 } 109 }
109 110
111 TEST_F(RemoteEstimatorProxyTest, FeedbackWithMissingStart) {
112 // First feedback.
113 IncomingPacket(kBaseSeq, kBaseTimeMs);
114 IncomingPacket(kBaseSeq + 1, kBaseTimeMs + 1000);
115 EXPECT_CALL(router_, SendFeedback(_)).Times(1).WillOnce(Return(true));
116 Process();
117
118 // Second feedback starts with a missing packet (DROP kBaseSeq + 2).
119 IncomingPacket(kBaseSeq + 3, kBaseTimeMs + 3000);
120
121 EXPECT_CALL(router_, SendFeedback(_))
122 .Times(1)
123 .WillOnce(Invoke([this](rtcp::TransportFeedback* packet) {
124 packet->Build();
125 EXPECT_EQ(kBaseSeq + 2, packet->GetBaseSequence());
126 EXPECT_EQ(kMediaSsrc, packet->GetMediaSourceSsrc());
127
128 std::vector<rtcp::TransportFeedback::StatusSymbol> status_vec =
129 packet->GetStatusVector();
130 EXPECT_EQ(2u, status_vec.size());
131 EXPECT_EQ(rtcp::TransportFeedback::StatusSymbol::kNotReceived,
132 status_vec[0]);
133 EXPECT_EQ(rtcp::TransportFeedback::StatusSymbol::kReceivedSmallDelta,
134 status_vec[1]);
135 std::vector<int64_t> delta_vec = packet->GetReceiveDeltasUs();
136 EXPECT_EQ(1u, delta_vec.size());
137 EXPECT_EQ(kBaseTimeMs + 3000,
138 (packet->GetBaseTimeUs() + delta_vec[0]) / 1000);
139 return true;
140 }));
141
142 Process();
143 }
144
110 TEST_F(RemoteEstimatorProxyTest, SendsFeedbackWithVaryingDeltas) { 145 TEST_F(RemoteEstimatorProxyTest, SendsFeedbackWithVaryingDeltas) {
111 IncomingPacket(kBaseSeq, kBaseTimeMs); 146 IncomingPacket(kBaseSeq, kBaseTimeMs);
112 IncomingPacket(kBaseSeq + 1, kBaseTimeMs + kMaxSmallDeltaMs); 147 IncomingPacket(kBaseSeq + 1, kBaseTimeMs + kMaxSmallDeltaMs);
113 IncomingPacket(kBaseSeq + 2, kBaseTimeMs + (2 * kMaxSmallDeltaMs) + 1); 148 IncomingPacket(kBaseSeq + 2, kBaseTimeMs + (2 * kMaxSmallDeltaMs) + 1);
114 149
115 EXPECT_CALL(router_, SendFeedback(_)) 150 EXPECT_CALL(router_, SendFeedback(_))
116 .Times(1) 151 .Times(1)
117 .WillOnce(Invoke([this](rtcp::TransportFeedback* packet) { 152 .WillOnce(Invoke([this](rtcp::TransportFeedback* packet) {
118 packet->Build(); 153 packet->Build();
119 EXPECT_EQ(kBaseSeq, packet->GetBaseSequence()); 154 EXPECT_EQ(kBaseSeq, packet->GetBaseSequence());
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 (packet->GetBaseTimeUs() + delta_vec[0]) / 1000); 323 (packet->GetBaseTimeUs() + delta_vec[0]) / 1000);
289 EXPECT_EQ(kTimeoutTimeMs - kBaseTimeMs, delta_vec[1] / 1000); 324 EXPECT_EQ(kTimeoutTimeMs - kBaseTimeMs, delta_vec[1] / 1000);
290 EXPECT_EQ(1, delta_vec[2] / 1000); 325 EXPECT_EQ(1, delta_vec[2] / 1000);
291 return true; 326 return true;
292 })); 327 }));
293 328
294 Process(); 329 Process();
295 } 330 }
296 331
297 } // namespace webrtc 332 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698