Revert "Enables/disables simulcast streams by allocating a bitrate of 0 to the spatial layer."

This reverts commit 18c4261339dc76b220e7c805e36b4ea6f3dd161d.

Reason for revert: Broke internal tests

Original change's description:
> Enables/disables simulcast streams by allocating a bitrate of 0 to the spatial layer.
> 
> Creates VideoStreams & VideoCodec.simulcastStreams with an active field, and then allocates 0 bitrate to simulcast streams that are inactive. This turns off the encoder for specific simulcast streams.
> 
> Bug: webrtc:8653
> Change-Id: Id93b03dcd8d1191a7d3300bd77882c8af96ee469
> Reviewed-on: https://webrtc-review.googlesource.com/37740
> Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Reviewed-by: Erik Språng <sprang@webrtc.org>
> Commit-Queue: Seth Hampson <shampson@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#21646}

TBR=deadbeef@webrtc.org,sprang@webrtc.org,stefan@webrtc.org,shampson@webrtc.org

Change-Id: I0aeb743cbd2e8d564aa732c937587c25a4c49b09
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8653
Reviewed-on: https://webrtc-review.googlesource.com/39883
Reviewed-by: Lu Liu <lliuu@webrtc.org>
Commit-Queue: Lu Liu <lliuu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21647}
This commit is contained in:
Lu Liu
2018-01-17 00:28:14 +00:00
committed by Commit Bot
parent 18c4261339
commit 0f17f9ce28
18 changed files with 76 additions and 516 deletions

View File

@ -118,7 +118,6 @@ class VideoCodecInitializerTest : public ::testing::Test {
stream.target_bitrate_bps = kDefaultTargetBitrateBps;
stream.max_bitrate_bps = kDefaultMaxBitrateBps;
stream.max_qp = kDefaultMaxQp;
stream.active = true;
return stream;
}
@ -129,7 +128,6 @@ class VideoCodecInitializerTest : public ::testing::Test {
stream.max_bitrate_bps = 1000000;
stream.max_framerate = kScreenshareDefaultFramerate;
stream.temporal_layer_thresholds_bps.push_back(kScreenshareTl0BitrateBps);
stream.active = true;
return stream;
}
@ -157,20 +155,6 @@ TEST_F(VideoCodecInitializerTest, SingleStreamVp8Screenshare) {
EXPECT_EQ(kDefaultTargetBitrateBps, bitrate_allocation.get_sum_bps());
}
TEST_F(VideoCodecInitializerTest, SingleStreamVp8ScreenshareInactive) {
SetUpFor(VideoCodecType::kVideoCodecVP8, 1, 1, true);
VideoStream inactive_stream = DefaultStream();
inactive_stream.active = false;
streams_.push_back(inactive_stream);
EXPECT_TRUE(InitializeCodec());
BitrateAllocation bitrate_allocation = bitrate_allocator_out_->GetAllocation(
kDefaultTargetBitrateBps, kDefaultFrameRate);
EXPECT_EQ(1u, codec_out_.numberOfSimulcastStreams);
EXPECT_EQ(1u, codec_out_.VP8()->numberOfTemporalLayers);
EXPECT_EQ(0U, bitrate_allocation.get_sum_bps());
}
TEST_F(VideoCodecInitializerTest, TemporalLayeredVp8Screenshare) {
SetUpFor(VideoCodecType::kVideoCodecVP8, 1, 2, true);
streams_.push_back(DefaultScreenshareStream());
@ -185,7 +169,7 @@ TEST_F(VideoCodecInitializerTest, TemporalLayeredVp8Screenshare) {
EXPECT_EQ(kScreenshareTl0BitrateBps, bitrate_allocation.GetBitrate(0, 0));
}
TEST_F(VideoCodecInitializerTest, SimulcastVp8Screenshare) {
TEST_F(VideoCodecInitializerTest, SimlucastVp8Screenshare) {
SetUpFor(VideoCodecType::kVideoCodecVP8, 2, 1, true);
streams_.push_back(DefaultScreenshareStream());
VideoStream video_stream = DefaultStream();
@ -206,31 +190,7 @@ TEST_F(VideoCodecInitializerTest, SimulcastVp8Screenshare) {
bitrate_allocation.GetSpatialLayerSum(1));
}
// Tests that when a video stream is inactive, then the bitrate allocation will
// be 0 for that stream.
TEST_F(VideoCodecInitializerTest, SimulcastVp8ScreenshareInactive) {
SetUpFor(VideoCodecType::kVideoCodecVP8, 2, 1, true);
streams_.push_back(DefaultScreenshareStream());
VideoStream inactive_video_stream = DefaultStream();
inactive_video_stream.active = false;
inactive_video_stream.max_framerate = kScreenshareDefaultFramerate;
streams_.push_back(inactive_video_stream);
EXPECT_TRUE(InitializeCodec());
EXPECT_EQ(2u, codec_out_.numberOfSimulcastStreams);
EXPECT_EQ(1u, codec_out_.VP8()->numberOfTemporalLayers);
const uint32_t target_bitrate =
streams_[0].target_bitrate_bps + streams_[1].target_bitrate_bps;
BitrateAllocation bitrate_allocation = bitrate_allocator_out_->GetAllocation(
target_bitrate, kScreenshareDefaultFramerate);
EXPECT_EQ(static_cast<uint32_t>(streams_[0].max_bitrate_bps),
bitrate_allocation.get_sum_bps());
EXPECT_EQ(static_cast<uint32_t>(streams_[0].max_bitrate_bps),
bitrate_allocation.GetSpatialLayerSum(0));
EXPECT_EQ(0U, bitrate_allocation.GetSpatialLayerSum(1));
}
TEST_F(VideoCodecInitializerTest, HighFpsSimulcastVp8Screenshare) {
TEST_F(VideoCodecInitializerTest, HighFpsSimlucastVp8Screenshare) {
// Two simulcast streams, the lower one using legacy settings (two temporal
// streams, 5fps), the higher one using 3 temporal streams and 30fps.
SetUpFor(VideoCodecType::kVideoCodecVP8, 2, 3, true);