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

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

Issue 2966153002: Fix issue with zero rtt reports when using FlexFEC and add perf test. (Closed)
Patch Set: Created 3 years, 5 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/full_stack_tests.cc ('k') | no next file » | 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 const std::string& graph_title, 148 const std::string& graph_title,
149 uint32_t ssrc_to_analyze, 149 uint32_t ssrc_to_analyze,
150 uint32_t rtx_ssrc_to_analyze, 150 uint32_t rtx_ssrc_to_analyze,
151 size_t selected_stream, 151 size_t selected_stream,
152 int selected_sl, 152 int selected_sl,
153 int selected_tl, 153 int selected_tl,
154 bool is_quick_test_enabled, 154 bool is_quick_test_enabled,
155 Clock* clock) 155 Clock* clock)
156 : transport_(transport), 156 : transport_(transport),
157 receiver_(nullptr), 157 receiver_(nullptr),
158 call_(nullptr),
158 send_stream_(nullptr), 159 send_stream_(nullptr),
159 receive_stream_(nullptr), 160 receive_stream_(nullptr),
160 captured_frame_forwarder_(this, clock), 161 captured_frame_forwarder_(this, clock),
161 test_label_(test_label), 162 test_label_(test_label),
162 graph_data_output_file_(graph_data_output_file), 163 graph_data_output_file_(graph_data_output_file),
163 graph_title_(graph_title), 164 graph_title_(graph_title),
164 ssrc_to_analyze_(ssrc_to_analyze), 165 ssrc_to_analyze_(ssrc_to_analyze),
165 rtx_ssrc_to_analyze_(rtx_ssrc_to_analyze), 166 rtx_ssrc_to_analyze_(rtx_ssrc_to_analyze),
166 selected_stream_(selected_stream), 167 selected_stream_(selected_stream),
167 selected_sl_(selected_sl), 168 selected_sl_(selected_sl),
168 selected_tl_(selected_tl), 169 selected_tl_(selected_tl),
169 pre_encode_proxy_(this), 170 pre_encode_proxy_(this),
170 encode_timing_proxy_(this), 171 encode_timing_proxy_(this),
172 last_fec_bytes_(0),
171 frames_to_process_(duration_frames), 173 frames_to_process_(duration_frames),
172 frames_recorded_(0), 174 frames_recorded_(0),
173 frames_processed_(0), 175 frames_processed_(0),
174 dropped_frames_(0), 176 dropped_frames_(0),
175 dropped_frames_before_first_encode_(0), 177 dropped_frames_before_first_encode_(0),
176 dropped_frames_before_rendering_(0), 178 dropped_frames_before_rendering_(0),
177 last_render_time_(0), 179 last_render_time_(0),
178 rtp_timestamp_delta_(0), 180 rtp_timestamp_delta_(0),
179 total_media_bytes_(0), 181 total_media_bytes_(0),
180 first_sending_time_(0), 182 first_sending_time_(0),
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 225
224 virtual void SetReceiver(PacketReceiver* receiver) { receiver_ = receiver; } 226 virtual void SetReceiver(PacketReceiver* receiver) { receiver_ = receiver; }
225 227
226 void SetSource(test::VideoCapturer* video_capturer, bool respect_sink_wants) { 228 void SetSource(test::VideoCapturer* video_capturer, bool respect_sink_wants) {
227 if (respect_sink_wants) 229 if (respect_sink_wants)
228 captured_frame_forwarder_.SetSource(video_capturer); 230 captured_frame_forwarder_.SetSource(video_capturer);
229 rtc::VideoSinkWants wants; 231 rtc::VideoSinkWants wants;
230 video_capturer->AddOrUpdateSink(InputInterface(), wants); 232 video_capturer->AddOrUpdateSink(InputInterface(), wants);
231 } 233 }
232 234
235 void SetCall(Call* call) {
236 rtc::CritScope lock(&crit_);
237 RTC_DCHECK(!call_);
238 call_ = call;
239 }
240
233 void SetSendStream(VideoSendStream* stream) { 241 void SetSendStream(VideoSendStream* stream) {
234 rtc::CritScope lock(&crit_); 242 rtc::CritScope lock(&crit_);
235 RTC_DCHECK(!send_stream_); 243 RTC_DCHECK(!send_stream_);
236 send_stream_ = stream; 244 send_stream_ = stream;
237 } 245 }
238 246
239 void SetReceiveStream(VideoReceiveStream* stream) { 247 void SetReceiveStream(VideoReceiveStream* stream) {
240 rtc::CritScope lock(&crit_); 248 rtc::CritScope lock(&crit_);
241 RTC_DCHECK(!receive_stream_); 249 RTC_DCHECK(!receive_stream_);
242 receive_stream_ = stream; 250 receive_stream_ = stream;
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } 651 }
644 652
645 static void PollStatsThread(void* obj) { 653 static void PollStatsThread(void* obj) {
646 static_cast<VideoAnalyzer*>(obj)->PollStats(); 654 static_cast<VideoAnalyzer*>(obj)->PollStats();
647 } 655 }
648 656
649 void PollStats() { 657 void PollStats() {
650 while (!done_.Wait(kSendStatsPollingIntervalMs)) { 658 while (!done_.Wait(kSendStatsPollingIntervalMs)) {
651 rtc::CritScope crit(&comparison_lock_); 659 rtc::CritScope crit(&comparison_lock_);
652 660
661 Call::Stats call_stats = call_->GetStats();
662 send_bandwidth_bps_.AddSample(call_stats.send_bandwidth_bps);
663
653 VideoSendStream::Stats send_stats = send_stream_->GetStats(); 664 VideoSendStream::Stats send_stats = send_stream_->GetStats();
654 // It's not certain that we yet have estimates for any of these stats. 665 // It's not certain that we yet have estimates for any of these stats.
655 // Check that they are positive before mixing them in. 666 // Check that they are positive before mixing them in.
656 if (send_stats.encode_frame_rate > 0) 667 if (send_stats.encode_frame_rate > 0)
657 encode_frame_rate_.AddSample(send_stats.encode_frame_rate); 668 encode_frame_rate_.AddSample(send_stats.encode_frame_rate);
658 if (send_stats.avg_encode_time_ms > 0) 669 if (send_stats.avg_encode_time_ms > 0)
659 encode_time_ms_.AddSample(send_stats.avg_encode_time_ms); 670 encode_time_ms_.AddSample(send_stats.avg_encode_time_ms);
660 if (send_stats.encode_usage_percent > 0) 671 if (send_stats.encode_usage_percent > 0)
661 encode_usage_percent_.AddSample(send_stats.encode_usage_percent); 672 encode_usage_percent_.AddSample(send_stats.encode_usage_percent);
662 if (send_stats.media_bitrate_bps > 0) 673 if (send_stats.media_bitrate_bps > 0)
663 media_bitrate_bps_.AddSample(send_stats.media_bitrate_bps); 674 media_bitrate_bps_.AddSample(send_stats.media_bitrate_bps);
675 size_t fec_bytes = 0;
676 for (auto kv : send_stats.substreams) {
677 fec_bytes += kv.second.rtp_stats.fec.payload_bytes +
678 kv.second.rtp_stats.fec.padding_bytes;
679 }
680 fec_bitrate_bps_.AddSample((fec_bytes - last_fec_bytes_) * 8);
681 last_fec_bytes_ = fec_bytes;
664 682
665 if (receive_stream_ != nullptr) { 683 if (receive_stream_ != nullptr) {
666 VideoReceiveStream::Stats receive_stats = receive_stream_->GetStats(); 684 VideoReceiveStream::Stats receive_stats = receive_stream_->GetStats();
667 if (receive_stats.decode_ms > 0) 685 if (receive_stats.decode_ms > 0)
668 decode_time_ms_.AddSample(receive_stats.decode_ms); 686 decode_time_ms_.AddSample(receive_stats.decode_ms);
669 if (receive_stats.max_decode_ms > 0) 687 if (receive_stats.max_decode_ms > 0)
670 decode_time_max_ms_.AddSample(receive_stats.max_decode_ms); 688 decode_time_max_ms_.AddSample(receive_stats.max_decode_ms);
671 } 689 }
672 690
673 memory_usage_.AddSample(rtc::GetProcessResidentSizeBytes()); 691 memory_usage_.AddSample(rtc::GetProcessResidentSizeBytes());
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 rtc::CritScope crit(&comparison_lock_); 775 rtc::CritScope crit(&comparison_lock_);
758 PrintResult("psnr", psnr_, " dB"); 776 PrintResult("psnr", psnr_, " dB");
759 PrintResult("ssim", ssim_, " score"); 777 PrintResult("ssim", ssim_, " score");
760 PrintResult("sender_time", sender_time_, " ms"); 778 PrintResult("sender_time", sender_time_, " ms");
761 PrintResult("receiver_time", receiver_time_, " ms"); 779 PrintResult("receiver_time", receiver_time_, " ms");
762 PrintResult("total_delay_incl_network", end_to_end_, " ms"); 780 PrintResult("total_delay_incl_network", end_to_end_, " ms");
763 PrintResult("time_between_rendered_frames", rendered_delta_, " ms"); 781 PrintResult("time_between_rendered_frames", rendered_delta_, " ms");
764 PrintResult("encode_frame_rate", encode_frame_rate_, " fps"); 782 PrintResult("encode_frame_rate", encode_frame_rate_, " fps");
765 PrintResult("encode_time", encode_time_ms_, " ms"); 783 PrintResult("encode_time", encode_time_ms_, " ms");
766 PrintResult("media_bitrate", media_bitrate_bps_, " bps"); 784 PrintResult("media_bitrate", media_bitrate_bps_, " bps");
785 PrintResult("fec_bitrate", fec_bitrate_bps_, " bps");
786 PrintResult("send_bandwidth", send_bandwidth_bps_, " bps");
767 787
768 if (receive_stream_ != nullptr) { 788 if (receive_stream_ != nullptr) {
769 PrintResult("decode_time", decode_time_ms_, " ms"); 789 PrintResult("decode_time", decode_time_ms_, " ms");
770 } 790 }
771 791
772 printf("RESULT dropped_frames: %s = %d frames\n", test_label_.c_str(), 792 printf("RESULT dropped_frames: %s = %d frames\n", test_label_.c_str(),
773 dropped_frames_); 793 dropped_frames_);
774 printf("RESULT cpu_usage: %s = %lf %%\n", test_label_.c_str(), 794 printf("RESULT cpu_usage: %s = %lf %%\n", test_label_.c_str(),
775 GetCpuUsagePercent()); 795 GetCpuUsagePercent());
776 796
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 rtc::VideoSinkInterface<VideoFrame>* send_stream_input_ GUARDED_BY(crit_); 982 rtc::VideoSinkInterface<VideoFrame>* send_stream_input_ GUARDED_BY(crit_);
963 test::VideoCapturer* video_capturer_; 983 test::VideoCapturer* video_capturer_;
964 Clock* clock_; 984 Clock* clock_;
965 }; 985 };
966 986
967 void AddCapturedFrameForComparison(const VideoFrame& video_frame) { 987 void AddCapturedFrameForComparison(const VideoFrame& video_frame) {
968 rtc::CritScope lock(&crit_); 988 rtc::CritScope lock(&crit_);
969 frames_.push_back(video_frame); 989 frames_.push_back(video_frame);
970 } 990 }
971 991
992 Call* call_;
972 VideoSendStream* send_stream_; 993 VideoSendStream* send_stream_;
973 VideoReceiveStream* receive_stream_; 994 VideoReceiveStream* receive_stream_;
974 CapturedFrameForwarder captured_frame_forwarder_; 995 CapturedFrameForwarder captured_frame_forwarder_;
975 const std::string test_label_; 996 const std::string test_label_;
976 FILE* const graph_data_output_file_; 997 FILE* const graph_data_output_file_;
977 const std::string graph_title_; 998 const std::string graph_title_;
978 const uint32_t ssrc_to_analyze_; 999 const uint32_t ssrc_to_analyze_;
979 const uint32_t rtx_ssrc_to_analyze_; 1000 const uint32_t rtx_ssrc_to_analyze_;
980 const size_t selected_stream_; 1001 const size_t selected_stream_;
981 const int selected_sl_; 1002 const int selected_sl_;
982 const int selected_tl_; 1003 const int selected_tl_;
983 PreEncodeProxy pre_encode_proxy_; 1004 PreEncodeProxy pre_encode_proxy_;
984 OnEncodeTimingProxy encode_timing_proxy_; 1005 OnEncodeTimingProxy encode_timing_proxy_;
985 std::vector<Sample> samples_ GUARDED_BY(comparison_lock_); 1006 std::vector<Sample> samples_ GUARDED_BY(comparison_lock_);
986 std::map<int64_t, int> samples_encode_time_ms_ GUARDED_BY(comparison_lock_); 1007 std::map<int64_t, int> samples_encode_time_ms_ GUARDED_BY(comparison_lock_);
987 test::Statistics sender_time_ GUARDED_BY(comparison_lock_); 1008 test::Statistics sender_time_ GUARDED_BY(comparison_lock_);
988 test::Statistics receiver_time_ GUARDED_BY(comparison_lock_); 1009 test::Statistics receiver_time_ GUARDED_BY(comparison_lock_);
989 test::Statistics psnr_ GUARDED_BY(comparison_lock_); 1010 test::Statistics psnr_ GUARDED_BY(comparison_lock_);
990 test::Statistics ssim_ GUARDED_BY(comparison_lock_); 1011 test::Statistics ssim_ GUARDED_BY(comparison_lock_);
991 test::Statistics end_to_end_ GUARDED_BY(comparison_lock_); 1012 test::Statistics end_to_end_ GUARDED_BY(comparison_lock_);
992 test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_); 1013 test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_);
993 test::Statistics encoded_frame_size_ GUARDED_BY(comparison_lock_); 1014 test::Statistics encoded_frame_size_ GUARDED_BY(comparison_lock_);
994 test::Statistics encode_frame_rate_ GUARDED_BY(comparison_lock_); 1015 test::Statistics encode_frame_rate_ GUARDED_BY(comparison_lock_);
995 test::Statistics encode_time_ms_ GUARDED_BY(comparison_lock_); 1016 test::Statistics encode_time_ms_ GUARDED_BY(comparison_lock_);
996 test::Statistics encode_usage_percent_ GUARDED_BY(comparison_lock_); 1017 test::Statistics encode_usage_percent_ GUARDED_BY(comparison_lock_);
997 test::Statistics decode_time_ms_ GUARDED_BY(comparison_lock_); 1018 test::Statistics decode_time_ms_ GUARDED_BY(comparison_lock_);
998 test::Statistics decode_time_max_ms_ GUARDED_BY(comparison_lock_); 1019 test::Statistics decode_time_max_ms_ GUARDED_BY(comparison_lock_);
999 test::Statistics media_bitrate_bps_ GUARDED_BY(comparison_lock_); 1020 test::Statistics media_bitrate_bps_ GUARDED_BY(comparison_lock_);
1021 test::Statistics fec_bitrate_bps_ GUARDED_BY(comparison_lock_);
1022 test::Statistics send_bandwidth_bps_ GUARDED_BY(comparison_lock_);
1000 test::Statistics memory_usage_ GUARDED_BY(comparison_lock_); 1023 test::Statistics memory_usage_ GUARDED_BY(comparison_lock_);
1001 1024
1025 size_t last_fec_bytes_;
1002 1026
1003 const int frames_to_process_; 1027 const int frames_to_process_;
1004 int frames_recorded_; 1028 int frames_recorded_;
1005 int frames_processed_; 1029 int frames_processed_;
1006 int dropped_frames_; 1030 int dropped_frames_;
1007 int dropped_frames_before_first_encode_; 1031 int dropped_frames_before_first_encode_;
1008 int dropped_frames_before_rendering_; 1032 int dropped_frames_before_rendering_;
1009 int64_t last_render_time_; 1033 int64_t last_render_time_;
1010 uint32_t rtp_timestamp_delta_; 1034 uint32_t rtp_timestamp_delta_;
1011 int64_t total_media_bytes_; 1035 int64_t total_media_bytes_;
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 &send_transport, params_.analyzer.test_label, 1734 &send_transport, params_.analyzer.test_label,
1711 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, 1735 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold,
1712 is_quick_test_enabled 1736 is_quick_test_enabled
1713 ? kFramesSentInQuickTest 1737 ? kFramesSentInQuickTest
1714 : params_.analyzer.test_durations_secs * params_.video.fps, 1738 : params_.analyzer.test_durations_secs * params_.video.fps,
1715 graph_data_output_file, graph_title, 1739 graph_data_output_file, graph_title,
1716 kVideoSendSsrcs[params_.ss.selected_stream], 1740 kVideoSendSsrcs[params_.ss.selected_stream],
1717 kSendRtxSsrcs[params_.ss.selected_stream], 1741 kSendRtxSsrcs[params_.ss.selected_stream],
1718 static_cast<size_t>(params_.ss.selected_stream), params.ss.selected_sl, 1742 static_cast<size_t>(params_.ss.selected_stream), params.ss.selected_sl,
1719 params_.video.selected_tl, is_quick_test_enabled, clock_); 1743 params_.video.selected_tl, is_quick_test_enabled, clock_);
1744 analyzer.SetCall(sender_call_.get());
1720 analyzer.SetReceiver(receiver_call_->Receiver()); 1745 analyzer.SetReceiver(receiver_call_->Receiver());
1721 send_transport.SetReceiver(&analyzer); 1746 send_transport.SetReceiver(&analyzer);
1722 recv_transport.SetReceiver(sender_call_->Receiver()); 1747 recv_transport.SetReceiver(sender_call_->Receiver());
1723 1748
1724 SetupVideo(&analyzer, &recv_transport); 1749 SetupVideo(&analyzer, &recv_transport);
1725 SetupThumbnails(&analyzer, &recv_transport); 1750 SetupThumbnails(&analyzer, &recv_transport);
1726 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; 1751 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer;
1727 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); 1752 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy();
1728 RTC_DCHECK(!video_send_config_.post_encode_callback); 1753 RTC_DCHECK(!video_send_config_.post_encode_callback);
1729 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); 1754 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy();
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
2019 if (!params_.video.encoded_frame_base_path.empty()) { 2044 if (!params_.video.encoded_frame_base_path.empty()) {
2020 std::ostringstream str; 2045 std::ostringstream str;
2021 str << receive_logs_++; 2046 str << receive_logs_++;
2022 std::string path = 2047 std::string path =
2023 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; 2048 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf";
2024 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), 2049 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path),
2025 10000000); 2050 10000000);
2026 } 2051 }
2027 } 2052 }
2028 } // namespace webrtc 2053 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/full_stack_tests.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698