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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 322 |
323 rtc::CritScope lock(&crit_); | 323 rtc::CritScope lock(&crit_); |
324 int64_t send_timestamp = | 324 int64_t send_timestamp = |
325 wrap_handler_.Unwrap(video_frame.timestamp() - rtp_timestamp_delta_); | 325 wrap_handler_.Unwrap(video_frame.timestamp() - rtp_timestamp_delta_); |
326 | 326 |
327 while (wrap_handler_.Unwrap(frames_.front().timestamp()) < send_timestamp) { | 327 while (wrap_handler_.Unwrap(frames_.front().timestamp()) < send_timestamp) { |
328 if (!last_rendered_frame_) { | 328 if (!last_rendered_frame_) { |
329 // No previous frame rendered, this one was dropped after sending but | 329 // No previous frame rendered, this one was dropped after sending but |
330 // before rendering. | 330 // before rendering. |
331 ++dropped_frames_before_rendering_; | 331 ++dropped_frames_before_rendering_; |
332 frames_.pop_front(); | 332 } else { |
333 RTC_CHECK(!frames_.empty()); | 333 AddFrameComparison(frames_.front(), *last_rendered_frame_, true, |
334 continue; | 334 render_time_ms); |
335 } | 335 } |
336 AddFrameComparison(frames_.front(), *last_rendered_frame_, true, | |
337 render_time_ms); | |
338 frames_.pop_front(); | 336 frames_.pop_front(); |
339 RTC_DCHECK(!frames_.empty()); | 337 RTC_DCHECK(!frames_.empty()); |
340 } | 338 } |
341 | 339 |
342 VideoFrame reference_frame = frames_.front(); | 340 VideoFrame reference_frame = frames_.front(); |
343 frames_.pop_front(); | 341 frames_.pop_front(); |
344 int64_t reference_timestamp = | 342 int64_t reference_timestamp = |
345 wrap_handler_.Unwrap(reference_frame.timestamp()); | 343 wrap_handler_.Unwrap(reference_frame.timestamp()); |
346 if (send_timestamp == reference_timestamp - 1) { | 344 if (send_timestamp == reference_timestamp - 1) { |
347 // TODO(ivica): Make this work for > 2 streams. | 345 // TODO(ivica): Make this work for > 2 streams. |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 .rtp.ulpfec.red_rtx_payload_type = | 1187 .rtp.ulpfec.red_rtx_payload_type = |
1190 video_send_config_.rtp.ulpfec.red_rtx_payload_type; | 1188 video_send_config_.rtp.ulpfec.red_rtx_payload_type; |
1191 } | 1189 } |
1192 } | 1190 } |
1193 | 1191 |
1194 void VideoQualityTest::SetupScreenshare() { | 1192 void VideoQualityTest::SetupScreenshare() { |
1195 RTC_CHECK(params_.screenshare.enabled); | 1193 RTC_CHECK(params_.screenshare.enabled); |
1196 | 1194 |
1197 // Fill out codec settings. | 1195 // Fill out codec settings. |
1198 video_encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen; | 1196 video_encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen; |
| 1197 degradation_preference_ = |
| 1198 VideoSendStream::DegradationPreference::kMaintainResolution; |
1199 if (params_.video.codec == "VP8") { | 1199 if (params_.video.codec == "VP8") { |
1200 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); | 1200 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); |
1201 vp8_settings.denoisingOn = false; | 1201 vp8_settings.denoisingOn = false; |
1202 vp8_settings.frameDroppingOn = false; | 1202 vp8_settings.frameDroppingOn = false; |
1203 vp8_settings.numberOfTemporalLayers = | 1203 vp8_settings.numberOfTemporalLayers = |
1204 static_cast<unsigned char>(params_.video.num_temporal_layers); | 1204 static_cast<unsigned char>(params_.video.num_temporal_layers); |
1205 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< | 1205 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< |
1206 VideoEncoderConfig::Vp8EncoderSpecificSettings>(vp8_settings); | 1206 VideoEncoderConfig::Vp8EncoderSpecificSettings>(vp8_settings); |
1207 } else if (params_.video.codec == "VP9") { | 1207 } else if (params_.video.codec == "VP9") { |
1208 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); | 1208 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); | 1353 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); |
1354 | 1354 |
1355 if (params_.screenshare.enabled) | 1355 if (params_.screenshare.enabled) |
1356 SetupScreenshare(); | 1356 SetupScreenshare(); |
1357 | 1357 |
1358 CreateFlexfecStreams(); | 1358 CreateFlexfecStreams(); |
1359 CreateVideoStreams(); | 1359 CreateVideoStreams(); |
1360 analyzer.SetSendStream(video_send_stream_); | 1360 analyzer.SetSendStream(video_send_stream_); |
1361 if (video_receive_streams_.size() == 1) | 1361 if (video_receive_streams_.size() == 1) |
1362 analyzer.SetReceiveStream(video_receive_streams_[0]); | 1362 analyzer.SetReceiveStream(video_receive_streams_[0]); |
1363 video_send_stream_->SetSource( | 1363 |
1364 analyzer.OutputInterface(), | 1364 video_send_stream_->SetSource(analyzer.OutputInterface(), |
1365 VideoSendStream::DegradationPreference::kBalanced); | 1365 degradation_preference_); |
1366 | 1366 |
1367 CreateCapturer(); | 1367 CreateCapturer(); |
1368 rtc::VideoSinkWants wants; | 1368 rtc::VideoSinkWants wants; |
1369 video_capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants); | 1369 video_capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants); |
1370 | 1370 |
1371 StartEncodedFrameLogs(video_send_stream_); | 1371 StartEncodedFrameLogs(video_send_stream_); |
1372 StartEncodedFrameLogs(video_receive_streams_[0]); | 1372 StartEncodedFrameLogs(video_receive_streams_[0]); |
1373 video_send_stream_->Start(); | 1373 video_send_stream_->Start(); |
1374 for (VideoReceiveStream* receive_stream : video_receive_streams_) | 1374 for (VideoReceiveStream* receive_stream : video_receive_streams_) |
1375 receive_stream->Start(); | 1375 receive_stream->Start(); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 video_send_stream_ = call->CreateVideoSendStream( | 1497 video_send_stream_ = call->CreateVideoSendStream( |
1498 video_send_config_.Copy(), video_encoder_config_.Copy()); | 1498 video_send_config_.Copy(), video_encoder_config_.Copy()); |
1499 if (params_.video.flexfec) { | 1499 if (params_.video.flexfec) { |
1500 RTC_DCHECK(!flexfec_receive_configs_.empty()); | 1500 RTC_DCHECK(!flexfec_receive_configs_.empty()); |
1501 flexfec_receive_stream = | 1501 flexfec_receive_stream = |
1502 call->CreateFlexfecReceiveStream(flexfec_receive_configs_[0]); | 1502 call->CreateFlexfecReceiveStream(flexfec_receive_configs_[0]); |
1503 } | 1503 } |
1504 video_receive_stream = call->CreateVideoReceiveStream( | 1504 video_receive_stream = call->CreateVideoReceiveStream( |
1505 video_receive_configs_[stream_id].Copy()); | 1505 video_receive_configs_[stream_id].Copy()); |
1506 CreateCapturer(); | 1506 CreateCapturer(); |
1507 video_send_stream_->SetSource( | 1507 video_send_stream_->SetSource(video_capturer_.get(), |
1508 video_capturer_.get(), | 1508 degradation_preference_); |
1509 VideoSendStream::DegradationPreference::kBalanced); | |
1510 } | 1509 } |
1511 | 1510 |
1512 AudioReceiveStream* audio_receive_stream = nullptr; | 1511 AudioReceiveStream* audio_receive_stream = nullptr; |
1513 if (params_.audio.enabled) { | 1512 if (params_.audio.enabled) { |
1514 SetupAudio(voe.send_channel_id, voe.receive_channel_id, call.get(), | 1513 SetupAudio(voe.send_channel_id, voe.receive_channel_id, call.get(), |
1515 &transport, &audio_receive_stream); | 1514 &transport, &audio_receive_stream); |
1516 } | 1515 } |
1517 | 1516 |
1518 StartEncodedFrameLogs(video_receive_stream); | 1517 StartEncodedFrameLogs(video_receive_stream); |
1519 StartEncodedFrameLogs(video_send_stream_); | 1518 StartEncodedFrameLogs(video_send_stream_); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 std::ostringstream str; | 1587 std::ostringstream str; |
1589 str << receive_logs_++; | 1588 str << receive_logs_++; |
1590 std::string path = | 1589 std::string path = |
1591 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1590 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
1592 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1591 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
1593 10000000); | 1592 10000000); |
1594 } | 1593 } |
1595 } | 1594 } |
1596 | 1595 |
1597 } // namespace webrtc | 1596 } // namespace webrtc |
OLD | NEW |