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 18 matching lines...) Expand all Loading... | |
29 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | 29 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
30 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 30 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
31 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" | 31 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" |
32 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 32 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
33 #include "webrtc/rtc_base/checks.h" | 33 #include "webrtc/rtc_base/checks.h" |
34 #include "webrtc/rtc_base/cpu_time.h" | 34 #include "webrtc/rtc_base/cpu_time.h" |
35 #include "webrtc/rtc_base/event.h" | 35 #include "webrtc/rtc_base/event.h" |
36 #include "webrtc/rtc_base/format_macros.h" | 36 #include "webrtc/rtc_base/format_macros.h" |
37 #include "webrtc/rtc_base/memory_usage.h" | 37 #include "webrtc/rtc_base/memory_usage.h" |
38 #include "webrtc/rtc_base/optional.h" | 38 #include "webrtc/rtc_base/optional.h" |
39 #include "webrtc/rtc_base/pathutils.h" | |
39 #include "webrtc/rtc_base/platform_file.h" | 40 #include "webrtc/rtc_base/platform_file.h" |
40 #include "webrtc/rtc_base/timeutils.h" | 41 #include "webrtc/rtc_base/timeutils.h" |
41 #include "webrtc/system_wrappers/include/cpu_info.h" | 42 #include "webrtc/system_wrappers/include/cpu_info.h" |
42 #include "webrtc/system_wrappers/include/field_trial.h" | 43 #include "webrtc/system_wrappers/include/field_trial.h" |
43 #include "webrtc/test/gtest.h" | 44 #include "webrtc/test/gtest.h" |
44 #include "webrtc/test/layer_filtering_transport.h" | 45 #include "webrtc/test/layer_filtering_transport.h" |
45 #include "webrtc/test/run_loop.h" | 46 #include "webrtc/test/run_loop.h" |
46 #include "webrtc/test/statistics.h" | 47 #include "webrtc/test/statistics.h" |
47 #include "webrtc/test/testsupport/fileutils.h" | 48 #include "webrtc/test/testsupport/fileutils.h" |
48 #include "webrtc/test/testsupport/frame_writer.h" | 49 #include "webrtc/test/testsupport/frame_writer.h" |
50 #include "webrtc/test/testsupport/test_output.h" | |
49 #include "webrtc/test/vcm_capturer.h" | 51 #include "webrtc/test/vcm_capturer.h" |
50 #include "webrtc/test/video_renderer.h" | 52 #include "webrtc/test/video_renderer.h" |
51 #include "webrtc/voice_engine/include/voe_base.h" | 53 #include "webrtc/voice_engine/include/voe_base.h" |
52 | 54 |
53 #include "webrtc/test/rtp_file_writer.h" | 55 #include "webrtc/test/rtp_file_writer.h" |
54 | 56 |
55 namespace { | 57 namespace { |
56 | 58 |
57 constexpr int kSendStatsPollingIntervalMs = 1000; | 59 constexpr int kSendStatsPollingIntervalMs = 1000; |
58 | 60 |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
817 dropped_frames_); | 819 dropped_frames_); |
818 printf("RESULT cpu_usage: %s = %lf %%\n", test_label_.c_str(), | 820 printf("RESULT cpu_usage: %s = %lf %%\n", test_label_.c_str(), |
819 GetCpuUsagePercent()); | 821 GetCpuUsagePercent()); |
820 | 822 |
821 #if defined(WEBRTC_WIN) | 823 #if defined(WEBRTC_WIN) |
822 // On Linux and Mac in Resident Set some unused pages may be counted. | 824 // On Linux and Mac in Resident Set some unused pages may be counted. |
823 // Therefore this metric will depend on order in which tests are run and | 825 // Therefore this metric will depend on order in which tests are run and |
824 // will be flaky. | 826 // will be flaky. |
825 PrintResult("memory_usage", memory_usage_, " bytes"); | 827 PrintResult("memory_usage", memory_usage_, " bytes"); |
826 #endif | 828 #endif |
827 // TODO(ilnik): enable frame writing for android, once jpeg frame writer | |
828 // is implemented. | |
829 | 829 |
830 #if !defined(WEBRTC_ANDROID) | 830 // LibJpeg is not available on iOS. |
831 #if !defined(WEBRTC_IOS) | |
831 if (worst_frame_) { | 832 if (worst_frame_) { |
pbos-webrtc
2017/07/26 18:48:03
Put a comment here saying why we try to save the w
ilnik
2017/08/17 11:35:07
Done.
| |
832 test::Y4mFrameWriterImpl frame_writer(test_label_ + ".y4m", | 833 std::string output_dir; |
833 worst_frame_->frame.width(), | 834 bool res = test::GetTestOutputDir(&output_dir); |
834 worst_frame_->frame.height(), 1); | 835 if (!res) { |
835 bool res = frame_writer.Init(); | 836 output_dir = ""; |
pbos-webrtc
2017/07/26 18:48:03
if (!test::GetTestOutputDir(&output_dir)) {
}
No
ilnik
2017/08/17 11:35:07
Done.
| |
837 } | |
838 std::string output_path = | |
839 rtc::Pathname(output_dir, test_label_ + ".jpg").pathname(); | |
840 fprintf(stderr, "Saving worst frame to %s\n", output_path.c_str()); | |
841 test::JpegFrameWriter frame_writer(output_path); | |
842 res = frame_writer.WriteFrame(worst_frame_->frame, 100 /*quality*/); | |
836 RTC_DCHECK(res); | 843 RTC_DCHECK(res); |
pbos-webrtc
2017/07/26 18:48:03
RTC_CHECK(frame_writer.WriteFrame(...));
And remo
ilnik
2017/08/17 11:35:07
Done.
| |
837 size_t length = | |
838 CalcBufferSize(VideoType::kI420, worst_frame_->frame.width(), | |
839 worst_frame_->frame.height()); | |
840 rtc::Buffer extracted_buffer(length); | |
841 size_t extracted_length = | |
842 ExtractBuffer(worst_frame_->frame.video_frame_buffer()->ToI420(), | |
843 length, extracted_buffer.data()); | |
844 RTC_DCHECK_EQ(extracted_length, frame_writer.FrameLength()); | |
845 res = frame_writer.WriteFrame(extracted_buffer.data()); | |
846 RTC_DCHECK(res); | |
847 frame_writer.Close(); | |
848 } | 844 } |
849 #endif | 845 #endif |
850 | 846 |
851 // Disable quality check for quick test, as quality checks may fail | 847 // Disable quality check for quick test, as quality checks may fail |
852 // because too few samples were collected. | 848 // because too few samples were collected. |
853 if (!is_quick_test_enabled_) { | 849 if (!is_quick_test_enabled_) { |
854 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); | 850 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); |
855 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); | 851 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); |
856 } | 852 } |
857 } | 853 } |
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2124 if (!params_.logging.encoded_frame_base_path.empty()) { | 2120 if (!params_.logging.encoded_frame_base_path.empty()) { |
2125 std::ostringstream str; | 2121 std::ostringstream str; |
2126 str << receive_logs_++; | 2122 str << receive_logs_++; |
2127 std::string path = | 2123 std::string path = |
2128 params_.logging.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 2124 params_.logging.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
2129 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 2125 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
2130 100000000); | 2126 100000000); |
2131 } | 2127 } |
2132 } | 2128 } |
2133 } // namespace webrtc | 2129 } // namespace webrtc |
OLD | NEW |