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" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 public: | 128 public: |
129 VideoAnalyzer(test::LayerFilteringTransport* transport, | 129 VideoAnalyzer(test::LayerFilteringTransport* transport, |
130 const std::string& test_label, | 130 const std::string& test_label, |
131 double avg_psnr_threshold, | 131 double avg_psnr_threshold, |
132 double avg_ssim_threshold, | 132 double avg_ssim_threshold, |
133 int duration_frames, | 133 int duration_frames, |
134 FILE* graph_data_output_file, | 134 FILE* graph_data_output_file, |
135 const std::string& graph_title, | 135 const std::string& graph_title, |
136 uint32_t ssrc_to_analyze, | 136 uint32_t ssrc_to_analyze, |
137 uint32_t rtx_ssrc_to_analyze, | 137 uint32_t rtx_ssrc_to_analyze, |
138 uint32_t selected_width, | 138 uint32_t selected_stream_width, |
139 uint32_t selected_height) | 139 uint32_t selected_stream_height) |
140 : transport_(transport), | 140 : transport_(transport), |
141 receiver_(nullptr), | 141 receiver_(nullptr), |
142 send_stream_(nullptr), | 142 send_stream_(nullptr), |
143 receive_stream_(nullptr), | 143 receive_stream_(nullptr), |
144 captured_frame_forwarder_(this), | 144 captured_frame_forwarder_(this), |
145 test_label_(test_label), | 145 test_label_(test_label), |
146 graph_data_output_file_(graph_data_output_file), | 146 graph_data_output_file_(graph_data_output_file), |
147 graph_title_(graph_title), | 147 graph_title_(graph_title), |
148 ssrc_to_analyze_(ssrc_to_analyze), | 148 ssrc_to_analyze_(ssrc_to_analyze), |
149 rtx_ssrc_to_analyze_(rtx_ssrc_to_analyze), | 149 rtx_ssrc_to_analyze_(rtx_ssrc_to_analyze), |
150 selected_width_(selected_width), | 150 selected_stream_width_(selected_stream_width), |
151 selected_height_(selected_height), | 151 selected_stream_height_(selected_stream_height), |
152 pre_encode_proxy_(this), | 152 pre_encode_proxy_(this), |
153 encode_timing_proxy_(this), | 153 encode_timing_proxy_(this), |
154 frames_to_process_(duration_frames), | 154 frames_to_process_(duration_frames), |
155 frames_recorded_(0), | 155 frames_recorded_(0), |
156 frames_processed_(0), | 156 frames_processed_(0), |
157 dropped_frames_(0), | 157 dropped_frames_(0), |
158 dropped_frames_before_first_encode_(0), | 158 dropped_frames_before_first_encode_(0), |
159 dropped_frames_before_rendering_(0), | 159 dropped_frames_before_rendering_(0), |
160 last_render_time_(0), | 160 last_render_time_(0), |
161 rtp_timestamp_delta_(0), | 161 rtp_timestamp_delta_(0), |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 221 |
222 DeliveryStatus DeliverPacket(MediaType media_type, | 222 DeliveryStatus DeliverPacket(MediaType media_type, |
223 const uint8_t* packet, | 223 const uint8_t* packet, |
224 size_t length, | 224 size_t length, |
225 const PacketTime& packet_time) override { | 225 const PacketTime& packet_time) override { |
226 // Ignore timestamps of RTCP packets. They're not synchronized with | 226 // Ignore timestamps of RTCP packets. They're not synchronized with |
227 // RTP packet timestamps and so they would confuse wrap_handler_. | 227 // RTP packet timestamps and so they would confuse wrap_handler_. |
228 if (RtpHeaderParser::IsRtcp(packet, length)) { | 228 if (RtpHeaderParser::IsRtcp(packet, length)) { |
229 return receiver_->DeliverPacket(media_type, packet, length, packet_time); | 229 return receiver_->DeliverPacket(media_type, packet, length, packet_time); |
230 } | 230 } |
231 | |
232 RtpUtility::RtpHeaderParser parser(packet, length); | 231 RtpUtility::RtpHeaderParser parser(packet, length); |
233 RTPHeader header; | 232 RTPHeader header; |
234 parser.Parse(&header); | 233 parser.Parse(&header); |
235 if (!IsFlexfec(header.payloadType) && | 234 if (!IsFlexfec(header.payloadType) && |
236 (header.ssrc == ssrc_to_analyze_ || | 235 (header.ssrc == ssrc_to_analyze_ || |
237 header.ssrc == rtx_ssrc_to_analyze_)) { | 236 header.ssrc == rtx_ssrc_to_analyze_)) { |
238 // Ignore FlexFEC timestamps, to avoid collisions with media timestamps. | 237 // Ignore FlexFEC timestamps, to avoid collisions with media timestamps. |
239 // (FlexFEC and media are sent on different SSRCs, which have different | 238 // (FlexFEC and media are sent on different SSRCs, which have different |
240 // timestamps spaces.) | 239 // timestamps spaces.) |
241 // Also ignore packets from wrong SSRC, but include retransmits. | 240 // Also ignore packets from wrong SSRC, but include retransmits. |
(...skipping 21 matching lines...) Expand all Loading... |
263 RTC_CHECK(!frames_.empty()); | 262 RTC_CHECK(!frames_.empty()); |
264 } | 263 } |
265 first_encoded_timestamp_ = | 264 first_encoded_timestamp_ = |
266 rtc::Optional<uint32_t>(video_frame.timestamp()); | 265 rtc::Optional<uint32_t>(video_frame.timestamp()); |
267 } | 266 } |
268 } | 267 } |
269 | 268 |
270 void PostEncodeFrameCallback(const EncodedFrame& encoded_frame) { | 269 void PostEncodeFrameCallback(const EncodedFrame& encoded_frame) { |
271 rtc::CritScope lock(&crit_); | 270 rtc::CritScope lock(&crit_); |
272 if (!first_sent_timestamp_ && | 271 if (!first_sent_timestamp_ && |
273 encoded_frame.encoded_width_ == selected_width_ && | 272 encoded_frame.encoded_width_ == selected_stream_width_ && |
274 encoded_frame.encoded_height_ == selected_height_) { | 273 encoded_frame.encoded_height_ == selected_stream_height_) { |
275 first_sent_timestamp_ = rtc::Optional<uint32_t>(encoded_frame.timestamp_); | 274 first_sent_timestamp_ = rtc::Optional<uint32_t>(encoded_frame.timestamp_); |
276 } | 275 } |
277 } | 276 } |
278 | 277 |
279 bool SendRtp(const uint8_t* packet, | 278 bool SendRtp(const uint8_t* packet, |
280 size_t length, | 279 size_t length, |
281 const PacketOptions& options) override { | 280 const PacketOptions& options) override { |
282 RtpUtility::RtpHeaderParser parser(packet, length); | 281 RtpUtility::RtpHeaderParser parser(packet, length); |
283 RTPHeader header; | 282 RTPHeader header; |
284 parser.Parse(&header); | 283 parser.Parse(&header); |
285 | 284 |
286 int64_t current_time = | 285 int64_t current_time = |
287 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); | 286 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); |
| 287 |
288 bool result = transport_->SendRtp(packet, length, options); | 288 bool result = transport_->SendRtp(packet, length, options); |
289 { | 289 { |
290 rtc::CritScope lock(&crit_); | 290 rtc::CritScope lock(&crit_); |
291 if (rtp_timestamp_delta_ == 0 && header.ssrc == ssrc_to_analyze_) { | 291 if (rtp_timestamp_delta_ == 0 && header.ssrc == ssrc_to_analyze_) { |
292 RTC_CHECK(static_cast<bool>(first_sent_timestamp_)); | 292 RTC_CHECK(static_cast<bool>(first_sent_timestamp_)); |
293 rtp_timestamp_delta_ = header.timestamp - *first_sent_timestamp_; | 293 rtp_timestamp_delta_ = header.timestamp - *first_sent_timestamp_; |
294 } | 294 } |
295 | 295 |
296 if (!IsFlexfec(header.payloadType) && header.ssrc == ssrc_to_analyze_) { | 296 if (!IsFlexfec(header.payloadType) && header.ssrc == ssrc_to_analyze_) { |
297 // Ignore FlexFEC timestamps, to avoid collisions with media timestamps. | 297 // Ignore FlexFEC timestamps, to avoid collisions with media timestamps. |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 } | 843 } |
844 | 844 |
845 VideoSendStream* send_stream_; | 845 VideoSendStream* send_stream_; |
846 VideoReceiveStream* receive_stream_; | 846 VideoReceiveStream* receive_stream_; |
847 CapturedFrameForwarder captured_frame_forwarder_; | 847 CapturedFrameForwarder captured_frame_forwarder_; |
848 const std::string test_label_; | 848 const std::string test_label_; |
849 FILE* const graph_data_output_file_; | 849 FILE* const graph_data_output_file_; |
850 const std::string graph_title_; | 850 const std::string graph_title_; |
851 const uint32_t ssrc_to_analyze_; | 851 const uint32_t ssrc_to_analyze_; |
852 const uint32_t rtx_ssrc_to_analyze_; | 852 const uint32_t rtx_ssrc_to_analyze_; |
853 const uint32_t selected_width_; | 853 const uint32_t selected_stream_width_; |
854 const uint32_t selected_height_; | 854 const uint32_t selected_stream_height_; |
855 PreEncodeProxy pre_encode_proxy_; | 855 PreEncodeProxy pre_encode_proxy_; |
856 OnEncodeTimingProxy encode_timing_proxy_; | 856 OnEncodeTimingProxy encode_timing_proxy_; |
857 std::vector<Sample> samples_ GUARDED_BY(comparison_lock_); | 857 std::vector<Sample> samples_ GUARDED_BY(comparison_lock_); |
858 std::map<int64_t, int> samples_encode_time_ms_ GUARDED_BY(comparison_lock_); | 858 std::map<int64_t, int> samples_encode_time_ms_ GUARDED_BY(comparison_lock_); |
859 test::Statistics sender_time_ GUARDED_BY(comparison_lock_); | 859 test::Statistics sender_time_ GUARDED_BY(comparison_lock_); |
860 test::Statistics receiver_time_ GUARDED_BY(comparison_lock_); | 860 test::Statistics receiver_time_ GUARDED_BY(comparison_lock_); |
861 test::Statistics psnr_ GUARDED_BY(comparison_lock_); | 861 test::Statistics psnr_ GUARDED_BY(comparison_lock_); |
862 test::Statistics ssim_ GUARDED_BY(comparison_lock_); | 862 test::Statistics ssim_ GUARDED_BY(comparison_lock_); |
863 test::Statistics end_to_end_ GUARDED_BY(comparison_lock_); | 863 test::Statistics end_to_end_ GUARDED_BY(comparison_lock_); |
864 test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_); | 864 test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 video_send_config_.rtp.ulpfec.red_payload_type; | 1191 video_send_config_.rtp.ulpfec.red_payload_type; |
1192 video_receive_configs_[params_.ss.selected_stream] | 1192 video_receive_configs_[params_.ss.selected_stream] |
1193 .rtp.ulpfec.ulpfec_payload_type = | 1193 .rtp.ulpfec.ulpfec_payload_type = |
1194 video_send_config_.rtp.ulpfec.ulpfec_payload_type; | 1194 video_send_config_.rtp.ulpfec.ulpfec_payload_type; |
1195 video_receive_configs_[params_.ss.selected_stream] | 1195 video_receive_configs_[params_.ss.selected_stream] |
1196 .rtp.ulpfec.red_rtx_payload_type = | 1196 .rtp.ulpfec.red_rtx_payload_type = |
1197 video_send_config_.rtp.ulpfec.red_rtx_payload_type; | 1197 video_send_config_.rtp.ulpfec.red_rtx_payload_type; |
1198 } | 1198 } |
1199 } | 1199 } |
1200 | 1200 |
1201 void VideoQualityTest::SetupScreenshare() { | 1201 void VideoQualityTest::SetupScreenshareOrSVC() { |
1202 RTC_CHECK(params_.screenshare.enabled); | 1202 if (params_.screenshare.enabled) { |
| 1203 // Fill out codec settings. |
| 1204 video_encoder_config_.content_type = |
| 1205 VideoEncoderConfig::ContentType::kScreen; |
| 1206 degradation_preference_ = |
| 1207 VideoSendStream::DegradationPreference::kMaintainResolution; |
| 1208 if (params_.video.codec == "VP8") { |
| 1209 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); |
| 1210 vp8_settings.denoisingOn = false; |
| 1211 vp8_settings.frameDroppingOn = false; |
| 1212 vp8_settings.numberOfTemporalLayers = |
| 1213 static_cast<unsigned char>(params_.video.num_temporal_layers); |
| 1214 video_encoder_config_.encoder_specific_settings = |
| 1215 new rtc::RefCountedObject< |
| 1216 VideoEncoderConfig::Vp8EncoderSpecificSettings>(vp8_settings); |
| 1217 } else if (params_.video.codec == "VP9") { |
| 1218 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); |
| 1219 vp9_settings.denoisingOn = false; |
| 1220 vp9_settings.frameDroppingOn = false; |
| 1221 vp9_settings.numberOfTemporalLayers = |
| 1222 static_cast<unsigned char>(params_.video.num_temporal_layers); |
| 1223 vp9_settings.numberOfSpatialLayers = |
| 1224 static_cast<unsigned char>(params_.ss.num_spatial_layers); |
| 1225 video_encoder_config_.encoder_specific_settings = |
| 1226 new rtc::RefCountedObject< |
| 1227 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings); |
| 1228 } |
| 1229 // Setup frame generator. |
| 1230 const size_t kWidth = 1850; |
| 1231 const size_t kHeight = 1110; |
| 1232 std::vector<std::string> slides; |
| 1233 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv")); |
| 1234 slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv")); |
| 1235 slides.push_back(test::ResourcePath("photo_1850_1110", "yuv")); |
| 1236 slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv")); |
1203 | 1237 |
1204 // Fill out codec settings. | 1238 if (params_.screenshare.scroll_duration == 0) { |
1205 video_encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen; | 1239 // Cycle image every slide_change_interval seconds. |
1206 degradation_preference_ = | 1240 frame_generator_.reset(test::FrameGenerator::CreateFromYuvFile( |
1207 VideoSendStream::DegradationPreference::kMaintainResolution; | 1241 slides, kWidth, kHeight, |
1208 if (params_.video.codec == "VP8") { | 1242 params_.screenshare.slide_change_interval * params_.video.fps)); |
1209 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); | 1243 } else { |
1210 vp8_settings.denoisingOn = false; | 1244 RTC_CHECK_LE(params_.video.width, kWidth); |
1211 vp8_settings.frameDroppingOn = false; | 1245 RTC_CHECK_LE(params_.video.height, kHeight); |
1212 vp8_settings.numberOfTemporalLayers = | 1246 RTC_CHECK_GT(params_.screenshare.slide_change_interval, 0); |
1213 static_cast<unsigned char>(params_.video.num_temporal_layers); | 1247 const int kPauseDurationMs = (params_.screenshare.slide_change_interval - |
1214 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< | 1248 params_.screenshare.scroll_duration) * |
1215 VideoEncoderConfig::Vp8EncoderSpecificSettings>(vp8_settings); | 1249 1000; |
1216 } else if (params_.video.codec == "VP9") { | 1250 RTC_CHECK_LE(params_.screenshare.scroll_duration, |
| 1251 params_.screenshare.slide_change_interval); |
| 1252 |
| 1253 frame_generator_.reset( |
| 1254 test::FrameGenerator::CreateScrollingInputFromYuvFiles( |
| 1255 clock_, slides, kWidth, kHeight, params_.video.width, |
| 1256 params_.video.height, params_.screenshare.scroll_duration * 1000, |
| 1257 kPauseDurationMs)); |
| 1258 } |
| 1259 } else if (params_.ss.num_spatial_layers > 1) { // For non-screenshare case. |
| 1260 RTC_CHECK(params_.video.codec == "VP9"); |
1217 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); | 1261 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); |
1218 vp9_settings.denoisingOn = false; | |
1219 vp9_settings.frameDroppingOn = false; | |
1220 vp9_settings.numberOfTemporalLayers = | 1262 vp9_settings.numberOfTemporalLayers = |
1221 static_cast<unsigned char>(params_.video.num_temporal_layers); | 1263 static_cast<unsigned char>(params_.video.num_temporal_layers); |
1222 vp9_settings.numberOfSpatialLayers = | 1264 vp9_settings.numberOfSpatialLayers = |
1223 static_cast<unsigned char>(params_.ss.num_spatial_layers); | 1265 static_cast<unsigned char>(params_.ss.num_spatial_layers); |
1224 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< | 1266 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< |
1225 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings); | 1267 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings); |
1226 } | 1268 } |
1227 | |
1228 // Setup frame generator. | |
1229 const size_t kWidth = 1850; | |
1230 const size_t kHeight = 1110; | |
1231 std::vector<std::string> slides; | |
1232 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv")); | |
1233 slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv")); | |
1234 slides.push_back(test::ResourcePath("photo_1850_1110", "yuv")); | |
1235 slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv")); | |
1236 | |
1237 if (params_.screenshare.scroll_duration == 0) { | |
1238 // Cycle image every slide_change_interval seconds. | |
1239 frame_generator_.reset(test::FrameGenerator::CreateFromYuvFile( | |
1240 slides, kWidth, kHeight, | |
1241 params_.screenshare.slide_change_interval * params_.video.fps)); | |
1242 } else { | |
1243 RTC_CHECK_LE(params_.video.width, kWidth); | |
1244 RTC_CHECK_LE(params_.video.height, kHeight); | |
1245 RTC_CHECK_GT(params_.screenshare.slide_change_interval, 0); | |
1246 const int kPauseDurationMs = (params_.screenshare.slide_change_interval - | |
1247 params_.screenshare.scroll_duration) * | |
1248 1000; | |
1249 RTC_CHECK_LE(params_.screenshare.scroll_duration, | |
1250 params_.screenshare.slide_change_interval); | |
1251 | |
1252 frame_generator_.reset( | |
1253 test::FrameGenerator::CreateScrollingInputFromYuvFiles( | |
1254 clock_, slides, kWidth, kHeight, params_.video.width, | |
1255 params_.video.height, params_.screenshare.scroll_duration * 1000, | |
1256 kPauseDurationMs)); | |
1257 } | |
1258 } | 1269 } |
1259 | 1270 |
1260 void VideoQualityTest::CreateCapturer() { | 1271 void VideoQualityTest::CreateCapturer() { |
1261 if (params_.screenshare.enabled) { | 1272 if (params_.screenshare.enabled) { |
1262 test::FrameGeneratorCapturer* frame_generator_capturer = | 1273 test::FrameGeneratorCapturer* frame_generator_capturer = |
1263 new test::FrameGeneratorCapturer(clock_, frame_generator_.release(), | 1274 new test::FrameGeneratorCapturer(clock_, frame_generator_.release(), |
1264 params_.video.fps); | 1275 params_.video.fps); |
1265 EXPECT_TRUE(frame_generator_capturer->Init()); | 1276 EXPECT_TRUE(frame_generator_capturer->Init()); |
1266 video_capturer_.reset(frame_generator_capturer); | 1277 video_capturer_.reset(frame_generator_capturer); |
1267 } else { | 1278 } else { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 std::string graph_title = params_.analyzer.graph_title; | 1328 std::string graph_title = params_.analyzer.graph_title; |
1318 if (graph_title.empty()) | 1329 if (graph_title.empty()) |
1319 graph_title = VideoQualityTest::GenerateGraphTitle(); | 1330 graph_title = VideoQualityTest::GenerateGraphTitle(); |
1320 | 1331 |
1321 // In the case of different resolutions, the functions calculating PSNR and | 1332 // In the case of different resolutions, the functions calculating PSNR and |
1322 // SSIM return -1.0, instead of a positive value as usual. VideoAnalyzer | 1333 // SSIM return -1.0, instead of a positive value as usual. VideoAnalyzer |
1323 // aborts if the average psnr/ssim are below the given threshold, which is | 1334 // aborts if the average psnr/ssim are below the given threshold, which is |
1324 // 0.0 by default. Setting the thresholds to -1.1 prevents the unnecessary | 1335 // 0.0 by default. Setting the thresholds to -1.1 prevents the unnecessary |
1325 // abort. | 1336 // abort. |
1326 VideoStream& selected_stream = params_.ss.streams[params_.ss.selected_stream]; | 1337 VideoStream& selected_stream = params_.ss.streams[params_.ss.selected_stream]; |
1327 int selected_sl = params_.ss.selected_sl != -1 | |
1328 ? params_.ss.selected_sl | |
1329 : params_.ss.num_spatial_layers - 1; | |
1330 bool disable_quality_check = | |
1331 selected_stream.width != params_.video.width || | |
1332 selected_stream.height != params_.video.height || | |
1333 (!params_.ss.spatial_layers.empty() && | |
1334 params_.ss.spatial_layers[selected_sl].scaling_factor_num != | |
1335 params_.ss.spatial_layers[selected_sl].scaling_factor_den); | |
1336 if (disable_quality_check) { | |
1337 fprintf(stderr, | |
1338 "Warning: Calculating PSNR and SSIM for downsized resolution " | |
1339 "not implemented yet! Skipping PSNR and SSIM calculations!\n"); | |
1340 } | |
1341 | 1338 |
1342 VideoAnalyzer analyzer( | 1339 VideoAnalyzer analyzer( |
1343 &send_transport, params_.analyzer.test_label, | 1340 &send_transport, params_.analyzer.test_label, |
1344 disable_quality_check ? -1.1 : params_.analyzer.avg_psnr_threshold, | 1341 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, |
1345 disable_quality_check ? -1.1 : params_.analyzer.avg_ssim_threshold, | |
1346 params_.analyzer.test_durations_secs * params_.video.fps, | 1342 params_.analyzer.test_durations_secs * params_.video.fps, |
1347 graph_data_output_file, graph_title, | 1343 graph_data_output_file, graph_title, |
1348 kVideoSendSsrcs[params_.ss.selected_stream], | 1344 kVideoSendSsrcs[params_.ss.selected_stream], |
1349 kSendRtxSsrcs[params_.ss.selected_stream], | 1345 kSendRtxSsrcs[params_.ss.selected_stream], |
1350 static_cast<uint32_t>(selected_stream.width), | 1346 static_cast<uint32_t>(selected_stream.width), |
1351 static_cast<uint32_t>(selected_stream.height)); | 1347 static_cast<uint32_t>(selected_stream.height)); |
1352 | 1348 |
1353 analyzer.SetReceiver(receiver_call_->Receiver()); | 1349 analyzer.SetReceiver(receiver_call_->Receiver()); |
1354 send_transport.SetReceiver(&analyzer); | 1350 send_transport.SetReceiver(&analyzer); |
1355 recv_transport.SetReceiver(sender_call_->Receiver()); | 1351 recv_transport.SetReceiver(sender_call_->Receiver()); |
1356 | 1352 |
1357 SetupVideo(&analyzer, &recv_transport); | 1353 SetupVideo(&analyzer, &recv_transport); |
1358 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; | 1354 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; |
1359 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); | 1355 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); |
1360 for (auto& config : video_receive_configs_) | 1356 for (auto& config : video_receive_configs_) |
1361 config.pre_decode_callback = &analyzer; | 1357 config.pre_decode_callback = &analyzer; |
1362 RTC_DCHECK(!video_send_config_.post_encode_callback); | 1358 RTC_DCHECK(!video_send_config_.post_encode_callback); |
1363 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); | 1359 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); |
1364 | 1360 |
1365 if (params_.screenshare.enabled) | 1361 SetupScreenshareOrSVC(); |
1366 SetupScreenshare(); | |
1367 | 1362 |
1368 CreateFlexfecStreams(); | 1363 CreateFlexfecStreams(); |
1369 CreateVideoStreams(); | 1364 CreateVideoStreams(); |
1370 analyzer.SetSendStream(video_send_stream_); | 1365 analyzer.SetSendStream(video_send_stream_); |
1371 if (video_receive_streams_.size() == 1) | 1366 if (video_receive_streams_.size() == 1) |
1372 analyzer.SetReceiveStream(video_receive_streams_[0]); | 1367 analyzer.SetReceiveStream(video_receive_streams_[0]); |
1373 | 1368 |
1374 video_send_stream_->SetSource(analyzer.OutputInterface(), | 1369 video_send_stream_->SetSource(analyzer.OutputInterface(), |
1375 degradation_preference_); | 1370 degradation_preference_); |
1376 | 1371 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 title.c_str(), params_.ss.streams[stream_id].width, | 1490 title.c_str(), params_.ss.streams[stream_id].width, |
1496 params_.ss.streams[stream_id].height)); | 1491 params_.ss.streams[stream_id].height)); |
1497 | 1492 |
1498 SetupVideo(&transport, &transport); | 1493 SetupVideo(&transport, &transport); |
1499 video_send_config_.pre_encode_callback = local_preview.get(); | 1494 video_send_config_.pre_encode_callback = local_preview.get(); |
1500 video_receive_configs_[stream_id].renderer = loopback_video.get(); | 1495 video_receive_configs_[stream_id].renderer = loopback_video.get(); |
1501 if (params_.audio.enabled && params_.audio.sync_video) | 1496 if (params_.audio.enabled && params_.audio.sync_video) |
1502 video_receive_configs_[stream_id].sync_group = kSyncGroup; | 1497 video_receive_configs_[stream_id].sync_group = kSyncGroup; |
1503 | 1498 |
1504 if (params_.screenshare.enabled) | 1499 if (params_.screenshare.enabled) |
1505 SetupScreenshare(); | 1500 SetupScreenshareOrSVC(); |
1506 | 1501 |
1507 video_send_stream_ = call->CreateVideoSendStream( | 1502 video_send_stream_ = call->CreateVideoSendStream( |
1508 video_send_config_.Copy(), video_encoder_config_.Copy()); | 1503 video_send_config_.Copy(), video_encoder_config_.Copy()); |
1509 if (params_.video.flexfec) { | 1504 if (params_.video.flexfec) { |
1510 RTC_DCHECK(!flexfec_receive_configs_.empty()); | 1505 RTC_DCHECK(!flexfec_receive_configs_.empty()); |
1511 flexfec_receive_stream = | 1506 flexfec_receive_stream = |
1512 call->CreateFlexfecReceiveStream(flexfec_receive_configs_[0]); | 1507 call->CreateFlexfecReceiveStream(flexfec_receive_configs_[0]); |
1513 } | 1508 } |
1514 video_receive_stream = call->CreateVideoReceiveStream( | 1509 video_receive_stream = call->CreateVideoReceiveStream( |
1515 video_receive_configs_[stream_id].Copy()); | 1510 video_receive_configs_[stream_id].Copy()); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 std::ostringstream str; | 1592 std::ostringstream str; |
1598 str << receive_logs_++; | 1593 str << receive_logs_++; |
1599 std::string path = | 1594 std::string path = |
1600 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1595 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
1601 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1596 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
1602 10000000); | 1597 10000000); |
1603 } | 1598 } |
1604 } | 1599 } |
1605 | 1600 |
1606 } // namespace webrtc | 1601 } // namespace webrtc |
OLD | NEW |