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 <sstream> | 16 #include <sstream> |
17 #include <string> | 17 #include <string> |
18 #include <vector> | 18 #include <vector> |
19 | 19 |
20 #include "webrtc/base/checks.h" | 20 #include "webrtc/base/checks.h" |
21 #include "webrtc/base/cpu_time.h" | 21 #include "webrtc/base/cpu_time.h" |
22 #include "webrtc/base/event.h" | 22 #include "webrtc/base/event.h" |
23 #include "webrtc/base/format_macros.h" | 23 #include "webrtc/base/format_macros.h" |
| 24 #include "webrtc/base/memory_usage.h" |
24 #include "webrtc/base/optional.h" | 25 #include "webrtc/base/optional.h" |
25 #include "webrtc/base/platform_file.h" | 26 #include "webrtc/base/platform_file.h" |
26 #include "webrtc/base/timeutils.h" | 27 #include "webrtc/base/timeutils.h" |
27 #include "webrtc/call/call.h" | 28 #include "webrtc/call/call.h" |
28 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 29 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
29 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 30 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
30 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" | 31 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" |
31 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 32 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
32 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" | 33 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" |
33 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 34 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 if (send_stats.media_bitrate_bps > 0) | 648 if (send_stats.media_bitrate_bps > 0) |
648 media_bitrate_bps_.AddSample(send_stats.media_bitrate_bps); | 649 media_bitrate_bps_.AddSample(send_stats.media_bitrate_bps); |
649 | 650 |
650 if (receive_stream_ != nullptr) { | 651 if (receive_stream_ != nullptr) { |
651 VideoReceiveStream::Stats receive_stats = receive_stream_->GetStats(); | 652 VideoReceiveStream::Stats receive_stats = receive_stream_->GetStats(); |
652 if (receive_stats.decode_ms > 0) | 653 if (receive_stats.decode_ms > 0) |
653 decode_time_ms_.AddSample(receive_stats.decode_ms); | 654 decode_time_ms_.AddSample(receive_stats.decode_ms); |
654 if (receive_stats.max_decode_ms > 0) | 655 if (receive_stats.max_decode_ms > 0) |
655 decode_time_max_ms_.AddSample(receive_stats.max_decode_ms); | 656 decode_time_max_ms_.AddSample(receive_stats.max_decode_ms); |
656 } | 657 } |
| 658 |
| 659 memory_usage_.AddSample(rtc::GetProcessResidentSizeBytes()); |
657 } | 660 } |
658 } | 661 } |
659 | 662 |
660 static bool FrameComparisonThread(void* obj) { | 663 static bool FrameComparisonThread(void* obj) { |
661 return static_cast<VideoAnalyzer*>(obj)->CompareFrames(); | 664 return static_cast<VideoAnalyzer*>(obj)->CompareFrames(); |
662 } | 665 } |
663 | 666 |
664 bool CompareFrames() { | 667 bool CompareFrames() { |
665 if (AllFramesRecorded()) | 668 if (AllFramesRecorded()) |
666 return false; | 669 return false; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 } | 762 } |
760 | 763 |
761 printf("RESULT dropped_frames: %s = %d frames\n", test_label_.c_str(), | 764 printf("RESULT dropped_frames: %s = %d frames\n", test_label_.c_str(), |
762 dropped_frames_); | 765 dropped_frames_); |
763 printf("RESULT dropped_frames_before_first_encode: %s = %d frames\n", | 766 printf("RESULT dropped_frames_before_first_encode: %s = %d frames\n", |
764 test_label_.c_str(), dropped_frames_before_first_encode_); | 767 test_label_.c_str(), dropped_frames_before_first_encode_); |
765 printf("RESULT dropped_frames_before_rendering: %s = %d frames\n", | 768 printf("RESULT dropped_frames_before_rendering: %s = %d frames\n", |
766 test_label_.c_str(), dropped_frames_before_rendering_); | 769 test_label_.c_str(), dropped_frames_before_rendering_); |
767 printf("RESULT cpu_usage: %s = %lf %%\n", test_label_.c_str(), | 770 printf("RESULT cpu_usage: %s = %lf %%\n", test_label_.c_str(), |
768 GetCpuUsagePercent()); | 771 GetCpuUsagePercent()); |
| 772 |
| 773 #if defined(WEBRTC_WIN) |
| 774 // On Linux and Mac in Resident Set some unused pages may be counted. |
| 775 // Therefore this metric will depend on order in which tests are run and |
| 776 // will be flaky. |
| 777 PrintResult("memory_usage", memory_usage_, " bytes"); |
| 778 #endif |
| 779 |
769 // Disable quality check for quick test, as quality checks may fail | 780 // Disable quality check for quick test, as quality checks may fail |
770 // because too few samples were collected. | 781 // because too few samples were collected. |
771 if (!is_quick_test_enabled_) { | 782 if (!is_quick_test_enabled_) { |
772 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); | 783 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); |
773 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); | 784 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); |
774 } | 785 } |
775 } | 786 } |
776 | 787 |
777 void PerformFrameComparison(const FrameComparison& comparison) { | 788 void PerformFrameComparison(const FrameComparison& comparison) { |
778 // Perform expensive psnr and ssim calculations while not holding lock. | 789 // Perform expensive psnr and ssim calculations while not holding lock. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 test::Statistics ssim_ GUARDED_BY(comparison_lock_); | 971 test::Statistics ssim_ GUARDED_BY(comparison_lock_); |
961 test::Statistics end_to_end_ GUARDED_BY(comparison_lock_); | 972 test::Statistics end_to_end_ GUARDED_BY(comparison_lock_); |
962 test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_); | 973 test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_); |
963 test::Statistics encoded_frame_size_ GUARDED_BY(comparison_lock_); | 974 test::Statistics encoded_frame_size_ GUARDED_BY(comparison_lock_); |
964 test::Statistics encode_frame_rate_ GUARDED_BY(comparison_lock_); | 975 test::Statistics encode_frame_rate_ GUARDED_BY(comparison_lock_); |
965 test::Statistics encode_time_ms_ GUARDED_BY(comparison_lock_); | 976 test::Statistics encode_time_ms_ GUARDED_BY(comparison_lock_); |
966 test::Statistics encode_usage_percent_ GUARDED_BY(comparison_lock_); | 977 test::Statistics encode_usage_percent_ GUARDED_BY(comparison_lock_); |
967 test::Statistics decode_time_ms_ GUARDED_BY(comparison_lock_); | 978 test::Statistics decode_time_ms_ GUARDED_BY(comparison_lock_); |
968 test::Statistics decode_time_max_ms_ GUARDED_BY(comparison_lock_); | 979 test::Statistics decode_time_max_ms_ GUARDED_BY(comparison_lock_); |
969 test::Statistics media_bitrate_bps_ GUARDED_BY(comparison_lock_); | 980 test::Statistics media_bitrate_bps_ GUARDED_BY(comparison_lock_); |
| 981 test::Statistics memory_usage_ GUARDED_BY(comparison_lock_); |
| 982 |
970 | 983 |
971 const int frames_to_process_; | 984 const int frames_to_process_; |
972 int frames_recorded_; | 985 int frames_recorded_; |
973 int frames_processed_; | 986 int frames_processed_; |
974 int dropped_frames_; | 987 int dropped_frames_; |
975 int dropped_frames_before_first_encode_; | 988 int dropped_frames_before_first_encode_; |
976 int dropped_frames_before_rendering_; | 989 int dropped_frames_before_rendering_; |
977 int64_t last_render_time_; | 990 int64_t last_render_time_; |
978 uint32_t rtp_timestamp_delta_; | 991 uint32_t rtp_timestamp_delta_; |
979 int64_t total_media_bytes_; | 992 int64_t total_media_bytes_; |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 std::ostringstream str; | 1714 std::ostringstream str; |
1702 str << receive_logs_++; | 1715 str << receive_logs_++; |
1703 std::string path = | 1716 std::string path = |
1704 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1717 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
1705 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1718 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
1706 10000000); | 1719 10000000); |
1707 } | 1720 } |
1708 } | 1721 } |
1709 | 1722 |
1710 } // namespace webrtc | 1723 } // namespace webrtc |
OLD | NEW |