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 11 matching lines...) Expand all Loading... |
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/optional.h" | 24 #include "webrtc/base/optional.h" |
25 #include "webrtc/base/platform_file.h" | 25 #include "webrtc/base/platform_file.h" |
26 #include "webrtc/base/timeutils.h" | 26 #include "webrtc/base/timeutils.h" |
27 #include "webrtc/call/call.h" | 27 #include "webrtc/call/call.h" |
28 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 28 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
29 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 29 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
30 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" | 30 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" |
31 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 31 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
| 32 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" |
32 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 33 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
33 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | 34 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
34 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 35 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
35 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 36 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
36 #include "webrtc/system_wrappers/include/cpu_info.h" | 37 #include "webrtc/system_wrappers/include/cpu_info.h" |
37 #include "webrtc/system_wrappers/include/field_trial.h" | 38 #include "webrtc/system_wrappers/include/field_trial.h" |
38 #include "webrtc/test/gtest.h" | 39 #include "webrtc/test/gtest.h" |
39 #include "webrtc/test/layer_filtering_transport.h" | 40 #include "webrtc/test/layer_filtering_transport.h" |
40 #include "webrtc/test/run_loop.h" | 41 #include "webrtc/test/run_loop.h" |
41 #include "webrtc/test/statistics.h" | 42 #include "webrtc/test/statistics.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 bool IsFlexfec(int payload_type) { | 120 bool IsFlexfec(int payload_type) { |
120 return payload_type == webrtc::VideoQualityTest::kFlexfecPayloadType; | 121 return payload_type == webrtc::VideoQualityTest::kFlexfecPayloadType; |
121 } | 122 } |
122 | 123 |
123 } // namespace | 124 } // namespace |
124 | 125 |
125 namespace webrtc { | 126 namespace webrtc { |
126 | 127 |
127 class VideoAnalyzer : public PacketReceiver, | 128 class VideoAnalyzer : public PacketReceiver, |
128 public Transport, | 129 public Transport, |
129 public rtc::VideoSinkInterface<VideoFrame>, | 130 public rtc::VideoSinkInterface<VideoFrame> { |
130 public EncodedFrameObserver { | |
131 public: | 131 public: |
132 VideoAnalyzer(test::LayerFilteringTransport* transport, | 132 VideoAnalyzer(test::LayerFilteringTransport* transport, |
133 const std::string& test_label, | 133 const std::string& test_label, |
134 double avg_psnr_threshold, | 134 double avg_psnr_threshold, |
135 double avg_ssim_threshold, | 135 double avg_ssim_threshold, |
136 int duration_frames, | 136 int duration_frames, |
137 FILE* graph_data_output_file, | 137 FILE* graph_data_output_file, |
138 const std::string& graph_title, | 138 const std::string& graph_title, |
139 uint32_t ssrc_to_analyze, | 139 uint32_t ssrc_to_analyze, |
140 uint32_t rtx_ssrc_to_analyze, | 140 uint32_t rtx_ssrc_to_analyze, |
141 uint32_t selected_stream_width, | 141 uint32_t selected_stream_width, |
142 uint32_t selected_stream_height, | 142 uint32_t selected_stream_height, |
| 143 int selected_sl, |
| 144 int selected_tl, |
143 bool is_quick_test_enabled) | 145 bool is_quick_test_enabled) |
144 : transport_(transport), | 146 : transport_(transport), |
145 receiver_(nullptr), | 147 receiver_(nullptr), |
146 send_stream_(nullptr), | 148 send_stream_(nullptr), |
147 receive_stream_(nullptr), | 149 receive_stream_(nullptr), |
148 captured_frame_forwarder_(this), | 150 captured_frame_forwarder_(this), |
149 test_label_(test_label), | 151 test_label_(test_label), |
150 graph_data_output_file_(graph_data_output_file), | 152 graph_data_output_file_(graph_data_output_file), |
151 graph_title_(graph_title), | 153 graph_title_(graph_title), |
152 ssrc_to_analyze_(ssrc_to_analyze), | 154 ssrc_to_analyze_(ssrc_to_analyze), |
153 rtx_ssrc_to_analyze_(rtx_ssrc_to_analyze), | 155 rtx_ssrc_to_analyze_(rtx_ssrc_to_analyze), |
154 selected_stream_width_(selected_stream_width), | 156 selected_stream_width_(selected_stream_width), |
155 selected_stream_height_(selected_stream_height), | 157 selected_stream_height_(selected_stream_height), |
| 158 selected_sl_(selected_sl), |
| 159 selected_tl_(selected_tl), |
156 pre_encode_proxy_(this), | 160 pre_encode_proxy_(this), |
157 encode_timing_proxy_(this), | 161 encode_timing_proxy_(this), |
158 frames_to_process_(duration_frames), | 162 frames_to_process_(duration_frames), |
159 frames_recorded_(0), | 163 frames_recorded_(0), |
160 frames_processed_(0), | 164 frames_processed_(0), |
161 dropped_frames_(0), | 165 dropped_frames_(0), |
162 dropped_frames_before_first_encode_(0), | 166 dropped_frames_before_first_encode_(0), |
163 dropped_frames_before_rendering_(0), | 167 dropped_frames_before_rendering_(0), |
164 last_render_time_(0), | 168 last_render_time_(0), |
165 rtp_timestamp_delta_(0), | 169 rtp_timestamp_delta_(0), |
| 170 total_media_bytes_(0), |
| 171 first_sending_time_(0), |
| 172 last_sending_time_(0), |
166 cpu_time_(0), | 173 cpu_time_(0), |
167 wallclock_time_(0), | 174 wallclock_time_(0), |
168 avg_psnr_threshold_(avg_psnr_threshold), | 175 avg_psnr_threshold_(avg_psnr_threshold), |
169 avg_ssim_threshold_(avg_ssim_threshold), | 176 avg_ssim_threshold_(avg_ssim_threshold), |
170 is_quick_test_enabled_(is_quick_test_enabled), | 177 is_quick_test_enabled_(is_quick_test_enabled), |
171 stats_polling_thread_(&PollStatsThread, this, "StatsPoller"), | 178 stats_polling_thread_(&PollStatsThread, this, "StatsPoller"), |
172 comparison_available_event_(false, false), | 179 comparison_available_event_(false, false), |
173 done_(true, false) { | 180 done_(true, false) { |
174 // Create thread pool for CPU-expensive PSNR/SSIM calculations. | 181 // Create thread pool for CPU-expensive PSNR/SSIM calculations. |
175 | 182 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 } | 308 } |
302 | 309 |
303 if (!IsFlexfec(header.payloadType) && header.ssrc == ssrc_to_analyze_) { | 310 if (!IsFlexfec(header.payloadType) && header.ssrc == ssrc_to_analyze_) { |
304 // Ignore FlexFEC timestamps, to avoid collisions with media timestamps. | 311 // Ignore FlexFEC timestamps, to avoid collisions with media timestamps. |
305 // (FlexFEC and media are sent on different SSRCs, which have different | 312 // (FlexFEC and media are sent on different SSRCs, which have different |
306 // timestamps spaces.) | 313 // timestamps spaces.) |
307 // Also ignore packets from wrong SSRC and retransmits. | 314 // Also ignore packets from wrong SSRC and retransmits. |
308 int64_t timestamp = | 315 int64_t timestamp = |
309 wrap_handler_.Unwrap(header.timestamp - rtp_timestamp_delta_); | 316 wrap_handler_.Unwrap(header.timestamp - rtp_timestamp_delta_); |
310 send_times_[timestamp] = current_time; | 317 send_times_[timestamp] = current_time; |
311 if (!transport_->DiscardedLastPacket() && | 318 |
312 header.ssrc == ssrc_to_analyze_) { | 319 if (IsInSelectedSpatialAndTemporalLayer(packet, length, header)) { |
313 encoded_frame_sizes_[timestamp] += | 320 encoded_frame_sizes_[timestamp] += |
314 length - (header.headerLength + header.paddingLength); | 321 length - (header.headerLength + header.paddingLength); |
| 322 total_media_bytes_ += |
| 323 length - (header.headerLength + header.paddingLength); |
315 } | 324 } |
| 325 if (first_sending_time_ == 0) |
| 326 first_sending_time_ = current_time; |
| 327 last_sending_time_ = current_time; |
316 } | 328 } |
317 } | 329 } |
318 return result; | 330 return result; |
319 } | 331 } |
320 | 332 |
321 bool SendRtcp(const uint8_t* packet, size_t length) override { | 333 bool SendRtcp(const uint8_t* packet, size_t length) override { |
322 return transport_->SendRtcp(packet, length); | 334 return transport_->SendRtcp(packet, length); |
323 } | 335 } |
324 | 336 |
325 void EncodedFrameCallback(const EncodedFrame& frame) override { | |
326 rtc::CritScope lock(&comparison_lock_); | |
327 if (frames_recorded_ < frames_to_process_) | |
328 encoded_frame_size_.AddSample(frame.length_); | |
329 } | |
330 | |
331 void OnFrame(const VideoFrame& video_frame) override { | 337 void OnFrame(const VideoFrame& video_frame) override { |
332 int64_t render_time_ms = | 338 int64_t render_time_ms = |
333 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); | 339 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); |
334 | 340 |
335 rtc::CritScope lock(&crit_); | 341 rtc::CritScope lock(&crit_); |
336 | 342 |
337 StartExcludingCpuThreadTime(); | 343 StartExcludingCpuThreadTime(); |
338 | 344 |
339 int64_t send_timestamp = | 345 int64_t send_timestamp = |
340 wrap_handler_.Unwrap(video_frame.timestamp() - rtp_timestamp_delta_); | 346 wrap_handler_.Unwrap(video_frame.timestamp() - rtp_timestamp_delta_); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 explicit PreEncodeProxy(VideoAnalyzer* parent) : parent_(parent) {} | 555 explicit PreEncodeProxy(VideoAnalyzer* parent) : parent_(parent) {} |
550 | 556 |
551 void OnFrame(const VideoFrame& video_frame) override { | 557 void OnFrame(const VideoFrame& video_frame) override { |
552 parent_->PreEncodeOnFrame(video_frame); | 558 parent_->PreEncodeOnFrame(video_frame); |
553 } | 559 } |
554 | 560 |
555 private: | 561 private: |
556 VideoAnalyzer* const parent_; | 562 VideoAnalyzer* const parent_; |
557 }; | 563 }; |
558 | 564 |
| 565 bool IsInSelectedSpatialAndTemporalLayer(const uint8_t* packet, |
| 566 size_t length, |
| 567 const RTPHeader& header) { |
| 568 if (header.payloadType != kPayloadTypeVP9 && |
| 569 header.payloadType != kPayloadTypeVP8) { |
| 570 return true; |
| 571 } else { |
| 572 // Get VP8 and VP9 specific header to check layers indexes. |
| 573 const uint8_t* payload = packet + header.headerLength; |
| 574 const size_t payload_length = length - header.headerLength; |
| 575 const size_t payload_data_length = payload_length - header.paddingLength; |
| 576 const bool is_vp8 = header.payloadType == kPayloadTypeVP8; |
| 577 std::unique_ptr<RtpDepacketizer> depacketizer( |
| 578 RtpDepacketizer::Create(is_vp8 ? kRtpVideoVp8 : kRtpVideoVp9)); |
| 579 RtpDepacketizer::ParsedPayload parsed_payload; |
| 580 bool result = |
| 581 depacketizer->Parse(&parsed_payload, payload, payload_data_length); |
| 582 RTC_DCHECK(result); |
| 583 const int temporal_idx = static_cast<int>( |
| 584 is_vp8 ? parsed_payload.type.Video.codecHeader.VP8.temporalIdx |
| 585 : parsed_payload.type.Video.codecHeader.VP9.temporal_idx); |
| 586 const int spatial_idx = static_cast<int>( |
| 587 is_vp8 ? kNoSpatialIdx |
| 588 : parsed_payload.type.Video.codecHeader.VP9.spatial_idx); |
| 589 return (selected_tl_ < 0 || temporal_idx == kNoTemporalIdx || |
| 590 temporal_idx <= selected_tl_) && |
| 591 (selected_sl_ < 0 || spatial_idx == kNoSpatialIdx || |
| 592 spatial_idx <= selected_sl_); |
| 593 } |
| 594 } |
| 595 |
559 void AddFrameComparison(const VideoFrame& reference, | 596 void AddFrameComparison(const VideoFrame& reference, |
560 const VideoFrame& render, | 597 const VideoFrame& render, |
561 bool dropped, | 598 bool dropped, |
562 int64_t render_time_ms) | 599 int64_t render_time_ms) |
563 EXCLUSIVE_LOCKS_REQUIRED(crit_) { | 600 EXCLUSIVE_LOCKS_REQUIRED(crit_) { |
564 int64_t reference_timestamp = wrap_handler_.Unwrap(reference.timestamp()); | 601 int64_t reference_timestamp = wrap_handler_.Unwrap(reference.timestamp()); |
565 int64_t send_time_ms = send_times_[reference_timestamp]; | 602 int64_t send_time_ms = send_times_[reference_timestamp]; |
566 send_times_.erase(reference_timestamp); | 603 send_times_.erase(reference_timestamp); |
567 int64_t recv_time_ms = recv_times_[reference_timestamp]; | 604 int64_t recv_time_ms = recv_times_[reference_timestamp]; |
568 recv_times_.erase(reference_timestamp); | 605 recv_times_.erase(reference_timestamp); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 PrintResult("sender_time", sender_time_, " ms"); | 743 PrintResult("sender_time", sender_time_, " ms"); |
707 PrintResult("receiver_time", receiver_time_, " ms"); | 744 PrintResult("receiver_time", receiver_time_, " ms"); |
708 PrintResult("total_delay_incl_network", end_to_end_, " ms"); | 745 PrintResult("total_delay_incl_network", end_to_end_, " ms"); |
709 PrintResult("time_between_rendered_frames", rendered_delta_, " ms"); | 746 PrintResult("time_between_rendered_frames", rendered_delta_, " ms"); |
710 PrintResult("encoded_frame_size", encoded_frame_size_, " bytes"); | 747 PrintResult("encoded_frame_size", encoded_frame_size_, " bytes"); |
711 PrintResult("encode_frame_rate", encode_frame_rate_, " fps"); | 748 PrintResult("encode_frame_rate", encode_frame_rate_, " fps"); |
712 PrintResult("encode_time", encode_time_ms_, " ms"); | 749 PrintResult("encode_time", encode_time_ms_, " ms"); |
713 PrintResult("encode_usage_percent", encode_usage_percent_, " percent"); | 750 PrintResult("encode_usage_percent", encode_usage_percent_, " percent"); |
714 PrintResult("media_bitrate", media_bitrate_bps_, " bps"); | 751 PrintResult("media_bitrate", media_bitrate_bps_, " bps"); |
715 | 752 |
| 753 printf("RESULT actual_bitrate: %s = %.6lf bps\n", test_label_.c_str(), |
| 754 GetAverageMediaBitrateBps()); |
| 755 |
716 if (receive_stream_ != nullptr) { | 756 if (receive_stream_ != nullptr) { |
717 PrintResult("decode_time", decode_time_ms_, " ms"); | 757 PrintResult("decode_time", decode_time_ms_, " ms"); |
718 PrintResult("decode_time_max", decode_time_max_ms_, " ms"); | 758 PrintResult("decode_time_max", decode_time_max_ms_, " ms"); |
719 } | 759 } |
720 | 760 |
721 printf("RESULT dropped_frames: %s = %d frames\n", test_label_.c_str(), | 761 printf("RESULT dropped_frames: %s = %d frames\n", test_label_.c_str(), |
722 dropped_frames_); | 762 dropped_frames_); |
723 printf("RESULT dropped_frames_before_first_encode: %s = %d frames\n", | 763 printf("RESULT dropped_frames_before_first_encode: %s = %d frames\n", |
724 test_label_.c_str(), dropped_frames_before_first_encode_); | 764 test_label_.c_str(), dropped_frames_before_first_encode_); |
725 printf("RESULT dropped_frames_before_rendering: %s = %d frames\n", | 765 printf("RESULT dropped_frames_before_rendering: %s = %d frames\n", |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 sample.encoded_frame_size, sample.psnr, sample.ssim, | 872 sample.encoded_frame_size, sample.psnr, sample.ssim, |
833 encode_time_ms); | 873 encode_time_ms); |
834 } | 874 } |
835 if (missing_encode_time_samples) { | 875 if (missing_encode_time_samples) { |
836 fprintf(stderr, | 876 fprintf(stderr, |
837 "Warning: Missing encode_time_ms samples for %d frame(s).\n", | 877 "Warning: Missing encode_time_ms samples for %d frame(s).\n", |
838 missing_encode_time_samples); | 878 missing_encode_time_samples); |
839 } | 879 } |
840 } | 880 } |
841 | 881 |
| 882 double GetAverageMediaBitrateBps() { |
| 883 if (last_sending_time_ == first_sending_time_) { |
| 884 return 0; |
| 885 } else { |
| 886 return static_cast<double>(total_media_bytes_) * 8 / |
| 887 (last_sending_time_ - first_sending_time_) * |
| 888 rtc::kNumMillisecsPerSec; |
| 889 } |
| 890 } |
| 891 |
842 // Implements VideoSinkInterface to receive captured frames from a | 892 // Implements VideoSinkInterface to receive captured frames from a |
843 // FrameGeneratorCapturer. Implements VideoSourceInterface to be able to act | 893 // FrameGeneratorCapturer. Implements VideoSourceInterface to be able to act |
844 // as a source to VideoSendStream. | 894 // as a source to VideoSendStream. |
845 // It forwards all input frames to the VideoAnalyzer for later comparison and | 895 // It forwards all input frames to the VideoAnalyzer for later comparison and |
846 // forwards the captured frames to the VideoSendStream. | 896 // forwards the captured frames to the VideoSendStream. |
847 class CapturedFrameForwarder : public rtc::VideoSinkInterface<VideoFrame>, | 897 class CapturedFrameForwarder : public rtc::VideoSinkInterface<VideoFrame>, |
848 public rtc::VideoSourceInterface<VideoFrame> { | 898 public rtc::VideoSourceInterface<VideoFrame> { |
849 public: | 899 public: |
850 explicit CapturedFrameForwarder(VideoAnalyzer* analyzer) | 900 explicit CapturedFrameForwarder(VideoAnalyzer* analyzer) |
851 : analyzer_(analyzer), send_stream_input_(nullptr) {} | 901 : analyzer_(analyzer), send_stream_input_(nullptr) {} |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 VideoSendStream* send_stream_; | 941 VideoSendStream* send_stream_; |
892 VideoReceiveStream* receive_stream_; | 942 VideoReceiveStream* receive_stream_; |
893 CapturedFrameForwarder captured_frame_forwarder_; | 943 CapturedFrameForwarder captured_frame_forwarder_; |
894 const std::string test_label_; | 944 const std::string test_label_; |
895 FILE* const graph_data_output_file_; | 945 FILE* const graph_data_output_file_; |
896 const std::string graph_title_; | 946 const std::string graph_title_; |
897 const uint32_t ssrc_to_analyze_; | 947 const uint32_t ssrc_to_analyze_; |
898 const uint32_t rtx_ssrc_to_analyze_; | 948 const uint32_t rtx_ssrc_to_analyze_; |
899 const uint32_t selected_stream_width_; | 949 const uint32_t selected_stream_width_; |
900 const uint32_t selected_stream_height_; | 950 const uint32_t selected_stream_height_; |
| 951 const int selected_sl_; |
| 952 const int selected_tl_; |
901 PreEncodeProxy pre_encode_proxy_; | 953 PreEncodeProxy pre_encode_proxy_; |
902 OnEncodeTimingProxy encode_timing_proxy_; | 954 OnEncodeTimingProxy encode_timing_proxy_; |
903 std::vector<Sample> samples_ GUARDED_BY(comparison_lock_); | 955 std::vector<Sample> samples_ GUARDED_BY(comparison_lock_); |
904 std::map<int64_t, int> samples_encode_time_ms_ GUARDED_BY(comparison_lock_); | 956 std::map<int64_t, int> samples_encode_time_ms_ GUARDED_BY(comparison_lock_); |
905 test::Statistics sender_time_ GUARDED_BY(comparison_lock_); | 957 test::Statistics sender_time_ GUARDED_BY(comparison_lock_); |
906 test::Statistics receiver_time_ GUARDED_BY(comparison_lock_); | 958 test::Statistics receiver_time_ GUARDED_BY(comparison_lock_); |
907 test::Statistics psnr_ GUARDED_BY(comparison_lock_); | 959 test::Statistics psnr_ GUARDED_BY(comparison_lock_); |
908 test::Statistics ssim_ GUARDED_BY(comparison_lock_); | 960 test::Statistics ssim_ GUARDED_BY(comparison_lock_); |
909 test::Statistics end_to_end_ GUARDED_BY(comparison_lock_); | 961 test::Statistics end_to_end_ GUARDED_BY(comparison_lock_); |
910 test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_); | 962 test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_); |
911 test::Statistics encoded_frame_size_ GUARDED_BY(comparison_lock_); | 963 test::Statistics encoded_frame_size_ GUARDED_BY(comparison_lock_); |
912 test::Statistics encode_frame_rate_ GUARDED_BY(comparison_lock_); | 964 test::Statistics encode_frame_rate_ GUARDED_BY(comparison_lock_); |
913 test::Statistics encode_time_ms_ GUARDED_BY(comparison_lock_); | 965 test::Statistics encode_time_ms_ GUARDED_BY(comparison_lock_); |
914 test::Statistics encode_usage_percent_ GUARDED_BY(comparison_lock_); | 966 test::Statistics encode_usage_percent_ GUARDED_BY(comparison_lock_); |
915 test::Statistics decode_time_ms_ GUARDED_BY(comparison_lock_); | 967 test::Statistics decode_time_ms_ GUARDED_BY(comparison_lock_); |
916 test::Statistics decode_time_max_ms_ GUARDED_BY(comparison_lock_); | 968 test::Statistics decode_time_max_ms_ GUARDED_BY(comparison_lock_); |
917 test::Statistics media_bitrate_bps_ GUARDED_BY(comparison_lock_); | 969 test::Statistics media_bitrate_bps_ GUARDED_BY(comparison_lock_); |
918 | 970 |
919 const int frames_to_process_; | 971 const int frames_to_process_; |
920 int frames_recorded_; | 972 int frames_recorded_; |
921 int frames_processed_; | 973 int frames_processed_; |
922 int dropped_frames_; | 974 int dropped_frames_; |
923 int dropped_frames_before_first_encode_; | 975 int dropped_frames_before_first_encode_; |
924 int dropped_frames_before_rendering_; | 976 int dropped_frames_before_rendering_; |
925 int64_t last_render_time_; | 977 int64_t last_render_time_; |
926 uint32_t rtp_timestamp_delta_; | 978 uint32_t rtp_timestamp_delta_; |
| 979 int64_t total_media_bytes_; |
| 980 int64_t first_sending_time_; |
| 981 int64_t last_sending_time_; |
927 | 982 |
928 int64_t cpu_time_ GUARDED_BY(cpu_measurement_lock_); | 983 int64_t cpu_time_ GUARDED_BY(cpu_measurement_lock_); |
929 int64_t wallclock_time_ GUARDED_BY(cpu_measurement_lock_); | 984 int64_t wallclock_time_ GUARDED_BY(cpu_measurement_lock_); |
930 rtc::CriticalSection cpu_measurement_lock_; | 985 rtc::CriticalSection cpu_measurement_lock_; |
931 | 986 |
932 rtc::CriticalSection crit_; | 987 rtc::CriticalSection crit_; |
933 std::deque<VideoFrame> frames_ GUARDED_BY(crit_); | 988 std::deque<VideoFrame> frames_ GUARDED_BY(crit_); |
934 rtc::Optional<VideoFrame> last_rendered_frame_ GUARDED_BY(crit_); | 989 rtc::Optional<VideoFrame> last_rendered_frame_ GUARDED_BY(crit_); |
935 rtc::TimestampWrapAroundHandler wrap_handler_ GUARDED_BY(crit_); | 990 rtc::TimestampWrapAroundHandler wrap_handler_ GUARDED_BY(crit_); |
936 std::map<int64_t, int64_t> send_times_ GUARDED_BY(crit_); | 991 std::map<int64_t, int64_t> send_times_ GUARDED_BY(crit_); |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1393 &send_transport, params_.analyzer.test_label, | 1448 &send_transport, params_.analyzer.test_label, |
1394 | 1449 |
1395 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, | 1450 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, |
1396 is_quick_test_enabled | 1451 is_quick_test_enabled |
1397 ? kFramesSentInQuickTest | 1452 ? kFramesSentInQuickTest |
1398 : params_.analyzer.test_durations_secs * params_.video.fps, | 1453 : params_.analyzer.test_durations_secs * params_.video.fps, |
1399 graph_data_output_file, graph_title, | 1454 graph_data_output_file, graph_title, |
1400 kVideoSendSsrcs[params_.ss.selected_stream], | 1455 kVideoSendSsrcs[params_.ss.selected_stream], |
1401 kSendRtxSsrcs[params_.ss.selected_stream], | 1456 kSendRtxSsrcs[params_.ss.selected_stream], |
1402 static_cast<uint32_t>(selected_stream.width), | 1457 static_cast<uint32_t>(selected_stream.width), |
1403 static_cast<uint32_t>(selected_stream.height), is_quick_test_enabled); | 1458 static_cast<uint32_t>(selected_stream.height), params.ss.selected_sl, |
| 1459 params_.video.selected_tl, is_quick_test_enabled); |
1404 analyzer.SetReceiver(receiver_call_->Receiver()); | 1460 analyzer.SetReceiver(receiver_call_->Receiver()); |
1405 send_transport.SetReceiver(&analyzer); | 1461 send_transport.SetReceiver(&analyzer); |
1406 recv_transport.SetReceiver(sender_call_->Receiver()); | 1462 recv_transport.SetReceiver(sender_call_->Receiver()); |
1407 | 1463 |
1408 SetupVideo(&analyzer, &recv_transport); | 1464 SetupVideo(&analyzer, &recv_transport); |
1409 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; | 1465 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; |
1410 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); | 1466 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); |
1411 for (auto& config : video_receive_configs_) | |
1412 config.pre_decode_callback = &analyzer; | |
1413 RTC_DCHECK(!video_send_config_.post_encode_callback); | 1467 RTC_DCHECK(!video_send_config_.post_encode_callback); |
1414 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); | 1468 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); |
1415 | 1469 |
1416 SetupScreenshareOrSVC(); | 1470 SetupScreenshareOrSVC(); |
1417 | 1471 |
1418 CreateFlexfecStreams(); | 1472 CreateFlexfecStreams(); |
1419 CreateVideoStreams(); | 1473 CreateVideoStreams(); |
1420 analyzer.SetSendStream(video_send_stream_); | 1474 analyzer.SetSendStream(video_send_stream_); |
1421 if (video_receive_streams_.size() == 1) | 1475 if (video_receive_streams_.size() == 1) |
1422 analyzer.SetReceiveStream(video_receive_streams_[0]); | 1476 analyzer.SetReceiveStream(video_receive_streams_[0]); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1648 std::ostringstream str; | 1702 std::ostringstream str; |
1649 str << receive_logs_++; | 1703 str << receive_logs_++; |
1650 std::string path = | 1704 std::string path = |
1651 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1705 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
1652 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1706 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
1653 10000000); | 1707 10000000); |
1654 } | 1708 } |
1655 } | 1709 } |
1656 | 1710 |
1657 } // namespace webrtc | 1711 } // namespace webrtc |
OLD | NEW |