Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 26 #include "webrtc/call/call.h" | 26 #include "webrtc/call/call.h" |
| 27 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 27 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
| 28 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 28 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
| 29 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" | 29 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" |
| 30 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 30 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
| 31 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 31 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 32 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | 32 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
| 33 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 33 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
| 34 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 34 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
| 35 #include "webrtc/system_wrappers/include/cpu_info.h" | 35 #include "webrtc/system_wrappers/include/cpu_info.h" |
| 36 #include "webrtc/system_wrappers/include/field_trial.h" | |
| 36 #include "webrtc/test/gtest.h" | 37 #include "webrtc/test/gtest.h" |
| 37 #include "webrtc/test/layer_filtering_transport.h" | 38 #include "webrtc/test/layer_filtering_transport.h" |
| 38 #include "webrtc/test/run_loop.h" | 39 #include "webrtc/test/run_loop.h" |
| 39 #include "webrtc/test/statistics.h" | 40 #include "webrtc/test/statistics.h" |
| 40 #include "webrtc/test/testsupport/fileutils.h" | 41 #include "webrtc/test/testsupport/fileutils.h" |
| 41 #include "webrtc/test/vcm_capturer.h" | 42 #include "webrtc/test/vcm_capturer.h" |
| 42 #include "webrtc/test/video_renderer.h" | 43 #include "webrtc/test/video_renderer.h" |
| 43 #include "webrtc/voice_engine/include/voe_base.h" | 44 #include "webrtc/voice_engine/include/voe_base.h" |
| 44 | 45 |
| 45 namespace { | 46 namespace { |
| 46 | 47 |
| 47 constexpr int kSendStatsPollingIntervalMs = 1000; | 48 constexpr int kSendStatsPollingIntervalMs = 1000; |
| 48 constexpr int kPayloadTypeH264 = 122; | 49 constexpr int kPayloadTypeH264 = 122; |
| 49 constexpr int kPayloadTypeVP8 = 123; | 50 constexpr int kPayloadTypeVP8 = 123; |
| 50 constexpr int kPayloadTypeVP9 = 124; | 51 constexpr int kPayloadTypeVP9 = 124; |
| 51 constexpr size_t kMaxComparisons = 10; | 52 constexpr size_t kMaxComparisons = 10; |
| 52 constexpr char kSyncGroup[] = "av_sync"; | 53 constexpr char kSyncGroup[] = "av_sync"; |
| 53 constexpr int kOpusMinBitrateBps = 6000; | 54 constexpr int kOpusMinBitrateBps = 6000; |
| 54 constexpr int kOpusBitrateFbBps = 32000; | 55 constexpr int kOpusBitrateFbBps = 32000; |
| 56 constexpr int kFramesSentInQuickTest = 1; | |
| 55 | 57 |
| 56 struct VoiceEngineState { | 58 struct VoiceEngineState { |
| 57 VoiceEngineState() | 59 VoiceEngineState() |
| 58 : voice_engine(nullptr), | 60 : voice_engine(nullptr), |
| 59 base(nullptr), | 61 base(nullptr), |
| 60 send_channel_id(-1), | 62 send_channel_id(-1), |
| 61 receive_channel_id(-1) {} | 63 receive_channel_id(-1) {} |
| 62 | 64 |
| 63 webrtc::VoiceEngine* voice_engine; | 65 webrtc::VoiceEngine* voice_engine; |
| 64 webrtc::VoEBase* base; | 66 webrtc::VoEBase* base; |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 676 PrintResult("decode_time", decode_time_ms_, " ms"); | 678 PrintResult("decode_time", decode_time_ms_, " ms"); |
| 677 PrintResult("decode_time_max", decode_time_max_ms_, " ms"); | 679 PrintResult("decode_time_max", decode_time_max_ms_, " ms"); |
| 678 } | 680 } |
| 679 | 681 |
| 680 printf("RESULT dropped_frames: %s = %d frames\n", test_label_.c_str(), | 682 printf("RESULT dropped_frames: %s = %d frames\n", test_label_.c_str(), |
| 681 dropped_frames_); | 683 dropped_frames_); |
| 682 printf("RESULT dropped_frames_before_first_encode: %s = %d frames\n", | 684 printf("RESULT dropped_frames_before_first_encode: %s = %d frames\n", |
| 683 test_label_.c_str(), dropped_frames_before_first_encode_); | 685 test_label_.c_str(), dropped_frames_before_first_encode_); |
| 684 printf("RESULT dropped_frames_before_rendering: %s = %d frames\n", | 686 printf("RESULT dropped_frames_before_rendering: %s = %d frames\n", |
| 685 test_label_.c_str(), dropped_frames_before_rendering_); | 687 test_label_.c_str(), dropped_frames_before_rendering_); |
| 686 | 688 // Disable quality check for quick test, as quality checks may fail |
| 687 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); | 689 // because too few samples were collected. |
| 688 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); | 690 if (field_trial::FindFullName("WebRTC-quick") != "Enabled") { |
|
sprang_webrtc
2017/02/14 13:36:12
Can we make the name a bit more descriptive?
Somet
ilnik
2017/02/14 13:49:49
Acknowledged.
| |
| 691 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); | |
| 692 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); | |
| 693 } | |
| 689 } | 694 } |
| 690 | 695 |
| 691 void PerformFrameComparison(const FrameComparison& comparison) { | 696 void PerformFrameComparison(const FrameComparison& comparison) { |
| 692 // Perform expensive psnr and ssim calculations while not holding lock. | 697 // Perform expensive psnr and ssim calculations while not holding lock. |
| 693 double psnr = -1.0; | 698 double psnr = -1.0; |
| 694 double ssim = -1.0; | 699 double ssim = -1.0; |
| 695 if (comparison.reference) { | 700 if (comparison.reference) { |
| 696 psnr = I420PSNR(&*comparison.reference, &*comparison.render); | 701 psnr = I420PSNR(&*comparison.reference, &*comparison.render); |
| 697 ssim = I420SSIM(&*comparison.reference, &*comparison.render); | 702 ssim = I420SSIM(&*comparison.reference, &*comparison.render); |
| 698 } | 703 } |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1332 selected_stream.height != params_.video.height || | 1337 selected_stream.height != params_.video.height || |
| 1333 (!params_.ss.spatial_layers.empty() && | 1338 (!params_.ss.spatial_layers.empty() && |
| 1334 params_.ss.spatial_layers[selected_sl].scaling_factor_num != | 1339 params_.ss.spatial_layers[selected_sl].scaling_factor_num != |
| 1335 params_.ss.spatial_layers[selected_sl].scaling_factor_den); | 1340 params_.ss.spatial_layers[selected_sl].scaling_factor_den); |
| 1336 if (disable_quality_check) { | 1341 if (disable_quality_check) { |
| 1337 fprintf(stderr, | 1342 fprintf(stderr, |
| 1338 "Warning: Calculating PSNR and SSIM for downsized resolution " | 1343 "Warning: Calculating PSNR and SSIM for downsized resolution " |
| 1339 "not implemented yet! Skipping PSNR and SSIM calculations!\n"); | 1344 "not implemented yet! Skipping PSNR and SSIM calculations!\n"); |
| 1340 } | 1345 } |
| 1341 | 1346 |
| 1347 bool quick_tests = field_trial::FindFullName("WebRTC-quick") == "Enabled"; | |
|
sprang_webrtc
2017/02/14 13:36:12
Maybe move this to the constants at the top, in th
ilnik
2017/02/14 13:49:49
Acknowledged.
| |
| 1342 VideoAnalyzer analyzer( | 1348 VideoAnalyzer analyzer( |
| 1343 &send_transport, params_.analyzer.test_label, | 1349 &send_transport, params_.analyzer.test_label, |
| 1344 disable_quality_check ? -1.1 : params_.analyzer.avg_psnr_threshold, | 1350 disable_quality_check ? -1.1 : params_.analyzer.avg_psnr_threshold, |
| 1345 disable_quality_check ? -1.1 : params_.analyzer.avg_ssim_threshold, | 1351 disable_quality_check ? -1.1 : params_.analyzer.avg_ssim_threshold, |
| 1346 params_.analyzer.test_durations_secs * params_.video.fps, | 1352 quick_tests ? kFramesSentInQuickTest |
| 1353 : params_.analyzer.test_durations_secs * params_.video.fps, | |
| 1347 graph_data_output_file, graph_title, | 1354 graph_data_output_file, graph_title, |
| 1348 kVideoSendSsrcs[params_.ss.selected_stream], | 1355 kVideoSendSsrcs[params_.ss.selected_stream], |
| 1349 kSendRtxSsrcs[params_.ss.selected_stream], | 1356 kSendRtxSsrcs[params_.ss.selected_stream], |
| 1350 static_cast<uint32_t>(selected_stream.width), | 1357 static_cast<uint32_t>(selected_stream.width), |
| 1351 static_cast<uint32_t>(selected_stream.height)); | 1358 static_cast<uint32_t>(selected_stream.height)); |
| 1352 | |
| 1353 analyzer.SetReceiver(receiver_call_->Receiver()); | 1359 analyzer.SetReceiver(receiver_call_->Receiver()); |
| 1354 send_transport.SetReceiver(&analyzer); | 1360 send_transport.SetReceiver(&analyzer); |
| 1355 recv_transport.SetReceiver(sender_call_->Receiver()); | 1361 recv_transport.SetReceiver(sender_call_->Receiver()); |
| 1356 | 1362 |
| 1357 SetupVideo(&analyzer, &recv_transport); | 1363 SetupVideo(&analyzer, &recv_transport); |
| 1358 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; | 1364 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; |
| 1359 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); | 1365 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); |
| 1360 for (auto& config : video_receive_configs_) | 1366 for (auto& config : video_receive_configs_) |
| 1361 config.pre_decode_callback = &analyzer; | 1367 config.pre_decode_callback = &analyzer; |
| 1362 RTC_DCHECK(!video_send_config_.post_encode_callback); | 1368 RTC_DCHECK(!video_send_config_.post_encode_callback); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1597 std::ostringstream str; | 1603 std::ostringstream str; |
| 1598 str << receive_logs_++; | 1604 str << receive_logs_++; |
| 1599 std::string path = | 1605 std::string path = |
| 1600 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1606 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
| 1601 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1607 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
| 1602 10000000); | 1608 10000000); |
| 1603 } | 1609 } |
| 1604 } | 1610 } |
| 1605 | 1611 |
| 1606 } // namespace webrtc | 1612 } // namespace webrtc |
| OLD | NEW |