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

Unified Diff: webrtc/call/rampup_tests.cc

Issue 2351633002: Let ViEEncoder handle resolution changes. (Closed)
Patch Set: fix line ending. Created 4 years, 3 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/call/rampup_tests.cc
diff --git a/webrtc/call/rampup_tests.cc b/webrtc/call/rampup_tests.cc
index 2d7dddc1d839e0ecb1bd6704ba0cbef397060f84..1a25409f0c1962caff782888048d913b0ee688a4 100644
--- a/webrtc/call/rampup_tests.cc
+++ b/webrtc/call/rampup_tests.cc
@@ -14,6 +14,7 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/platform_thread.h"
#include "webrtc/test/testsupport/perf_test.h"
+#include "webrtc/test/encoder_settings.h"
mflodman 2016/09/27 11:28:00 Alphabetic order.
perkj_webrtc 2016/09/27 13:45:17 Done.
namespace webrtc {
namespace {
@@ -96,24 +97,49 @@ size_t RampUpTester::GetNumAudioStreams() const {
return num_audio_streams_;
}
+class RampUpTester::VideoStreamFactory
+ : public VideoEncoderConfig::VideoStreamFactoryInterface {
+ public:
+ VideoStreamFactory() {}
+
+ private:
+ std::vector<VideoStream> CreateEncoderStreams(
+ int width,
+ int height,
+ const VideoEncoderConfig& encoder_config) override {
+ RTC_DCHECK_EQ(width, test::CallTest::kDefaultWidth);
+ RTC_DCHECK_EQ(height, test::CallTest::kDefaultHeight);
+ std::vector<VideoStream> streams =
+ test::CreateVideoStreams(width, height, encoder_config);
+ if (encoder_config.number_of_streams == 1) {
+ streams[0].target_bitrate_bps = streams[0].max_bitrate_bps = 2000000;
+ }
+ return streams;
+ }
+};
+
void RampUpTester::ModifyVideoConfigs(
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStream::Config>* receive_configs,
VideoEncoderConfig* encoder_config) {
send_config->suspend_below_min_bitrate = true;
-
+ encoder_config->number_of_streams = num_video_streams_;
+ encoder_config->max_bitrate_bps = 2000000;
+ encoder_config->encoder_stream_factory =
+ new rtc::RefCountedObject<RampUpTester::VideoStreamFactory>();
if (num_video_streams_ == 1) {
- encoder_config->streams[0].target_bitrate_bps =
- encoder_config->streams[0].max_bitrate_bps = 2000000;
// For single stream rampup until 1mbps
expected_bitrate_bps_ = kSingleStreamTargetBps;
} else {
// For multi stream rampup until all streams are being sent. That means
- // enough birate to send all the target streams plus the min bitrate of
+ // enough bitrate to send all the target streams plus the min bitrate of
// the last one.
- expected_bitrate_bps_ = encoder_config->streams.back().min_bitrate_bps;
- for (size_t i = 0; i < encoder_config->streams.size() - 1; ++i) {
- expected_bitrate_bps_ += encoder_config->streams[i].target_bitrate_bps;
+ std::vector<VideoStream> streams = test::CreateVideoStreams(
+ test::CallTest::kDefaultWidth, test::CallTest::kDefaultHeight,
+ *encoder_config);
+ expected_bitrate_bps_ = streams.back().min_bitrate_bps;
+ for (size_t i = 0; i < streams.size() - 1; ++i) {
+ expected_bitrate_bps_ += streams[i].target_bitrate_bps;
}
}

Powered by Google App Engine
This is Rietveld 408576698