Releand of Let ViEEncoder handle resolution changes.
The original landed cl is in patchset 1.
The following patchset fix VideoQualityTest as well as fix the case where max_bitrate is set in the SendParams. A unit test is added for that as well.
Original cl description:
Let ViEEncoder handle resolution changes.
This cl move codec reconfiguration due to video frame size changes from WebRtcVideoSendStream to ViEEncoder.
With this change, many variables in WebRtcVideoSendStream no longer need to be locked.
BUG=webrtc:5687, webrtc:6371, webrtc:5332
Review-Url: https://codereview.webrtc.org/2386573002
Cr-Commit-Position: refs/heads/master@{#14467}
diff --git a/webrtc/video/video_quality_test.cc b/webrtc/video/video_quality_test.cc
index 41054db..4ac86d1 100644
--- a/webrtc/video/video_quality_test.cc
+++ b/webrtc/video/video_quality_test.cc
@@ -93,6 +93,23 @@
voe->voice_engine = nullptr;
}
+class VideoStreamFactory
+ : public webrtc::VideoEncoderConfig::VideoStreamFactoryInterface {
+ public:
+ explicit VideoStreamFactory(const std::vector<webrtc::VideoStream>& streams)
+ : streams_(streams) {}
+
+ private:
+ std::vector<webrtc::VideoStream> CreateEncoderStreams(
+ int width,
+ int height,
+ const webrtc::VideoEncoderConfig& encoder_config) override {
+ return streams_;
+ }
+
+ std::vector<webrtc::VideoStream> streams_;
+};
+
} // namespace
namespace webrtc {
@@ -1014,7 +1031,16 @@
video_encoder_config_.min_transmit_bitrate_bps =
params_.common.min_transmit_bps;
- video_encoder_config_.streams = params_.ss.streams;
+
+ video_encoder_config_.number_of_streams = params_.ss.streams.size();
+ video_encoder_config_.max_bitrate_bps = 0;
+ for (size_t i = 0; i < params_.ss.streams.size(); ++i) {
+ video_encoder_config_.max_bitrate_bps +=
+ params_.ss.streams[i].max_bitrate_bps;
+ }
+ video_encoder_config_.video_stream_factory =
+ new rtc::RefCountedObject<VideoStreamFactory>(params_.ss.streams);
+
video_encoder_config_.spatial_layers = params_.ss.spatial_layers;
CreateMatchingReceiveConfigs(recv_transport);