| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 public rtc::VideoSinkInterface<VideoFrame>, | 126 public rtc::VideoSinkInterface<VideoFrame>, |
| 127 public EncodedFrameObserver { | 127 public EncodedFrameObserver { |
| 128 public: | 128 public: |
| 129 VideoAnalyzer(test::LayerFilteringTransport* transport, | 129 VideoAnalyzer(test::LayerFilteringTransport* transport, |
| 130 const std::string& test_label, | 130 const std::string& test_label, |
| 131 double avg_psnr_threshold, | 131 double avg_psnr_threshold, |
| 132 double avg_ssim_threshold, | 132 double avg_ssim_threshold, |
| 133 int duration_frames, | 133 int duration_frames, |
| 134 FILE* graph_data_output_file, | 134 FILE* graph_data_output_file, |
| 135 const std::string& graph_title, | 135 const std::string& graph_title, |
| 136 uint32_t ssrc_to_analyze, | 136 uint32_t ssrc_to_analyze) |
| 137 uint32_t selected_width, | |
| 138 uint32_t selected_height) | |
| 139 : transport_(transport), | 137 : transport_(transport), |
| 140 receiver_(nullptr), | 138 receiver_(nullptr), |
| 141 send_stream_(nullptr), | 139 send_stream_(nullptr), |
| 142 receive_stream_(nullptr), | 140 receive_stream_(nullptr), |
| 143 captured_frame_forwarder_(this), | 141 captured_frame_forwarder_(this), |
| 144 test_label_(test_label), | 142 test_label_(test_label), |
| 145 graph_data_output_file_(graph_data_output_file), | 143 graph_data_output_file_(graph_data_output_file), |
| 146 graph_title_(graph_title), | 144 graph_title_(graph_title), |
| 147 ssrc_to_analyze_(ssrc_to_analyze), | 145 ssrc_to_analyze_(ssrc_to_analyze), |
| 148 selected_width_(selected_width), | |
| 149 selected_height_(selected_height), | |
| 150 pre_encode_proxy_(this), | 146 pre_encode_proxy_(this), |
| 151 encode_timing_proxy_(this), | 147 encode_timing_proxy_(this), |
| 152 frames_to_process_(duration_frames), | 148 frames_to_process_(duration_frames), |
| 153 frames_recorded_(0), | 149 frames_recorded_(0), |
| 154 frames_processed_(0), | 150 frames_processed_(0), |
| 155 dropped_frames_(0), | 151 dropped_frames_(0), |
| 156 dropped_frames_before_first_encode_(0), | 152 dropped_frames_before_first_encode_(0), |
| 157 dropped_frames_before_rendering_(0), | 153 dropped_frames_before_rendering_(0), |
| 158 last_render_time_(0), | 154 last_render_time_(0), |
| 159 rtp_timestamp_delta_(0), | 155 rtp_timestamp_delta_(0), |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 const PacketTime& packet_time) override { | 219 const PacketTime& packet_time) override { |
| 224 // Ignore timestamps of RTCP packets. They're not synchronized with | 220 // Ignore timestamps of RTCP packets. They're not synchronized with |
| 225 // RTP packet timestamps and so they would confuse wrap_handler_. | 221 // RTP packet timestamps and so they would confuse wrap_handler_. |
| 226 if (RtpHeaderParser::IsRtcp(packet, length)) { | 222 if (RtpHeaderParser::IsRtcp(packet, length)) { |
| 227 return receiver_->DeliverPacket(media_type, packet, length, packet_time); | 223 return receiver_->DeliverPacket(media_type, packet, length, packet_time); |
| 228 } | 224 } |
| 229 | 225 |
| 230 RtpUtility::RtpHeaderParser parser(packet, length); | 226 RtpUtility::RtpHeaderParser parser(packet, length); |
| 231 RTPHeader header; | 227 RTPHeader header; |
| 232 parser.Parse(&header); | 228 parser.Parse(&header); |
| 233 if (!IsFlexfec(header.payloadType) && header.ssrc != ssrc_to_analyze_) { | 229 if (!IsFlexfec(header.payloadType)) { |
| 234 // Ignore FlexFEC timestamps, to avoid collisions with media timestamps. | 230 // Ignore FlexFEC timestamps, to avoid collisions with media timestamps. |
| 235 // (FlexFEC and media are sent on different SSRCs, which have different | 231 // (FlexFEC and media are sent on different SSRCs, which have different |
| 236 // timestamps spaces.) | 232 // timestamps spaces.) |
| 237 // Also ignore packets from wrong SSRC. | |
| 238 rtc::CritScope lock(&crit_); | 233 rtc::CritScope lock(&crit_); |
| 239 int64_t timestamp = | 234 int64_t timestamp = |
| 240 wrap_handler_.Unwrap(header.timestamp - rtp_timestamp_delta_); | 235 wrap_handler_.Unwrap(header.timestamp - rtp_timestamp_delta_); |
| 241 recv_times_[timestamp] = | 236 recv_times_[timestamp] = |
| 242 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); | 237 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); |
| 243 } | 238 } |
| 244 | 239 |
| 245 return receiver_->DeliverPacket(media_type, packet, length, packet_time); | 240 return receiver_->DeliverPacket(media_type, packet, length, packet_time); |
| 246 } | 241 } |
| 247 | 242 |
| 248 void MeasuredEncodeTiming(int64_t ntp_time_ms, int encode_time_ms) { | 243 void MeasuredEncodeTiming(int64_t ntp_time_ms, int encode_time_ms) { |
| 249 rtc::CritScope crit(&comparison_lock_); | 244 rtc::CritScope crit(&comparison_lock_); |
| 250 samples_encode_time_ms_[ntp_time_ms] = encode_time_ms; | 245 samples_encode_time_ms_[ntp_time_ms] = encode_time_ms; |
| 251 } | 246 } |
| 252 | 247 |
| 253 void PreEncodeOnFrame(const VideoFrame& video_frame) { | 248 void PreEncodeOnFrame(const VideoFrame& video_frame) { |
| 254 rtc::CritScope lock(&crit_); | 249 rtc::CritScope lock(&crit_); |
| 255 if (!first_encoded_timestamp_) { | 250 if (!first_send_timestamp_ && rtp_timestamp_delta_ == 0) { |
| 256 while (frames_.front().timestamp() != video_frame.timestamp()) { | 251 while (frames_.front().timestamp() != video_frame.timestamp()) { |
| 257 ++dropped_frames_before_first_encode_; | 252 ++dropped_frames_before_first_encode_; |
| 258 frames_.pop_front(); | 253 frames_.pop_front(); |
| 259 RTC_CHECK(!frames_.empty()); | 254 RTC_CHECK(!frames_.empty()); |
| 260 } | 255 } |
| 261 first_encoded_timestamp_ = | 256 first_send_timestamp_ = rtc::Optional<uint32_t>(video_frame.timestamp()); |
| 262 rtc::Optional<uint32_t>(video_frame.timestamp()); | |
| 263 } | 257 } |
| 264 } | 258 } |
| 265 | 259 |
| 266 void PostEncodeFrameCallback(const EncodedFrame& encoded_frame) { | |
| 267 rtc::CritScope lock(&crit_); | |
| 268 if (!first_sent_timestamp_ && | |
| 269 encoded_frame.encoded_width_ == selected_width_ && | |
| 270 encoded_frame.encoded_height_ == selected_height_) { | |
| 271 first_sent_timestamp_ = rtc::Optional<uint32_t>(encoded_frame.timestamp_); | |
| 272 } | |
| 273 } | |
| 274 | |
| 275 bool SendRtp(const uint8_t* packet, | 260 bool SendRtp(const uint8_t* packet, |
| 276 size_t length, | 261 size_t length, |
| 277 const PacketOptions& options) override { | 262 const PacketOptions& options) override { |
| 278 RtpUtility::RtpHeaderParser parser(packet, length); | 263 RtpUtility::RtpHeaderParser parser(packet, length); |
| 279 RTPHeader header; | 264 RTPHeader header; |
| 280 parser.Parse(&header); | 265 parser.Parse(&header); |
| 281 | 266 |
| 282 int64_t current_time = | 267 int64_t current_time = |
| 283 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); | 268 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); |
| 284 bool result = transport_->SendRtp(packet, length, options); | 269 bool result = transport_->SendRtp(packet, length, options); |
| 285 { | 270 { |
| 286 rtc::CritScope lock(&crit_); | 271 rtc::CritScope lock(&crit_); |
| 287 if (rtp_timestamp_delta_ == 0 && header.ssrc == ssrc_to_analyze_) { | 272 |
| 288 rtp_timestamp_delta_ = header.timestamp - *first_sent_timestamp_; | 273 if (rtp_timestamp_delta_ == 0) { |
| 274 rtp_timestamp_delta_ = header.timestamp - *first_send_timestamp_; |
| 275 first_send_timestamp_ = rtc::Optional<uint32_t>(); |
| 289 } | 276 } |
| 290 | 277 if (!IsFlexfec(header.payloadType)) { |
| 291 if (!IsFlexfec(header.payloadType) && header.ssrc == ssrc_to_analyze_) { | |
| 292 // Ignore FlexFEC timestamps, to avoid collisions with media timestamps. | 278 // Ignore FlexFEC timestamps, to avoid collisions with media timestamps. |
| 293 // (FlexFEC and media are sent on different SSRCs, which have different | 279 // (FlexFEC and media are sent on different SSRCs, which have different |
| 294 // timestamps spaces.) | 280 // timestamps spaces.) |
| 295 // Also ignore packets from wrong SSRC. | |
| 296 int64_t timestamp = | 281 int64_t timestamp = |
| 297 wrap_handler_.Unwrap(header.timestamp - rtp_timestamp_delta_); | 282 wrap_handler_.Unwrap(header.timestamp - rtp_timestamp_delta_); |
| 298 send_times_[timestamp] = current_time; | 283 send_times_[timestamp] = current_time; |
| 299 if (!transport_->DiscardedLastPacket() && | 284 if (!transport_->DiscardedLastPacket() && |
| 300 header.ssrc == ssrc_to_analyze_) { | 285 header.ssrc == ssrc_to_analyze_) { |
| 301 encoded_frame_sizes_[timestamp] += | 286 encoded_frame_sizes_[timestamp] += |
| 302 length - (header.headerLength + header.paddingLength); | 287 length - (header.headerLength + header.paddingLength); |
| 303 } | 288 } |
| 304 } | 289 } |
| 305 } | 290 } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 | 468 |
| 484 // This class receives the send-side OnEncodeTiming and is provided to not | 469 // This class receives the send-side OnEncodeTiming and is provided to not |
| 485 // conflict with the receiver-side pre_decode_callback. | 470 // conflict with the receiver-side pre_decode_callback. |
| 486 class OnEncodeTimingProxy : public EncodedFrameObserver { | 471 class OnEncodeTimingProxy : public EncodedFrameObserver { |
| 487 public: | 472 public: |
| 488 explicit OnEncodeTimingProxy(VideoAnalyzer* parent) : parent_(parent) {} | 473 explicit OnEncodeTimingProxy(VideoAnalyzer* parent) : parent_(parent) {} |
| 489 | 474 |
| 490 void OnEncodeTiming(int64_t ntp_time_ms, int encode_time_ms) override { | 475 void OnEncodeTiming(int64_t ntp_time_ms, int encode_time_ms) override { |
| 491 parent_->MeasuredEncodeTiming(ntp_time_ms, encode_time_ms); | 476 parent_->MeasuredEncodeTiming(ntp_time_ms, encode_time_ms); |
| 492 } | 477 } |
| 493 void EncodedFrameCallback(const EncodedFrame& frame) override { | 478 void EncodedFrameCallback(const EncodedFrame& frame) override {} |
| 494 parent_->PostEncodeFrameCallback(frame); | |
| 495 } | |
| 496 | 479 |
| 497 private: | 480 private: |
| 498 VideoAnalyzer* const parent_; | 481 VideoAnalyzer* const parent_; |
| 499 }; | 482 }; |
| 500 | 483 |
| 501 // This class receives the send-side OnFrame callback and is provided to not | 484 // This class receives the send-side OnFrame callback and is provided to not |
| 502 // conflict with the receiver-side renderer callback. | 485 // conflict with the receiver-side renderer callback. |
| 503 class PreEncodeProxy : public rtc::VideoSinkInterface<VideoFrame> { | 486 class PreEncodeProxy : public rtc::VideoSinkInterface<VideoFrame> { |
| 504 public: | 487 public: |
| 505 explicit PreEncodeProxy(VideoAnalyzer* parent) : parent_(parent) {} | 488 explicit PreEncodeProxy(VideoAnalyzer* parent) : parent_(parent) {} |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 // forwards the captured frames to the VideoSendStream. | 778 // forwards the captured frames to the VideoSendStream. |
| 796 class CapturedFrameForwarder : public rtc::VideoSinkInterface<VideoFrame>, | 779 class CapturedFrameForwarder : public rtc::VideoSinkInterface<VideoFrame>, |
| 797 public rtc::VideoSourceInterface<VideoFrame> { | 780 public rtc::VideoSourceInterface<VideoFrame> { |
| 798 public: | 781 public: |
| 799 explicit CapturedFrameForwarder(VideoAnalyzer* analyzer) | 782 explicit CapturedFrameForwarder(VideoAnalyzer* analyzer) |
| 800 : analyzer_(analyzer), send_stream_input_(nullptr) {} | 783 : analyzer_(analyzer), send_stream_input_(nullptr) {} |
| 801 | 784 |
| 802 private: | 785 private: |
| 803 void OnFrame(const VideoFrame& video_frame) override { | 786 void OnFrame(const VideoFrame& video_frame) override { |
| 804 VideoFrame copy = video_frame; | 787 VideoFrame copy = video_frame; |
| 805 // Frames from the capturer does not have a rtp timestamp. | |
| 806 // Create one so it can be used for comparison. | |
| 807 RTC_DCHECK_EQ(0, video_frame.timestamp()); | |
| 808 copy.set_timestamp(copy.ntp_time_ms() * 90); | 788 copy.set_timestamp(copy.ntp_time_ms() * 90); |
| 809 analyzer_->AddCapturedFrameForComparison(copy); | 789 |
| 790 analyzer_->AddCapturedFrameForComparison(video_frame); |
| 810 rtc::CritScope lock(&crit_); | 791 rtc::CritScope lock(&crit_); |
| 811 if (send_stream_input_) | 792 if (send_stream_input_) |
| 812 send_stream_input_->OnFrame(video_frame); | 793 send_stream_input_->OnFrame(video_frame); |
| 813 } | 794 } |
| 814 | 795 |
| 815 // Called when |send_stream_.SetSource()| is called. | 796 // Called when |send_stream_.SetSource()| is called. |
| 816 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, | 797 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, |
| 817 const rtc::VideoSinkWants& wants) override { | 798 const rtc::VideoSinkWants& wants) override { |
| 818 rtc::CritScope lock(&crit_); | 799 rtc::CritScope lock(&crit_); |
| 819 RTC_DCHECK(!send_stream_input_ || send_stream_input_ == sink); | 800 RTC_DCHECK(!send_stream_input_ || send_stream_input_ == sink); |
| 820 send_stream_input_ = sink; | 801 send_stream_input_ = sink; |
| 821 } | 802 } |
| 822 | 803 |
| 823 // Called by |send_stream_| when |send_stream_.SetSource()| is called. | 804 // Called by |send_stream_| when |send_stream_.SetSource()| is called. |
| 824 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override { | 805 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override { |
| 825 rtc::CritScope lock(&crit_); | 806 rtc::CritScope lock(&crit_); |
| 826 RTC_DCHECK(sink == send_stream_input_); | 807 RTC_DCHECK(sink == send_stream_input_); |
| 827 send_stream_input_ = nullptr; | 808 send_stream_input_ = nullptr; |
| 828 } | 809 } |
| 829 | 810 |
| 830 VideoAnalyzer* const analyzer_; | 811 VideoAnalyzer* const analyzer_; |
| 831 rtc::CriticalSection crit_; | 812 rtc::CriticalSection crit_; |
| 832 rtc::VideoSinkInterface<VideoFrame>* send_stream_input_ GUARDED_BY(crit_); | 813 rtc::VideoSinkInterface<VideoFrame>* send_stream_input_ GUARDED_BY(crit_); |
| 833 }; | 814 }; |
| 834 | 815 |
| 835 void AddCapturedFrameForComparison(const VideoFrame& video_frame) { | 816 void AddCapturedFrameForComparison(const VideoFrame& video_frame) { |
| 836 rtc::CritScope lock(&crit_); | 817 rtc::CritScope lock(&crit_); |
| 837 frames_.push_back(video_frame); | 818 RTC_DCHECK_EQ(0, video_frame.timestamp()); |
| 819 // Frames from the capturer does not have a rtp timestamp. Create one so it |
| 820 // can be used for comparison. |
| 821 VideoFrame copy = video_frame; |
| 822 copy.set_timestamp(copy.ntp_time_ms() * 90); |
| 823 frames_.push_back(copy); |
| 838 } | 824 } |
| 839 | 825 |
| 840 VideoSendStream* send_stream_; | 826 VideoSendStream* send_stream_; |
| 841 VideoReceiveStream* receive_stream_; | 827 VideoReceiveStream* receive_stream_; |
| 842 CapturedFrameForwarder captured_frame_forwarder_; | 828 CapturedFrameForwarder captured_frame_forwarder_; |
| 843 const std::string test_label_; | 829 const std::string test_label_; |
| 844 FILE* const graph_data_output_file_; | 830 FILE* const graph_data_output_file_; |
| 845 const std::string graph_title_; | 831 const std::string graph_title_; |
| 846 const uint32_t ssrc_to_analyze_; | 832 const uint32_t ssrc_to_analyze_; |
| 847 const uint32_t selected_width_; | |
| 848 const uint32_t selected_height_; | |
| 849 PreEncodeProxy pre_encode_proxy_; | 833 PreEncodeProxy pre_encode_proxy_; |
| 850 OnEncodeTimingProxy encode_timing_proxy_; | 834 OnEncodeTimingProxy encode_timing_proxy_; |
| 851 std::vector<Sample> samples_ GUARDED_BY(comparison_lock_); | 835 std::vector<Sample> samples_ GUARDED_BY(comparison_lock_); |
| 852 std::map<int64_t, int> samples_encode_time_ms_ GUARDED_BY(comparison_lock_); | 836 std::map<int64_t, int> samples_encode_time_ms_ GUARDED_BY(comparison_lock_); |
| 853 test::Statistics sender_time_ GUARDED_BY(comparison_lock_); | 837 test::Statistics sender_time_ GUARDED_BY(comparison_lock_); |
| 854 test::Statistics receiver_time_ GUARDED_BY(comparison_lock_); | 838 test::Statistics receiver_time_ GUARDED_BY(comparison_lock_); |
| 855 test::Statistics psnr_ GUARDED_BY(comparison_lock_); | 839 test::Statistics psnr_ GUARDED_BY(comparison_lock_); |
| 856 test::Statistics ssim_ GUARDED_BY(comparison_lock_); | 840 test::Statistics ssim_ GUARDED_BY(comparison_lock_); |
| 857 test::Statistics end_to_end_ GUARDED_BY(comparison_lock_); | 841 test::Statistics end_to_end_ GUARDED_BY(comparison_lock_); |
| 858 test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_); | 842 test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 873 int64_t last_render_time_; | 857 int64_t last_render_time_; |
| 874 uint32_t rtp_timestamp_delta_; | 858 uint32_t rtp_timestamp_delta_; |
| 875 | 859 |
| 876 rtc::CriticalSection crit_; | 860 rtc::CriticalSection crit_; |
| 877 std::deque<VideoFrame> frames_ GUARDED_BY(crit_); | 861 std::deque<VideoFrame> frames_ GUARDED_BY(crit_); |
| 878 rtc::Optional<VideoFrame> last_rendered_frame_ GUARDED_BY(crit_); | 862 rtc::Optional<VideoFrame> last_rendered_frame_ GUARDED_BY(crit_); |
| 879 rtc::TimestampWrapAroundHandler wrap_handler_ GUARDED_BY(crit_); | 863 rtc::TimestampWrapAroundHandler wrap_handler_ GUARDED_BY(crit_); |
| 880 std::map<int64_t, int64_t> send_times_ GUARDED_BY(crit_); | 864 std::map<int64_t, int64_t> send_times_ GUARDED_BY(crit_); |
| 881 std::map<int64_t, int64_t> recv_times_ GUARDED_BY(crit_); | 865 std::map<int64_t, int64_t> recv_times_ GUARDED_BY(crit_); |
| 882 std::map<int64_t, size_t> encoded_frame_sizes_ GUARDED_BY(crit_); | 866 std::map<int64_t, size_t> encoded_frame_sizes_ GUARDED_BY(crit_); |
| 883 rtc::Optional<uint32_t> first_encoded_timestamp_ GUARDED_BY(crit_); | 867 rtc::Optional<uint32_t> first_send_timestamp_ GUARDED_BY(crit_); |
| 884 rtc::Optional<uint32_t> first_sent_timestamp_ GUARDED_BY(crit_); | |
| 885 const double avg_psnr_threshold_; | 868 const double avg_psnr_threshold_; |
| 886 const double avg_ssim_threshold_; | 869 const double avg_ssim_threshold_; |
| 887 | 870 |
| 888 rtc::CriticalSection comparison_lock_; | 871 rtc::CriticalSection comparison_lock_; |
| 889 std::vector<rtc::PlatformThread*> comparison_thread_pool_; | 872 std::vector<rtc::PlatformThread*> comparison_thread_pool_; |
| 890 rtc::PlatformThread stats_polling_thread_; | 873 rtc::PlatformThread stats_polling_thread_; |
| 891 rtc::Event comparison_available_event_; | 874 rtc::Event comparison_available_event_; |
| 892 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_); | 875 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_); |
| 893 rtc::Event done_; | 876 rtc::Event done_; |
| 894 }; | 877 }; |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 : params_.ss.num_spatial_layers - 1; | 1305 : params_.ss.num_spatial_layers - 1; |
| 1323 bool disable_quality_check = | 1306 bool disable_quality_check = |
| 1324 selected_stream.width != params_.video.width || | 1307 selected_stream.width != params_.video.width || |
| 1325 selected_stream.height != params_.video.height || | 1308 selected_stream.height != params_.video.height || |
| 1326 (!params_.ss.spatial_layers.empty() && | 1309 (!params_.ss.spatial_layers.empty() && |
| 1327 params_.ss.spatial_layers[selected_sl].scaling_factor_num != | 1310 params_.ss.spatial_layers[selected_sl].scaling_factor_num != |
| 1328 params_.ss.spatial_layers[selected_sl].scaling_factor_den); | 1311 params_.ss.spatial_layers[selected_sl].scaling_factor_den); |
| 1329 if (disable_quality_check) { | 1312 if (disable_quality_check) { |
| 1330 fprintf(stderr, | 1313 fprintf(stderr, |
| 1331 "Warning: Calculating PSNR and SSIM for downsized resolution " | 1314 "Warning: Calculating PSNR and SSIM for downsized resolution " |
| 1332 "not implemented yet! Skipping PSNR and SSIM calculations!\n"); | 1315 "not implemented yet! Skipping PSNR and SSIM calculations!"); |
| 1333 } | 1316 } |
| 1334 | 1317 |
| 1335 VideoAnalyzer analyzer( | 1318 VideoAnalyzer analyzer( |
| 1336 &send_transport, params_.analyzer.test_label, | 1319 &send_transport, params_.analyzer.test_label, |
| 1337 disable_quality_check ? -1.1 : params_.analyzer.avg_psnr_threshold, | 1320 disable_quality_check ? -1.1 : params_.analyzer.avg_psnr_threshold, |
| 1338 disable_quality_check ? -1.1 : params_.analyzer.avg_ssim_threshold, | 1321 disable_quality_check ? -1.1 : params_.analyzer.avg_ssim_threshold, |
| 1339 params_.analyzer.test_durations_secs * params_.video.fps, | 1322 params_.analyzer.test_durations_secs * params_.video.fps, |
| 1340 graph_data_output_file, graph_title, | 1323 graph_data_output_file, graph_title, |
| 1341 kVideoSendSsrcs[params_.ss.selected_stream], | 1324 kVideoSendSsrcs[params_.ss.selected_stream]); |
| 1342 static_cast<uint32_t>(selected_stream.width), | |
| 1343 static_cast<uint32_t>(selected_stream.height)); | |
| 1344 | 1325 |
| 1345 analyzer.SetReceiver(receiver_call_->Receiver()); | 1326 analyzer.SetReceiver(receiver_call_->Receiver()); |
| 1346 send_transport.SetReceiver(&analyzer); | 1327 send_transport.SetReceiver(&analyzer); |
| 1347 recv_transport.SetReceiver(sender_call_->Receiver()); | 1328 recv_transport.SetReceiver(sender_call_->Receiver()); |
| 1348 | 1329 |
| 1349 SetupVideo(&analyzer, &recv_transport); | 1330 SetupVideo(&analyzer, &recv_transport); |
| 1350 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; | 1331 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; |
| 1351 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); | 1332 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); |
| 1352 for (auto& config : video_receive_configs_) | 1333 for (auto& config : video_receive_configs_) |
| 1353 config.pre_decode_callback = &analyzer; | 1334 config.pre_decode_callback = &analyzer; |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 std::ostringstream str; | 1570 std::ostringstream str; |
| 1590 str << receive_logs_++; | 1571 str << receive_logs_++; |
| 1591 std::string path = | 1572 std::string path = |
| 1592 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1573 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
| 1593 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1574 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
| 1594 10000000); | 1575 10000000); |
| 1595 } | 1576 } |
| 1596 } | 1577 } |
| 1597 | 1578 |
| 1598 } // namespace webrtc | 1579 } // namespace webrtc |
| OLD | NEW |