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

Unified Diff: webrtc/modules/video_coding/media_optimization_unittest.cc

Issue 1972083002: Move logic for calculating needed bitrate overhead used by NACK and FEC to VideoSender. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed Åsas comments. Created 4 years, 7 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/video_coding/media_optimization_unittest.cc
diff --git a/webrtc/modules/video_coding/media_optimization_unittest.cc b/webrtc/modules/video_coding/media_optimization_unittest.cc
index e6a1bcccd96572f58681c222a2f93a0602d3cc63..2263099f238b119e2a69e768a1ae0bc5361c5b26 100644
--- a/webrtc/modules/video_coding/media_optimization_unittest.cc
+++ b/webrtc/modules/video_coding/media_optimization_unittest.cc
@@ -64,9 +64,8 @@ TEST_F(TestMediaOptimization, VerifyMuting) {
uint32_t target_bitrate_kbps = 100;
media_opt_.SetTargetRates(target_bitrate_kbps * 1000,
- 0, // Lossrate.
- 100, // RTT in ms.
- nullptr);
+ 0, // Lossrate.
+ 100); // RTT in ms.
media_opt_.EnableFrameDropper(true);
for (int time = 0; time < 2000; time += frame_time_ms_) {
ASSERT_NO_FATAL_FAILURE(AddFrameAndAdvanceTime(target_bitrate_kbps, false));
@@ -74,9 +73,8 @@ TEST_F(TestMediaOptimization, VerifyMuting) {
// Set the target rate below the limit for muting.
media_opt_.SetTargetRates(kThresholdBps - 1000,
- 0, // Lossrate.
- 100, // RTT in ms.
- nullptr);
+ 0, // Lossrate.
+ 100); // RTT in ms.
// Expect the muter to engage immediately and stay muted.
// Test during 2 seconds.
for (int time = 0; time < 2000; time += frame_time_ms_) {
@@ -87,9 +85,8 @@ TEST_F(TestMediaOptimization, VerifyMuting) {
// Set the target above the limit for muting, but not above the
// limit + window.
media_opt_.SetTargetRates(kThresholdBps + 1000,
- 0, // Lossrate.
- 100, // RTT in ms.
- nullptr);
+ 0, // Lossrate.
+ 100); // RTT in ms.
// Expect the muter to stay muted.
// Test during 2 seconds.
for (int time = 0; time < 2000; time += frame_time_ms_) {
@@ -99,9 +96,8 @@ TEST_F(TestMediaOptimization, VerifyMuting) {
// Set the target above limit + window.
media_opt_.SetTargetRates(kThresholdBps + kWindowBps + 1000,
- 0, // Lossrate.
- 100, // RTT in ms.
- nullptr);
+ 0, // Lossrate.
+ 100); // RTT in ms.
// Expect the muter to disengage immediately.
// Test during 2 seconds.
for (int time = 0; time < 2000; time += frame_time_ms_) {
@@ -111,44 +107,5 @@ TEST_F(TestMediaOptimization, VerifyMuting) {
}
}
-TEST_F(TestMediaOptimization, ProtectsUsingFecBitrateAboveCodecMax) {
- static const int kCodecBitrateBps = 100000;
- static const int kMaxBitrateBps = 130000;
-
- class ProtectionCallback : public VCMProtectionCallback {
- int ProtectionRequest(const FecProtectionParams* delta_params,
- const FecProtectionParams* key_params,
- uint32_t* sent_video_rate_bps,
- uint32_t* sent_nack_rate_bps,
- uint32_t* sent_fec_rate_bps) override {
- *sent_video_rate_bps = kCodecBitrateBps;
- *sent_nack_rate_bps = 0;
- *sent_fec_rate_bps = fec_rate_bps_;
- return 0;
- }
-
- public:
- uint32_t fec_rate_bps_;
- } protection_callback;
-
- media_opt_.SetProtectionMethod(kFec);
- media_opt_.SetEncodingData(kVideoCodecVP8, kCodecBitrateBps, kCodecBitrateBps,
- 640, 480, 30, 1, 1000);
-
- // Using 10% of codec bitrate for FEC, should still be able to use all of it.
- protection_callback.fec_rate_bps_ = kCodecBitrateBps / 10;
- uint32_t target_bitrate = media_opt_.SetTargetRates(
- kMaxBitrateBps, 0, 0, &protection_callback);
-
- EXPECT_EQ(kCodecBitrateBps, static_cast<int>(target_bitrate));
-
- // Using as much for codec bitrate as fec rate, new target rate should share
- // both equally, but only be half of max (since that ceiling should be hit).
- protection_callback.fec_rate_bps_ = kCodecBitrateBps;
- target_bitrate = media_opt_.SetTargetRates(kMaxBitrateBps, 128, 100,
- &protection_callback);
- EXPECT_EQ(kMaxBitrateBps / 2, static_cast<int>(target_bitrate));
-}
-
} // namespace media_optimization
} // namespace webrtc
« no previous file with comments | « webrtc/modules/video_coding/media_optimization.cc ('k') | webrtc/modules/video_coding/protection_bitrate_calculator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698