Revert "Updates tests for turning simulcast streams on/off."

This reverts commit 8fb22e71ee9bd77676838c5723f7e89a74a64aa9.

Reason for revert: breaks downstream projects

Original change's description:
> Updates tests for turning simulcast streams on/off.
> 
> Due to libvpx we were restricted to always turning the low simulcast
> stream on, or else the encoder would always label the active streams'
> encoded frames as key frames. Now that libvpx has been updated and
> rolled in, this change updates tests to reflect that it is working.
> 
> Bug: webrtc:8653
> Change-Id: I065ef817ace2292605e27e135802cf4a3e90647e
> Reviewed-on: https://webrtc-review.googlesource.com/46340
> 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@{#21831}

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

Change-Id: If14074a7fc56c83b75584d8e9a6a913a40514bad
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8653
Reviewed-on: https://webrtc-review.googlesource.com/46840
Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21832}
This commit is contained in:
Oleh Prypin
2018-01-31 22:11:06 +00:00
committed by Commit Bot
parent 8fb22e71ee
commit 6ade76d69d

View File

@ -284,23 +284,6 @@ class TestVp8Simulcast : public ::testing::Test {
rate_allocator_->GetAllocation(bitrate_kbps * 1000, fps), fps); rate_allocator_->GetAllocation(bitrate_kbps * 1000, fps), fps);
} }
void RunActiveStreamsTest(const std::vector<bool> active_streams) {
std::vector<FrameType> frame_types(kNumberOfSimulcastStreams,
kVideoFrameDelta);
UpdateActiveStreams(active_streams);
// Set sufficient bitrate for all streams so we can test active without
// bitrate being an issue.
SetRates(kMaxBitrates[0] + kMaxBitrates[1] + kMaxBitrates[2], 30);
ExpectStreams(kVideoFrameKey, active_streams);
input_frame_->set_timestamp(input_frame_->timestamp() + 3000);
EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, &frame_types));
ExpectStreams(kVideoFrameDelta, active_streams);
input_frame_->set_timestamp(input_frame_->timestamp() + 3000);
EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, &frame_types));
}
void UpdateActiveStreams(const std::vector<bool> active_streams) { void UpdateActiveStreams(const std::vector<bool> active_streams) {
ASSERT_EQ(static_cast<int>(active_streams.size()), ASSERT_EQ(static_cast<int>(active_streams.size()),
kNumberOfSimulcastStreams); kNumberOfSimulcastStreams);
@ -308,10 +291,6 @@ class TestVp8Simulcast : public ::testing::Test {
settings_.simulcastStream[i].active = active_streams[i]; settings_.simulcastStream[i].active = active_streams[i];
} }
// Re initialize the allocator and encoder with the new settings. // Re initialize the allocator and encoder with the new settings.
// TODO(bugs.webrtc.org/8807): Currently, we do a full "hard"
// reconfiguration of the allocator and encoder. When the video bitrate
// allocator has support for updating active streams without a
// reinitialization, we can just call that here instead.
SetUpRateAllocator(); SetUpRateAllocator();
EXPECT_EQ(0, encoder_->InitEncode(&settings_, 1, 1200)); EXPECT_EQ(0, encoder_->InitEncode(&settings_, 1, 1200));
} }
@ -547,22 +526,40 @@ class TestVp8Simulcast : public ::testing::Test {
} }
void TestActiveStreams() { void TestActiveStreams() {
// All streams on. const int kEnoughBitrateAllStreams =
RunActiveStreamsTest({true, true, true}); kMaxBitrates[0] + kMaxBitrates[1] + kMaxBitrates[2];
// All streams off. std::vector<FrameType> frame_types(kNumberOfSimulcastStreams,
RunActiveStreamsTest({false, false, false}); kVideoFrameDelta);
// Low stream off. // TODO(shampson): Currently turning off the base stream causes unexpected
RunActiveStreamsTest({false, true, true}); // behavior in the libvpx encoder. The libvpx encoder labels key frames
// Middle stream off. // based upon the base stream. If the base stream is never enabled, it
RunActiveStreamsTest({true, false, true}); // will continue to spit out encoded images labeled as key frames for the
// High stream off. // other streams that are enabled. Once this is fixed in libvpx, update this
RunActiveStreamsTest({true, true, false}); // test to reflect that change.
// Only low stream turned on.
RunActiveStreamsTest({true, false, false}); // Only turn on the the base stream.
// Only middle stream turned on. std::vector<bool> active_streams = {true, false, false};
RunActiveStreamsTest({false, true, false}); UpdateActiveStreams(active_streams);
// Only high stream turned on. SetRates(kEnoughBitrateAllStreams, 30);
RunActiveStreamsTest({false, false, true}); ExpectStreams(kVideoFrameKey, active_streams);
input_frame_->set_timestamp(input_frame_->timestamp() + 3000);
EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, &frame_types));
ExpectStreams(kVideoFrameDelta, active_streams);
input_frame_->set_timestamp(input_frame_->timestamp() + 3000);
EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, &frame_types));
// Turn off only the middle stream.
active_streams = {true, false, true};
UpdateActiveStreams(active_streams);
SetRates(kEnoughBitrateAllStreams, 30);
ExpectStreams(kVideoFrameKey, active_streams);
input_frame_->set_timestamp(input_frame_->timestamp() + 3000);
EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, &frame_types));
ExpectStreams(kVideoFrameDelta, active_streams);
input_frame_->set_timestamp(input_frame_->timestamp() + 3000);
EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, &frame_types));
} }
void SwitchingToOneStream(int width, int height) { void SwitchingToOneStream(int width, int height) {