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