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

Side by Side Diff: webrtc/video/video_quality_test.cc

Issue 2936393002: Add cropping to VIEEncoder to match simulcast streams resolution (Closed)
Patch Set: Fix typo Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « webrtc/video/video_quality_test.h ('k') | webrtc/video/vie_encoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #include "webrtc/video/video_quality_test.h" 10 #include "webrtc/video/video_quality_test.h"
(...skipping 11 matching lines...) Expand all
22 #include "webrtc/base/cpu_time.h" 22 #include "webrtc/base/cpu_time.h"
23 #include "webrtc/base/event.h" 23 #include "webrtc/base/event.h"
24 #include "webrtc/base/format_macros.h" 24 #include "webrtc/base/format_macros.h"
25 #include "webrtc/base/memory_usage.h" 25 #include "webrtc/base/memory_usage.h"
26 #include "webrtc/base/optional.h" 26 #include "webrtc/base/optional.h"
27 #include "webrtc/base/platform_file.h" 27 #include "webrtc/base/platform_file.h"
28 #include "webrtc/base/timeutils.h" 28 #include "webrtc/base/timeutils.h"
29 #include "webrtc/call/call.h" 29 #include "webrtc/call/call.h"
30 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 30 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
31 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 31 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
32 #include "webrtc/media/engine/webrtcvideoengine.h"
32 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" 33 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h"
33 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" 34 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
34 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" 35 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h"
35 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" 36 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
36 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" 37 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
37 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" 38 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
38 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" 39 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h"
39 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" 40 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
40 #include "webrtc/system_wrappers/include/cpu_info.h" 41 #include "webrtc/system_wrappers/include/cpu_info.h"
41 #include "webrtc/system_wrappers/include/field_trial.h" 42 #include "webrtc/system_wrappers/include/field_trial.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 double avg_psnr_threshold, 141 double avg_psnr_threshold,
141 double avg_ssim_threshold, 142 double avg_ssim_threshold,
142 int duration_frames, 143 int duration_frames,
143 FILE* graph_data_output_file, 144 FILE* graph_data_output_file,
144 const std::string& graph_title, 145 const std::string& graph_title,
145 uint32_t ssrc_to_analyze, 146 uint32_t ssrc_to_analyze,
146 uint32_t rtx_ssrc_to_analyze, 147 uint32_t rtx_ssrc_to_analyze,
147 size_t selected_stream, 148 size_t selected_stream,
148 int selected_sl, 149 int selected_sl,
149 int selected_tl, 150 int selected_tl,
150 bool is_quick_test_enabled) 151 bool is_quick_test_enabled,
152 Clock* clock)
151 : transport_(transport), 153 : transport_(transport),
152 receiver_(nullptr), 154 receiver_(nullptr),
153 send_stream_(nullptr), 155 send_stream_(nullptr),
154 receive_stream_(nullptr), 156 receive_stream_(nullptr),
155 captured_frame_forwarder_(this), 157 captured_frame_forwarder_(this, clock),
156 test_label_(test_label), 158 test_label_(test_label),
157 graph_data_output_file_(graph_data_output_file), 159 graph_data_output_file_(graph_data_output_file),
158 graph_title_(graph_title), 160 graph_title_(graph_title),
159 ssrc_to_analyze_(ssrc_to_analyze), 161 ssrc_to_analyze_(ssrc_to_analyze),
160 rtx_ssrc_to_analyze_(rtx_ssrc_to_analyze), 162 rtx_ssrc_to_analyze_(rtx_ssrc_to_analyze),
161 selected_stream_(selected_stream), 163 selected_stream_(selected_stream),
162 selected_sl_(selected_sl), 164 selected_sl_(selected_sl),
163 selected_tl_(selected_tl), 165 selected_tl_(selected_tl),
164 pre_encode_proxy_(this), 166 pre_encode_proxy_(this),
165 encode_timing_proxy_(this), 167 encode_timing_proxy_(this),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 213
212 ~VideoAnalyzer() { 214 ~VideoAnalyzer() {
213 for (rtc::PlatformThread* thread : comparison_thread_pool_) { 215 for (rtc::PlatformThread* thread : comparison_thread_pool_) {
214 thread->Stop(); 216 thread->Stop();
215 delete thread; 217 delete thread;
216 } 218 }
217 } 219 }
218 220
219 virtual void SetReceiver(PacketReceiver* receiver) { receiver_ = receiver; } 221 virtual void SetReceiver(PacketReceiver* receiver) { receiver_ = receiver; }
220 222
223 void SetSource(test::VideoCapturer* video_capturer, bool respect_sink_wants) {
224 if (respect_sink_wants)
225 captured_frame_forwarder_.SetSource(video_capturer);
226 rtc::VideoSinkWants wants;
227 video_capturer->AddOrUpdateSink(InputInterface(), wants);
228 }
229
221 void SetSendStream(VideoSendStream* stream) { 230 void SetSendStream(VideoSendStream* stream) {
222 rtc::CritScope lock(&crit_); 231 rtc::CritScope lock(&crit_);
223 RTC_DCHECK(!send_stream_); 232 RTC_DCHECK(!send_stream_);
224 send_stream_ = stream; 233 send_stream_ = stream;
225 } 234 }
226 235
227 void SetReceiveStream(VideoReceiveStream* stream) { 236 void SetReceiveStream(VideoReceiveStream* stream) {
228 rtc::CritScope lock(&crit_); 237 rtc::CritScope lock(&crit_);
229 RTC_DCHECK(!receive_stream_); 238 RTC_DCHECK(!receive_stream_);
230 receive_stream_ = stream; 239 receive_stream_ = stream;
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 if (!is_quick_test_enabled_) { 783 if (!is_quick_test_enabled_) {
775 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); 784 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_);
776 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); 785 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_);
777 } 786 }
778 } 787 }
779 788
780 void PerformFrameComparison(const FrameComparison& comparison) { 789 void PerformFrameComparison(const FrameComparison& comparison) {
781 // Perform expensive psnr and ssim calculations while not holding lock. 790 // Perform expensive psnr and ssim calculations while not holding lock.
782 double psnr = -1.0; 791 double psnr = -1.0;
783 double ssim = -1.0; 792 double ssim = -1.0;
784 if (comparison.reference) { 793 if (comparison.reference && !comparison.dropped) {
785 psnr = I420PSNR(&*comparison.reference, &*comparison.render); 794 psnr = I420PSNR(&*comparison.reference, &*comparison.render);
786 ssim = I420SSIM(&*comparison.reference, &*comparison.render); 795 ssim = I420SSIM(&*comparison.reference, &*comparison.render);
787 } 796 }
788 797
789 rtc::CritScope crit(&comparison_lock_); 798 rtc::CritScope crit(&comparison_lock_);
790 if (graph_data_output_file_) { 799 if (graph_data_output_file_) {
791 samples_.push_back(Sample( 800 samples_.push_back(Sample(
792 comparison.dropped, comparison.input_time_ms, comparison.send_time_ms, 801 comparison.dropped, comparison.input_time_ms, comparison.send_time_ms,
793 comparison.recv_time_ms, comparison.render_time_ms, 802 comparison.recv_time_ms, comparison.render_time_ms,
794 comparison.encoded_frame_size, psnr, ssim)); 803 comparison.encoded_frame_size, psnr, ssim));
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 } 902 }
894 903
895 // Implements VideoSinkInterface to receive captured frames from a 904 // Implements VideoSinkInterface to receive captured frames from a
896 // FrameGeneratorCapturer. Implements VideoSourceInterface to be able to act 905 // FrameGeneratorCapturer. Implements VideoSourceInterface to be able to act
897 // as a source to VideoSendStream. 906 // as a source to VideoSendStream.
898 // It forwards all input frames to the VideoAnalyzer for later comparison and 907 // It forwards all input frames to the VideoAnalyzer for later comparison and
899 // forwards the captured frames to the VideoSendStream. 908 // forwards the captured frames to the VideoSendStream.
900 class CapturedFrameForwarder : public rtc::VideoSinkInterface<VideoFrame>, 909 class CapturedFrameForwarder : public rtc::VideoSinkInterface<VideoFrame>,
901 public rtc::VideoSourceInterface<VideoFrame> { 910 public rtc::VideoSourceInterface<VideoFrame> {
902 public: 911 public:
903 explicit CapturedFrameForwarder(VideoAnalyzer* analyzer) 912 explicit CapturedFrameForwarder(VideoAnalyzer* analyzer, Clock* clock)
904 : analyzer_(analyzer), send_stream_input_(nullptr) {} 913 : analyzer_(analyzer),
914 send_stream_input_(nullptr),
915 video_capturer_(nullptr),
916 clock_(clock) {}
917
918 void SetSource(test::VideoCapturer* video_capturer) {
919 video_capturer_ = video_capturer;
920 }
905 921
906 private: 922 private:
907 void OnFrame(const VideoFrame& video_frame) override { 923 void OnFrame(const VideoFrame& video_frame) override {
908 VideoFrame copy = video_frame; 924 VideoFrame copy = video_frame;
909 // Frames from the capturer does not have a rtp timestamp. 925 // Frames from the capturer does not have a rtp timestamp.
910 // Create one so it can be used for comparison. 926 // Create one so it can be used for comparison.
911 RTC_DCHECK_EQ(0, video_frame.timestamp()); 927 RTC_DCHECK_EQ(0, video_frame.timestamp());
912 if (copy.ntp_time_ms() == 0) 928 if (video_frame.ntp_time_ms() == 0)
913 copy.set_ntp_time_ms(rtc::TimeMillis()); 929 copy.set_ntp_time_ms(clock_->CurrentNtpInMilliseconds());
914 copy.set_timestamp(copy.ntp_time_ms() * 90); 930 copy.set_timestamp(copy.ntp_time_ms() * 90);
915 analyzer_->AddCapturedFrameForComparison(copy); 931 analyzer_->AddCapturedFrameForComparison(copy);
916 rtc::CritScope lock(&crit_); 932 rtc::CritScope lock(&crit_);
917 if (send_stream_input_) 933 if (send_stream_input_)
918 send_stream_input_->OnFrame(copy); 934 send_stream_input_->OnFrame(copy);
919 } 935 }
920 936
921 // Called when |send_stream_.SetSource()| is called. 937 // Called when |send_stream_.SetSource()| is called.
922 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, 938 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
923 const rtc::VideoSinkWants& wants) override { 939 const rtc::VideoSinkWants& wants) override {
924 rtc::CritScope lock(&crit_); 940 rtc::CritScope lock(&crit_);
925 RTC_DCHECK(!send_stream_input_ || send_stream_input_ == sink); 941 RTC_DCHECK(!send_stream_input_ || send_stream_input_ == sink);
926 send_stream_input_ = sink; 942 send_stream_input_ = sink;
943 if (video_capturer_) {
944 video_capturer_->AddOrUpdateSink(this, wants);
945 }
927 } 946 }
928 947
929 // Called by |send_stream_| when |send_stream_.SetSource()| is called. 948 // Called by |send_stream_| when |send_stream_.SetSource()| is called.
930 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override { 949 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override {
931 rtc::CritScope lock(&crit_); 950 rtc::CritScope lock(&crit_);
932 RTC_DCHECK(sink == send_stream_input_); 951 RTC_DCHECK(sink == send_stream_input_);
933 send_stream_input_ = nullptr; 952 send_stream_input_ = nullptr;
934 } 953 }
935 954
936 VideoAnalyzer* const analyzer_; 955 VideoAnalyzer* const analyzer_;
937 rtc::CriticalSection crit_; 956 rtc::CriticalSection crit_;
938 rtc::VideoSinkInterface<VideoFrame>* send_stream_input_ GUARDED_BY(crit_); 957 rtc::VideoSinkInterface<VideoFrame>* send_stream_input_ GUARDED_BY(crit_);
958 test::VideoCapturer* video_capturer_;
959 Clock* clock_;
939 }; 960 };
940 961
941 void AddCapturedFrameForComparison(const VideoFrame& video_frame) { 962 void AddCapturedFrameForComparison(const VideoFrame& video_frame) {
942 rtc::CritScope lock(&crit_); 963 rtc::CritScope lock(&crit_);
943 frames_.push_back(video_frame); 964 frames_.push_back(video_frame);
944 } 965 }
945 966
946 VideoSendStream* send_stream_; 967 VideoSendStream* send_stream_;
947 VideoReceiveStream* receive_stream_; 968 VideoReceiveStream* receive_stream_;
948 CapturedFrameForwarder captured_frame_forwarder_; 969 CapturedFrameForwarder captured_frame_forwarder_;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 stream.temporal_layer_thresholds_bps.clear(); 1251 stream.temporal_layer_thresholds_bps.clear();
1231 stream.temporal_layer_thresholds_bps.insert( 1252 stream.temporal_layer_thresholds_bps.insert(
1232 stream.temporal_layer_thresholds_bps.end(), v.begin() + 7, v.end()); 1253 stream.temporal_layer_thresholds_bps.end(), v.begin() + 7, v.end());
1233 } else { 1254 } else {
1234 // Automatic TL thresholds for more than two layers not supported. 1255 // Automatic TL thresholds for more than two layers not supported.
1235 RTC_CHECK_LE(params->video.num_temporal_layers, 2); 1256 RTC_CHECK_LE(params->video.num_temporal_layers, 2);
1236 } 1257 }
1237 params->ss.streams.push_back(stream); 1258 params->ss.streams.push_back(stream);
1238 } 1259 }
1239 params->ss.selected_stream = selected_stream; 1260 params->ss.selected_stream = selected_stream;
1261 params->ss.infer_streams = false;
1240 1262
1241 params->ss.num_spatial_layers = num_spatial_layers ? num_spatial_layers : 1; 1263 params->ss.num_spatial_layers = num_spatial_layers ? num_spatial_layers : 1;
1242 params->ss.selected_sl = selected_sl; 1264 params->ss.selected_sl = selected_sl;
1243 RTC_CHECK(params->ss.spatial_layers.empty()); 1265 RTC_CHECK(params->ss.spatial_layers.empty());
1244 for (auto descriptor : sl_descriptors) { 1266 for (auto descriptor : sl_descriptors) {
1245 if (descriptor.empty()) 1267 if (descriptor.empty())
1246 continue; 1268 continue;
1247 std::vector<int> v = VideoQualityTest::ParseCSV(descriptor); 1269 std::vector<int> v = VideoQualityTest::ParseCSV(descriptor);
1248 RTC_CHECK_GT(v[2], 0); 1270 RTC_CHECK_GT(v[2], 0);
1249 1271
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 1333
1312 video_send_config_.suspend_below_min_bitrate = 1334 video_send_config_.suspend_below_min_bitrate =
1313 params_.video.suspend_below_min_bitrate; 1335 params_.video.suspend_below_min_bitrate;
1314 1336
1315 video_encoder_config_.number_of_streams = params_.ss.streams.size(); 1337 video_encoder_config_.number_of_streams = params_.ss.streams.size();
1316 video_encoder_config_.max_bitrate_bps = 0; 1338 video_encoder_config_.max_bitrate_bps = 0;
1317 for (size_t i = 0; i < params_.ss.streams.size(); ++i) { 1339 for (size_t i = 0; i < params_.ss.streams.size(); ++i) {
1318 video_encoder_config_.max_bitrate_bps += 1340 video_encoder_config_.max_bitrate_bps +=
1319 params_.ss.streams[i].max_bitrate_bps; 1341 params_.ss.streams[i].max_bitrate_bps;
1320 } 1342 }
1321 video_encoder_config_.video_stream_factory = 1343 if (params_.ss.infer_streams) {
1322 new rtc::RefCountedObject<VideoStreamFactory>(params_.ss.streams); 1344 video_encoder_config_.video_stream_factory =
1345 new rtc::RefCountedObject<cricket::EncoderStreamFactory>(
1346 params_.video.codec, params_.ss.streams[0].max_qp,
1347 params_.video.fps, params_.screenshare.enabled, true);
1348 } else {
1349 video_encoder_config_.video_stream_factory =
1350 new rtc::RefCountedObject<VideoStreamFactory>(params_.ss.streams);
1351 }
1323 1352
1324 video_encoder_config_.spatial_layers = params_.ss.spatial_layers; 1353 video_encoder_config_.spatial_layers = params_.ss.spatial_layers;
1325 1354
1326 CreateMatchingReceiveConfigs(recv_transport); 1355 CreateMatchingReceiveConfigs(recv_transport);
1327 1356
1328 for (size_t i = 0; i < num_video_streams; ++i) { 1357 for (size_t i = 0; i < num_video_streams; ++i) {
1329 video_receive_configs_[i].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; 1358 video_receive_configs_[i].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
1330 video_receive_configs_[i].rtp.rtx_ssrc = kSendRtxSsrcs[i]; 1359 video_receive_configs_[i].rtp.rtx_ssrc = kSendRtxSsrcs[i];
1331 video_receive_configs_[i].rtp.rtx_payload_types[payload_type] = 1360 video_receive_configs_[i].rtp.rtx_payload_types[payload_type] =
1332 kSendRtxPayloadType; 1361 kSendRtxPayloadType;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 thumbnail_send_config.rtp.extensions.push_back(RtpExtension( 1444 thumbnail_send_config.rtp.extensions.push_back(RtpExtension(
1416 RtpExtension::kAbsSendTimeUri, test::kAbsSendTimeExtensionId)); 1445 RtpExtension::kAbsSendTimeUri, test::kAbsSendTimeExtensionId));
1417 } 1446 }
1418 1447
1419 VideoEncoderConfig thumbnail_encoder_config; 1448 VideoEncoderConfig thumbnail_encoder_config;
1420 thumbnail_encoder_config.min_transmit_bitrate_bps = 7500; 1449 thumbnail_encoder_config.min_transmit_bitrate_bps = 7500;
1421 thumbnail_send_config.suspend_below_min_bitrate = 1450 thumbnail_send_config.suspend_below_min_bitrate =
1422 params_.video.suspend_below_min_bitrate; 1451 params_.video.suspend_below_min_bitrate;
1423 thumbnail_encoder_config.number_of_streams = 1; 1452 thumbnail_encoder_config.number_of_streams = 1;
1424 thumbnail_encoder_config.max_bitrate_bps = 50000; 1453 thumbnail_encoder_config.max_bitrate_bps = 50000;
1425 thumbnail_encoder_config.video_stream_factory = 1454 if (params_.ss.infer_streams) {
1426 new rtc::RefCountedObject<VideoStreamFactory>( 1455 thumbnail_encoder_config.video_stream_factory =
1427 std::vector<webrtc::VideoStream>{DefaultThumbnailStream()}); 1456 new rtc::RefCountedObject<VideoStreamFactory>(params_.ss.streams);
1457 } else {
1458 thumbnail_encoder_config.video_stream_factory =
1459 new rtc::RefCountedObject<cricket::EncoderStreamFactory>(
1460 params_.video.codec, params_.ss.streams[0].max_qp,
1461 params_.video.fps, params_.screenshare.enabled, true);
1462 }
1428 thumbnail_encoder_config.spatial_layers = params_.ss.spatial_layers; 1463 thumbnail_encoder_config.spatial_layers = params_.ss.spatial_layers;
1429 1464
1430 VideoReceiveStream::Config thumbnail_receive_config(send_transport); 1465 VideoReceiveStream::Config thumbnail_receive_config(send_transport);
1431 thumbnail_receive_config.rtp.remb = false; 1466 thumbnail_receive_config.rtp.remb = false;
1432 thumbnail_receive_config.rtp.transport_cc = true; 1467 thumbnail_receive_config.rtp.transport_cc = true;
1433 thumbnail_receive_config.rtp.local_ssrc = kReceiverLocalVideoSsrc; 1468 thumbnail_receive_config.rtp.local_ssrc = kReceiverLocalVideoSsrc;
1434 for (const RtpExtension& extension : thumbnail_send_config.rtp.extensions) 1469 for (const RtpExtension& extension : thumbnail_send_config.rtp.extensions)
1435 thumbnail_receive_config.rtp.extensions.push_back(extension); 1470 thumbnail_receive_config.rtp.extensions.push_back(extension);
1436 thumbnail_receive_config.renderer = &fake_renderer_; 1471 thumbnail_receive_config.renderer = &fake_renderer_;
1437 1472
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 } 1592 }
1558 1593
1559 void VideoQualityTest::CreateCapturer() { 1594 void VideoQualityTest::CreateCapturer() {
1560 if (params_.screenshare.enabled) { 1595 if (params_.screenshare.enabled) {
1561 test::FrameGeneratorCapturer* frame_generator_capturer = 1596 test::FrameGeneratorCapturer* frame_generator_capturer =
1562 new test::FrameGeneratorCapturer(clock_, std::move(frame_generator_), 1597 new test::FrameGeneratorCapturer(clock_, std::move(frame_generator_),
1563 params_.video.fps); 1598 params_.video.fps);
1564 EXPECT_TRUE(frame_generator_capturer->Init()); 1599 EXPECT_TRUE(frame_generator_capturer->Init());
1565 video_capturer_.reset(frame_generator_capturer); 1600 video_capturer_.reset(frame_generator_capturer);
1566 } else { 1601 } else {
1567 if (params_.video.clip_name.empty()) { 1602 if (params_.video.clip_name == "Generator") {
1603 video_capturer_.reset(test::FrameGeneratorCapturer::Create(
1604 static_cast<int>(params_.video.width),
1605 static_cast<int>(params_.video.height), params_.video.fps, clock_));
1606 } else if (params_.video.clip_name.empty()) {
1568 video_capturer_.reset(test::VcmCapturer::Create( 1607 video_capturer_.reset(test::VcmCapturer::Create(
1569 params_.video.width, params_.video.height, params_.video.fps, 1608 params_.video.width, params_.video.height, params_.video.fps,
1570 params_.video.capture_device_index)); 1609 params_.video.capture_device_index));
1571 if (!video_capturer_) { 1610 if (!video_capturer_) {
1572 // Failed to get actual camera, use chroma generator as backup. 1611 // Failed to get actual camera, use chroma generator as backup.
1573 video_capturer_.reset(test::FrameGeneratorCapturer::Create( 1612 video_capturer_.reset(test::FrameGeneratorCapturer::Create(
1574 static_cast<int>(params_.video.width), 1613 static_cast<int>(params_.video.width),
1575 static_cast<int>(params_.video.height), params_.video.fps, clock_)); 1614 static_cast<int>(params_.video.height), params_.video.fps, clock_));
1576 } 1615 }
1577 } else { 1616 } else {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 VideoAnalyzer analyzer( 1662 VideoAnalyzer analyzer(
1624 &send_transport, params_.analyzer.test_label, 1663 &send_transport, params_.analyzer.test_label,
1625 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, 1664 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold,
1626 is_quick_test_enabled 1665 is_quick_test_enabled
1627 ? kFramesSentInQuickTest 1666 ? kFramesSentInQuickTest
1628 : params_.analyzer.test_durations_secs * params_.video.fps, 1667 : params_.analyzer.test_durations_secs * params_.video.fps,
1629 graph_data_output_file, graph_title, 1668 graph_data_output_file, graph_title,
1630 kVideoSendSsrcs[params_.ss.selected_stream], 1669 kVideoSendSsrcs[params_.ss.selected_stream],
1631 kSendRtxSsrcs[params_.ss.selected_stream], 1670 kSendRtxSsrcs[params_.ss.selected_stream],
1632 static_cast<size_t>(params_.ss.selected_stream), params.ss.selected_sl, 1671 static_cast<size_t>(params_.ss.selected_stream), params.ss.selected_sl,
1633 params_.video.selected_tl, is_quick_test_enabled); 1672 params_.video.selected_tl, is_quick_test_enabled, clock_);
1634 analyzer.SetReceiver(receiver_call_->Receiver()); 1673 analyzer.SetReceiver(receiver_call_->Receiver());
1635 send_transport.SetReceiver(&analyzer); 1674 send_transport.SetReceiver(&analyzer);
1636 recv_transport.SetReceiver(sender_call_->Receiver()); 1675 recv_transport.SetReceiver(sender_call_->Receiver());
1637 1676
1638 SetupVideo(&analyzer, &recv_transport); 1677 SetupVideo(&analyzer, &recv_transport);
1639 SetupThumbnails(&analyzer, &recv_transport); 1678 SetupThumbnails(&analyzer, &recv_transport);
1640 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; 1679 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer;
1641 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); 1680 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy();
1642 RTC_DCHECK(!video_send_config_.post_encode_callback); 1681 RTC_DCHECK(!video_send_config_.post_encode_callback);
1643 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); 1682 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy();
(...skipping 10 matching lines...) Expand all
1654 degradation_preference_); 1693 degradation_preference_);
1655 1694
1656 SetupThumbnailCapturers(params_.num_thumbnails); 1695 SetupThumbnailCapturers(params_.num_thumbnails);
1657 for (size_t i = 0; i < thumbnail_send_streams_.size(); ++i) { 1696 for (size_t i = 0; i < thumbnail_send_streams_.size(); ++i) {
1658 thumbnail_send_streams_[i]->SetSource(thumbnail_capturers_[i].get(), 1697 thumbnail_send_streams_[i]->SetSource(thumbnail_capturers_[i].get(),
1659 degradation_preference_); 1698 degradation_preference_);
1660 } 1699 }
1661 1700
1662 CreateCapturer(); 1701 CreateCapturer();
1663 1702
1664 rtc::VideoSinkWants wants; 1703 analyzer.SetSource(video_capturer_.get(), params_.ss.infer_streams);
1665 video_capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants);
1666 1704
1667 StartEncodedFrameLogs(video_send_stream_); 1705 StartEncodedFrameLogs(video_send_stream_);
1668 StartEncodedFrameLogs(video_receive_streams_[0]); 1706 StartEncodedFrameLogs(video_receive_streams_[0]);
1669 video_send_stream_->Start(); 1707 video_send_stream_->Start();
1670 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_) 1708 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_)
1671 thumbnail_send_stream->Start(); 1709 thumbnail_send_stream->Start();
1672 for (VideoReceiveStream* receive_stream : video_receive_streams_) 1710 for (VideoReceiveStream* receive_stream : video_receive_streams_)
1673 receive_stream->Start(); 1711 receive_stream->Start();
1674 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) 1712 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_)
1675 receive_stream->Start(); 1713 receive_stream->Start();
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 if (!params_.video.encoded_frame_base_path.empty()) { 1947 if (!params_.video.encoded_frame_base_path.empty()) {
1910 std::ostringstream str; 1948 std::ostringstream str;
1911 str << receive_logs_++; 1949 str << receive_logs_++;
1912 std::string path = 1950 std::string path =
1913 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; 1951 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf";
1914 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), 1952 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path),
1915 10000000); 1953 10000000);
1916 } 1954 }
1917 } 1955 }
1918 } // namespace webrtc 1956 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_quality_test.h ('k') | webrtc/video/vie_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698