OLD | NEW |
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" |
11 | 11 |
12 #include <stdio.h> | 12 #include <stdio.h> |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <deque> | 14 #include <deque> |
15 #include <map> | 15 #include <map> |
| 16 #include <set> |
16 #include <sstream> | 17 #include <sstream> |
17 #include <string> | 18 #include <string> |
18 #include <vector> | 19 #include <vector> |
19 | 20 |
20 #include "webrtc/base/checks.h" | 21 #include "webrtc/base/checks.h" |
21 #include "webrtc/base/cpu_time.h" | 22 #include "webrtc/base/cpu_time.h" |
22 #include "webrtc/base/event.h" | 23 #include "webrtc/base/event.h" |
23 #include "webrtc/base/format_macros.h" | 24 #include "webrtc/base/format_macros.h" |
24 #include "webrtc/base/memory_usage.h" | 25 #include "webrtc/base/memory_usage.h" |
25 #include "webrtc/base/optional.h" | 26 #include "webrtc/base/optional.h" |
26 #include "webrtc/base/platform_file.h" | 27 #include "webrtc/base/platform_file.h" |
27 #include "webrtc/base/timeutils.h" | 28 #include "webrtc/base/timeutils.h" |
28 #include "webrtc/call/call.h" | 29 #include "webrtc/call/call.h" |
29 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 30 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
30 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 31 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
31 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" | 32 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" |
32 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 33 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
33 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" | 34 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" |
34 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 35 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
35 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | 36 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
36 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 37 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
| 38 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" |
37 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 39 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
38 #include "webrtc/system_wrappers/include/cpu_info.h" | 40 #include "webrtc/system_wrappers/include/cpu_info.h" |
39 #include "webrtc/system_wrappers/include/field_trial.h" | 41 #include "webrtc/system_wrappers/include/field_trial.h" |
40 #include "webrtc/test/gtest.h" | 42 #include "webrtc/test/gtest.h" |
41 #include "webrtc/test/layer_filtering_transport.h" | 43 #include "webrtc/test/layer_filtering_transport.h" |
42 #include "webrtc/test/run_loop.h" | 44 #include "webrtc/test/run_loop.h" |
43 #include "webrtc/test/statistics.h" | 45 #include "webrtc/test/statistics.h" |
44 #include "webrtc/test/testsupport/fileutils.h" | 46 #include "webrtc/test/testsupport/fileutils.h" |
45 #include "webrtc/test/vcm_capturer.h" | 47 #include "webrtc/test/vcm_capturer.h" |
46 #include "webrtc/test/video_renderer.h" | 48 #include "webrtc/test/video_renderer.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 public: | 136 public: |
135 VideoAnalyzer(test::LayerFilteringTransport* transport, | 137 VideoAnalyzer(test::LayerFilteringTransport* transport, |
136 const std::string& test_label, | 138 const std::string& test_label, |
137 double avg_psnr_threshold, | 139 double avg_psnr_threshold, |
138 double avg_ssim_threshold, | 140 double avg_ssim_threshold, |
139 int duration_frames, | 141 int duration_frames, |
140 FILE* graph_data_output_file, | 142 FILE* graph_data_output_file, |
141 const std::string& graph_title, | 143 const std::string& graph_title, |
142 uint32_t ssrc_to_analyze, | 144 uint32_t ssrc_to_analyze, |
143 uint32_t rtx_ssrc_to_analyze, | 145 uint32_t rtx_ssrc_to_analyze, |
144 uint32_t selected_stream_width, | 146 size_t selected_stream, |
145 uint32_t selected_stream_height, | |
146 int selected_sl, | 147 int selected_sl, |
147 int selected_tl, | 148 int selected_tl, |
148 bool is_quick_test_enabled) | 149 bool is_quick_test_enabled) |
149 : transport_(transport), | 150 : transport_(transport), |
150 receiver_(nullptr), | 151 receiver_(nullptr), |
151 send_stream_(nullptr), | 152 send_stream_(nullptr), |
152 receive_stream_(nullptr), | 153 receive_stream_(nullptr), |
153 captured_frame_forwarder_(this), | 154 captured_frame_forwarder_(this), |
154 test_label_(test_label), | 155 test_label_(test_label), |
155 graph_data_output_file_(graph_data_output_file), | 156 graph_data_output_file_(graph_data_output_file), |
156 graph_title_(graph_title), | 157 graph_title_(graph_title), |
157 ssrc_to_analyze_(ssrc_to_analyze), | 158 ssrc_to_analyze_(ssrc_to_analyze), |
158 rtx_ssrc_to_analyze_(rtx_ssrc_to_analyze), | 159 rtx_ssrc_to_analyze_(rtx_ssrc_to_analyze), |
159 selected_stream_width_(selected_stream_width), | 160 selected_stream_(selected_stream), |
160 selected_stream_height_(selected_stream_height), | |
161 selected_sl_(selected_sl), | 161 selected_sl_(selected_sl), |
162 selected_tl_(selected_tl), | 162 selected_tl_(selected_tl), |
163 pre_encode_proxy_(this), | 163 pre_encode_proxy_(this), |
164 encode_timing_proxy_(this), | 164 encode_timing_proxy_(this), |
165 frames_to_process_(duration_frames), | 165 frames_to_process_(duration_frames), |
166 frames_recorded_(0), | 166 frames_recorded_(0), |
167 frames_processed_(0), | 167 frames_processed_(0), |
168 dropped_frames_(0), | 168 dropped_frames_(0), |
169 dropped_frames_before_first_encode_(0), | 169 dropped_frames_before_first_encode_(0), |
170 dropped_frames_before_rendering_(0), | 170 dropped_frames_before_rendering_(0), |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 RTC_CHECK(!frames_.empty()); | 279 RTC_CHECK(!frames_.empty()); |
280 } | 280 } |
281 first_encoded_timestamp_ = | 281 first_encoded_timestamp_ = |
282 rtc::Optional<uint32_t>(video_frame.timestamp()); | 282 rtc::Optional<uint32_t>(video_frame.timestamp()); |
283 } | 283 } |
284 } | 284 } |
285 | 285 |
286 void PostEncodeFrameCallback(const EncodedFrame& encoded_frame) { | 286 void PostEncodeFrameCallback(const EncodedFrame& encoded_frame) { |
287 rtc::CritScope lock(&crit_); | 287 rtc::CritScope lock(&crit_); |
288 if (!first_sent_timestamp_ && | 288 if (!first_sent_timestamp_ && |
289 encoded_frame.encoded_width_ == selected_stream_width_ && | 289 encoded_frame.stream_id_ == selected_stream_) { |
290 encoded_frame.encoded_height_ == selected_stream_height_) { | |
291 first_sent_timestamp_ = rtc::Optional<uint32_t>(encoded_frame.timestamp_); | 290 first_sent_timestamp_ = rtc::Optional<uint32_t>(encoded_frame.timestamp_); |
292 } | 291 } |
293 } | 292 } |
294 | 293 |
295 bool SendRtp(const uint8_t* packet, | 294 bool SendRtp(const uint8_t* packet, |
296 size_t length, | 295 size_t length, |
297 const PacketOptions& options) override { | 296 const PacketOptions& options) override { |
298 RtpUtility::RtpHeaderParser parser(packet, length); | 297 RtpUtility::RtpHeaderParser parser(packet, length); |
299 RTPHeader header; | 298 RTPHeader header; |
300 parser.Parse(&header); | 299 parser.Parse(&header); |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 } | 951 } |
953 | 952 |
954 VideoSendStream* send_stream_; | 953 VideoSendStream* send_stream_; |
955 VideoReceiveStream* receive_stream_; | 954 VideoReceiveStream* receive_stream_; |
956 CapturedFrameForwarder captured_frame_forwarder_; | 955 CapturedFrameForwarder captured_frame_forwarder_; |
957 const std::string test_label_; | 956 const std::string test_label_; |
958 FILE* const graph_data_output_file_; | 957 FILE* const graph_data_output_file_; |
959 const std::string graph_title_; | 958 const std::string graph_title_; |
960 const uint32_t ssrc_to_analyze_; | 959 const uint32_t ssrc_to_analyze_; |
961 const uint32_t rtx_ssrc_to_analyze_; | 960 const uint32_t rtx_ssrc_to_analyze_; |
962 const uint32_t selected_stream_width_; | 961 const size_t selected_stream_; |
963 const uint32_t selected_stream_height_; | |
964 const int selected_sl_; | 962 const int selected_sl_; |
965 const int selected_tl_; | 963 const int selected_tl_; |
966 PreEncodeProxy pre_encode_proxy_; | 964 PreEncodeProxy pre_encode_proxy_; |
967 OnEncodeTimingProxy encode_timing_proxy_; | 965 OnEncodeTimingProxy encode_timing_proxy_; |
968 std::vector<Sample> samples_ GUARDED_BY(comparison_lock_); | 966 std::vector<Sample> samples_ GUARDED_BY(comparison_lock_); |
969 std::map<int64_t, int> samples_encode_time_ms_ GUARDED_BY(comparison_lock_); | 967 std::map<int64_t, int> samples_encode_time_ms_ GUARDED_BY(comparison_lock_); |
970 test::Statistics sender_time_ GUARDED_BY(comparison_lock_); | 968 test::Statistics sender_time_ GUARDED_BY(comparison_lock_); |
971 test::Statistics receiver_time_ GUARDED_BY(comparison_lock_); | 969 test::Statistics receiver_time_ GUARDED_BY(comparison_lock_); |
972 test::Statistics psnr_ GUARDED_BY(comparison_lock_); | 970 test::Statistics psnr_ GUARDED_BY(comparison_lock_); |
973 test::Statistics ssim_ GUARDED_BY(comparison_lock_); | 971 test::Statistics ssim_ GUARDED_BY(comparison_lock_); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 bool is_quick_test_enabled_; | 1011 bool is_quick_test_enabled_; |
1014 | 1012 |
1015 rtc::CriticalSection comparison_lock_; | 1013 rtc::CriticalSection comparison_lock_; |
1016 std::vector<rtc::PlatformThread*> comparison_thread_pool_; | 1014 std::vector<rtc::PlatformThread*> comparison_thread_pool_; |
1017 rtc::PlatformThread stats_polling_thread_; | 1015 rtc::PlatformThread stats_polling_thread_; |
1018 rtc::Event comparison_available_event_; | 1016 rtc::Event comparison_available_event_; |
1019 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_); | 1017 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_); |
1020 rtc::Event done_; | 1018 rtc::Event done_; |
1021 }; | 1019 }; |
1022 | 1020 |
| 1021 class Vp8EncoderFactory : public VideoEncoderFactory { |
| 1022 public: |
| 1023 Vp8EncoderFactory() = default; |
| 1024 ~Vp8EncoderFactory() override { RTC_CHECK(live_encoders_.empty()); } |
| 1025 |
| 1026 VideoEncoder* Create() override { |
| 1027 VideoEncoder* encoder = VP8Encoder::Create(); |
| 1028 live_encoders_.insert(encoder); |
| 1029 return encoder; |
| 1030 } |
| 1031 |
| 1032 void Destroy(VideoEncoder* encoder) override { |
| 1033 auto it = live_encoders_.find(encoder); |
| 1034 RTC_CHECK(it != live_encoders_.end()); |
| 1035 live_encoders_.erase(it); |
| 1036 delete encoder; |
| 1037 } |
| 1038 |
| 1039 std::set<VideoEncoder*> live_encoders_; |
| 1040 }; |
| 1041 |
1023 VideoQualityTest::VideoQualityTest() | 1042 VideoQualityTest::VideoQualityTest() |
1024 : clock_(Clock::GetRealTimeClock()), receive_logs_(0), send_logs_(0) {} | 1043 : clock_(Clock::GetRealTimeClock()), receive_logs_(0), send_logs_(0) {} |
1025 | 1044 |
1026 VideoQualityTest::Params::Params() | 1045 VideoQualityTest::Params::Params() |
1027 : call({false, Call::Config::BitrateConfig()}), | 1046 : call({false, Call::Config::BitrateConfig()}), |
1028 video({false, 640, 480, 30, 50, 800, 800, false, "VP8", 1, -1, 0, false, | 1047 video({false, 640, 480, 30, 50, 800, 800, false, "VP8", 1, -1, 0, false, |
1029 false, "", ""}), | 1048 false, "", ""}), |
1030 audio({false, false}), | 1049 audio({false, false}), |
1031 screenshare({false, 10, 0}), | 1050 screenshare({false, 10, 0}), |
1032 analyzer({"", 0.0, 0.0, 0, "", ""}), | 1051 analyzer({"", 0.0, 0.0, 0, "", ""}), |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 // TODO(ivica): Should max_bitrate_bps == -1 represent inf max bitrate, as it | 1097 // TODO(ivica): Should max_bitrate_bps == -1 represent inf max bitrate, as it |
1079 // does in some parts of the code? | 1098 // does in some parts of the code? |
1080 RTC_CHECK_GE(params_.video.max_bitrate_bps, params_.video.target_bitrate_bps); | 1099 RTC_CHECK_GE(params_.video.max_bitrate_bps, params_.video.target_bitrate_bps); |
1081 RTC_CHECK_GE(params_.video.target_bitrate_bps, params_.video.min_bitrate_bps); | 1100 RTC_CHECK_GE(params_.video.target_bitrate_bps, params_.video.min_bitrate_bps); |
1082 RTC_CHECK_LT(params_.video.selected_tl, params_.video.num_temporal_layers); | 1101 RTC_CHECK_LT(params_.video.selected_tl, params_.video.num_temporal_layers); |
1083 RTC_CHECK_LT(params_.ss.selected_stream, params_.ss.streams.size()); | 1102 RTC_CHECK_LT(params_.ss.selected_stream, params_.ss.streams.size()); |
1084 for (const VideoStream& stream : params_.ss.streams) { | 1103 for (const VideoStream& stream : params_.ss.streams) { |
1085 RTC_CHECK_GE(stream.min_bitrate_bps, 0); | 1104 RTC_CHECK_GE(stream.min_bitrate_bps, 0); |
1086 RTC_CHECK_GE(stream.target_bitrate_bps, stream.min_bitrate_bps); | 1105 RTC_CHECK_GE(stream.target_bitrate_bps, stream.min_bitrate_bps); |
1087 RTC_CHECK_GE(stream.max_bitrate_bps, stream.target_bitrate_bps); | 1106 RTC_CHECK_GE(stream.max_bitrate_bps, stream.target_bitrate_bps); |
1088 RTC_CHECK_EQ(stream.temporal_layer_thresholds_bps.size(), | 1107 RTC_CHECK_LE(stream.temporal_layer_thresholds_bps.size(), |
1089 params_.video.num_temporal_layers - 1); | 1108 params_.video.num_temporal_layers - 1); |
1090 } | 1109 } |
1091 // TODO(ivica): Should we check if the sum of all streams/layers is equal to | 1110 // TODO(ivica): Should we check if the sum of all streams/layers is equal to |
1092 // the total bitrate? We anyway have to update them in the case bitrate | 1111 // the total bitrate? We anyway have to update them in the case bitrate |
1093 // estimator changes the total bitrates. | 1112 // estimator changes the total bitrates. |
1094 RTC_CHECK_GE(params_.ss.num_spatial_layers, 1); | 1113 RTC_CHECK_GE(params_.ss.num_spatial_layers, 1); |
1095 RTC_CHECK_LE(params_.ss.selected_sl, params_.ss.num_spatial_layers); | 1114 RTC_CHECK_LE(params_.ss.selected_sl, params_.ss.num_spatial_layers); |
1096 RTC_CHECK(params_.ss.spatial_layers.empty() || | 1115 RTC_CHECK(params_.ss.spatial_layers.empty() || |
1097 params_.ss.spatial_layers.size() == | 1116 params_.ss.spatial_layers.size() == |
1098 static_cast<size_t>(params_.ss.num_spatial_layers)); | 1117 static_cast<size_t>(params_.ss.num_spatial_layers)); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 // Static. | 1160 // Static. |
1142 VideoStream VideoQualityTest::DefaultVideoStream(const Params& params) { | 1161 VideoStream VideoQualityTest::DefaultVideoStream(const Params& params) { |
1143 VideoStream stream; | 1162 VideoStream stream; |
1144 stream.width = params.video.width; | 1163 stream.width = params.video.width; |
1145 stream.height = params.video.height; | 1164 stream.height = params.video.height; |
1146 stream.max_framerate = params.video.fps; | 1165 stream.max_framerate = params.video.fps; |
1147 stream.min_bitrate_bps = params.video.min_bitrate_bps; | 1166 stream.min_bitrate_bps = params.video.min_bitrate_bps; |
1148 stream.target_bitrate_bps = params.video.target_bitrate_bps; | 1167 stream.target_bitrate_bps = params.video.target_bitrate_bps; |
1149 stream.max_bitrate_bps = params.video.max_bitrate_bps; | 1168 stream.max_bitrate_bps = params.video.max_bitrate_bps; |
1150 stream.max_qp = 52; | 1169 stream.max_qp = 52; |
1151 if (params.video.num_temporal_layers == 2) { | 1170 if (params.video.num_temporal_layers > 1) { |
1152 stream.temporal_layer_thresholds_bps.push_back(stream.target_bitrate_bps); | 1171 RTC_CHECK_LE(params.video.num_temporal_layers, kMaxTemporalStreams); |
1153 } else if (params.video.num_temporal_layers == 3) { | 1172 if (params.video.codec == "VP8") { |
1154 stream.temporal_layer_thresholds_bps.push_back(stream.max_bitrate_bps / 4); | 1173 for (int i = 0; i < params.video.num_temporal_layers - 1; ++i) { |
1155 stream.temporal_layer_thresholds_bps.push_back(stream.target_bitrate_bps); | 1174 stream.temporal_layer_thresholds_bps.push_back(static_cast<int>( |
| 1175 stream.target_bitrate_bps * |
| 1176 kVp8LayerRateAlloction[params.video.num_temporal_layers][i])); |
| 1177 } |
| 1178 } |
1156 } | 1179 } |
1157 return stream; | 1180 return stream; |
1158 } | 1181 } |
1159 | 1182 |
1160 // Static. | 1183 // Static. |
1161 VideoStream VideoQualityTest::DefaultThumbnailStream() { | 1184 VideoStream VideoQualityTest::DefaultThumbnailStream() { |
1162 VideoStream stream; | 1185 VideoStream stream; |
1163 stream.width = 320; | 1186 stream.width = 320; |
1164 stream.height = 180; | 1187 stream.height = 180; |
1165 stream.max_framerate = 7; | 1188 stream.max_framerate = 7; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 | 1261 |
1239 size_t num_video_streams = params_.ss.streams.size(); | 1262 size_t num_video_streams = params_.ss.streams.size(); |
1240 size_t num_flexfec_streams = params_.video.flexfec ? 1 : 0; | 1263 size_t num_flexfec_streams = params_.video.flexfec ? 1 : 0; |
1241 CreateSendConfig(num_video_streams, 0, num_flexfec_streams, send_transport); | 1264 CreateSendConfig(num_video_streams, 0, num_flexfec_streams, send_transport); |
1242 | 1265 |
1243 int payload_type; | 1266 int payload_type; |
1244 if (params_.video.codec == "H264") { | 1267 if (params_.video.codec == "H264") { |
1245 video_encoder_.reset(H264Encoder::Create(cricket::VideoCodec("H264"))); | 1268 video_encoder_.reset(H264Encoder::Create(cricket::VideoCodec("H264"))); |
1246 payload_type = kPayloadTypeH264; | 1269 payload_type = kPayloadTypeH264; |
1247 } else if (params_.video.codec == "VP8") { | 1270 } else if (params_.video.codec == "VP8") { |
1248 video_encoder_.reset(VP8Encoder::Create()); | 1271 if (params_.screenshare.enabled && params_.ss.streams.size() > 1) { |
| 1272 // Simulcast screenshare needs a simulcast encoder adapter to work, since |
| 1273 // encoders usually can't natively do simulcast with different frame rates |
| 1274 // for the different layers. |
| 1275 video_encoder_.reset( |
| 1276 new SimulcastEncoderAdapter(new Vp8EncoderFactory())); |
| 1277 } else { |
| 1278 video_encoder_.reset(VP8Encoder::Create()); |
| 1279 } |
1249 payload_type = kPayloadTypeVP8; | 1280 payload_type = kPayloadTypeVP8; |
1250 } else if (params_.video.codec == "VP9") { | 1281 } else if (params_.video.codec == "VP9") { |
1251 video_encoder_.reset(VP9Encoder::Create()); | 1282 video_encoder_.reset(VP9Encoder::Create()); |
1252 payload_type = kPayloadTypeVP9; | 1283 payload_type = kPayloadTypeVP9; |
1253 } else { | 1284 } else { |
1254 RTC_NOTREACHED() << "Codec not supported!"; | 1285 RTC_NOTREACHED() << "Codec not supported!"; |
1255 return; | 1286 return; |
1256 } | 1287 } |
1257 video_send_config_.encoder_settings.encoder = video_encoder_.get(); | 1288 video_send_config_.encoder_settings.encoder = video_encoder_.get(); |
1258 video_send_config_.encoder_settings.payload_name = params_.video.codec; | 1289 video_send_config_.encoder_settings.payload_name = params_.video.codec; |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 | 1604 |
1574 test::LayerFilteringTransport send_transport( | 1605 test::LayerFilteringTransport send_transport( |
1575 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9, | 1606 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9, |
1576 params_.video.selected_tl, params_.ss.selected_sl); | 1607 params_.video.selected_tl, params_.ss.selected_sl); |
1577 test::DirectTransport recv_transport(params_.pipe, receiver_call_.get()); | 1608 test::DirectTransport recv_transport(params_.pipe, receiver_call_.get()); |
1578 | 1609 |
1579 std::string graph_title = params_.analyzer.graph_title; | 1610 std::string graph_title = params_.analyzer.graph_title; |
1580 if (graph_title.empty()) | 1611 if (graph_title.empty()) |
1581 graph_title = VideoQualityTest::GenerateGraphTitle(); | 1612 graph_title = VideoQualityTest::GenerateGraphTitle(); |
1582 | 1613 |
1583 VideoStream& selected_stream = params_.ss.streams[params_.ss.selected_stream]; | |
1584 | |
1585 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest"); | 1614 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest"); |
1586 VideoAnalyzer analyzer( | 1615 VideoAnalyzer analyzer( |
1587 &send_transport, params_.analyzer.test_label, | 1616 &send_transport, params_.analyzer.test_label, |
1588 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, | 1617 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, |
1589 is_quick_test_enabled | 1618 is_quick_test_enabled |
1590 ? kFramesSentInQuickTest | 1619 ? kFramesSentInQuickTest |
1591 : params_.analyzer.test_durations_secs * params_.video.fps, | 1620 : params_.analyzer.test_durations_secs * params_.video.fps, |
1592 graph_data_output_file, graph_title, | 1621 graph_data_output_file, graph_title, |
1593 kVideoSendSsrcs[params_.ss.selected_stream], | 1622 kVideoSendSsrcs[params_.ss.selected_stream], |
1594 kSendRtxSsrcs[params_.ss.selected_stream], | 1623 kSendRtxSsrcs[params_.ss.selected_stream], |
1595 static_cast<uint32_t>(selected_stream.width), | 1624 static_cast<size_t>(params_.ss.selected_stream), params.ss.selected_sl, |
1596 static_cast<uint32_t>(selected_stream.height), params.ss.selected_sl, | |
1597 params_.video.selected_tl, is_quick_test_enabled); | 1625 params_.video.selected_tl, is_quick_test_enabled); |
1598 analyzer.SetReceiver(receiver_call_->Receiver()); | 1626 analyzer.SetReceiver(receiver_call_->Receiver()); |
1599 send_transport.SetReceiver(&analyzer); | 1627 send_transport.SetReceiver(&analyzer); |
1600 recv_transport.SetReceiver(sender_call_->Receiver()); | 1628 recv_transport.SetReceiver(sender_call_->Receiver()); |
1601 | 1629 |
1602 SetupVideo(&analyzer, &recv_transport); | 1630 SetupVideo(&analyzer, &recv_transport); |
1603 SetupThumbnails(&analyzer, &recv_transport); | 1631 SetupThumbnails(&analyzer, &recv_transport); |
1604 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; | 1632 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; |
1605 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); | 1633 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); |
1606 RTC_DCHECK(!video_send_config_.post_encode_callback); | 1634 RTC_DCHECK(!video_send_config_.post_encode_callback); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 std::string prefix = | 1884 std::string prefix = |
1857 params_.video.encoded_frame_base_path + "." + str.str() + ".send."; | 1885 params_.video.encoded_frame_base_path + "." + str.str() + ".send."; |
1858 stream->EnableEncodedFrameRecording( | 1886 stream->EnableEncodedFrameRecording( |
1859 std::vector<rtc::PlatformFile>( | 1887 std::vector<rtc::PlatformFile>( |
1860 {rtc::CreatePlatformFile(prefix + "1.ivf"), | 1888 {rtc::CreatePlatformFile(prefix + "1.ivf"), |
1861 rtc::CreatePlatformFile(prefix + "2.ivf"), | 1889 rtc::CreatePlatformFile(prefix + "2.ivf"), |
1862 rtc::CreatePlatformFile(prefix + "3.ivf")}), | 1890 rtc::CreatePlatformFile(prefix + "3.ivf")}), |
1863 10000000); | 1891 10000000); |
1864 } | 1892 } |
1865 } | 1893 } |
| 1894 |
1866 void VideoQualityTest::StartEncodedFrameLogs(VideoReceiveStream* stream) { | 1895 void VideoQualityTest::StartEncodedFrameLogs(VideoReceiveStream* stream) { |
1867 if (!params_.video.encoded_frame_base_path.empty()) { | 1896 if (!params_.video.encoded_frame_base_path.empty()) { |
1868 std::ostringstream str; | 1897 std::ostringstream str; |
1869 str << receive_logs_++; | 1898 str << receive_logs_++; |
1870 std::string path = | 1899 std::string path = |
1871 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1900 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
1872 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1901 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
1873 10000000); | 1902 10000000); |
1874 } | 1903 } |
1875 } | 1904 } |
1876 | |
1877 } // namespace webrtc | 1905 } // namespace webrtc |
OLD | NEW |