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

Unified Diff: webrtc/modules/rtp_rtcp/source/playout_delay_oracle_unittest.cc

Issue 2007743003: Add sender controlled playout delay limits (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@cleanup_rtp_hdr_extensions
Patch Set: Rename OnReceivedRtcpReport to OnReceivedRtcpReportBlocks Created 4 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/playout_delay_oracle_unittest.cc
diff --git a/webrtc/modules/rtp_rtcp/source/playout_delay_oracle_unittest.cc b/webrtc/modules/rtp_rtcp/source/playout_delay_oracle_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..efcb4512e1ec3002a3cc87b86b3639cda10c3431
--- /dev/null
+++ b/webrtc/modules/rtp_rtcp/source/playout_delay_oracle_unittest.cc
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "webrtc/base/logging.h"
+
+namespace webrtc {
+
+namespace {
+constexpr int kSsrc = 100;
+constexpr int kSequenceNumber = 100;
+constexpr int kMinPlayoutDelay = 0;
+constexpr int kMaxPlayoutDelay = 150;
+} // namespace
+
+class PlayoutDelayOracleTest : public ::testing::Test {
+ protected:
+ void ReportRTCPFeedback(int ssrc, int seq_num) {
+ RTCPReportBlock report_block;
+ report_block.sourceSSRC = ssrc;
+ report_block.extendedHighSeqNum = seq_num;
+ report_blocks_.push_back(report_block);
+ playout_delay_oracle_.OnReceivedRtcpReportBlocks(report_blocks_);
+ }
+
+ ReportBlockList report_blocks_;
+ PlayoutDelayOracle playout_delay_oracle_;
+};
+
+TEST_F(PlayoutDelayOracleTest, DisabledByDefault) {
+ EXPECT_FALSE(playout_delay_oracle_.send_playout_delay());
+ EXPECT_EQ(playout_delay_oracle_.min_playout_delay_ms(), -1);
+ EXPECT_EQ(playout_delay_oracle_.max_playout_delay_ms(), -1);
+}
+
+TEST_F(PlayoutDelayOracleTest, SendPlayoutDelayUntilSeqNumberExceeds) {
+ PlayoutDelay playout_delay = {kMinPlayoutDelay, kMaxPlayoutDelay};
+ playout_delay_oracle_.UpdateRequest(kSsrc, playout_delay, kSequenceNumber);
+ EXPECT_TRUE(playout_delay_oracle_.send_playout_delay());
+ EXPECT_EQ(playout_delay_oracle_.min_playout_delay_ms(), kMinPlayoutDelay);
+ EXPECT_EQ(playout_delay_oracle_.max_playout_delay_ms(), kMaxPlayoutDelay);
+
+ // Oracle indicates playout delay should be sent if highest sequence number
+ // acked is lower than the sequence number of the first packet containing
+ // playout delay.
+ ReportRTCPFeedback(kSsrc, kSequenceNumber - 1);
+ EXPECT_TRUE(playout_delay_oracle_.send_playout_delay());
+
+ // An invalid ssrc feedback report is dropped by the oracle.
+ ReportRTCPFeedback(kSsrc + 1, kSequenceNumber + 1);
+ EXPECT_TRUE(playout_delay_oracle_.send_playout_delay());
+
+ // Oracle indicates playout delay should not be sent if sequence number
+ // acked on a matching ssrc indicates the receiver has received the playout
+ // delay values.
+ ReportRTCPFeedback(kSsrc, kSequenceNumber + 1);
+ EXPECT_FALSE(playout_delay_oracle_.send_playout_delay());
+}
+
+} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698