Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: webrtc/video/video_quality_test.cc

Issue 2227733004: Add an HD resolution perf test. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add a new test which still runs with recv-side bwe. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/video/video_quality_test.h ('k') | webrtc/webrtc_perf_tests.isolate » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdio.h> 10 #include <stdio.h>
(...skipping 23 matching lines...) Expand all
34 #include "webrtc/test/testsupport/fileutils.h" 34 #include "webrtc/test/testsupport/fileutils.h"
35 #include "webrtc/test/video_renderer.h" 35 #include "webrtc/test/video_renderer.h"
36 #include "webrtc/video/video_quality_test.h" 36 #include "webrtc/video/video_quality_test.h"
37 37
38 namespace webrtc { 38 namespace webrtc {
39 39
40 static const int kSendStatsPollingIntervalMs = 1000; 40 static const int kSendStatsPollingIntervalMs = 1000;
41 static const int kPayloadTypeH264 = 122; 41 static const int kPayloadTypeH264 = 122;
42 static const int kPayloadTypeVP8 = 123; 42 static const int kPayloadTypeVP8 = 123;
43 static const int kPayloadTypeVP9 = 124; 43 static const int kPayloadTypeVP9 = 124;
44 static const size_t kMaxComparisons = 10;
44 45
45 class VideoAnalyzer : public PacketReceiver, 46 class VideoAnalyzer : public PacketReceiver,
46 public Transport, 47 public Transport,
47 public rtc::VideoSinkInterface<VideoFrame>, 48 public rtc::VideoSinkInterface<VideoFrame>,
48 public VideoCaptureInput, 49 public VideoCaptureInput,
49 public EncodedFrameObserver { 50 public EncodedFrameObserver {
50 public: 51 public:
51 VideoAnalyzer(test::LayerFilteringTransport* transport, 52 VideoAnalyzer(test::LayerFilteringTransport* transport,
52 const std::string& test_label, 53 const std::string& test_label,
53 double avg_psnr_threshold, 54 double avg_psnr_threshold,
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 // TODO(ivica): Make this work for > 2 streams. 402 // TODO(ivica): Make this work for > 2 streams.
402 auto it = encoded_frame_sizes_.find(reference_timestamp); 403 auto it = encoded_frame_sizes_.find(reference_timestamp);
403 if (it == encoded_frame_sizes_.end()) 404 if (it == encoded_frame_sizes_.end())
404 it = encoded_frame_sizes_.find(reference_timestamp - 1); 405 it = encoded_frame_sizes_.find(reference_timestamp - 1);
405 size_t encoded_size = it == encoded_frame_sizes_.end() ? 0 : it->second; 406 size_t encoded_size = it == encoded_frame_sizes_.end() ? 0 : it->second;
406 if (it != encoded_frame_sizes_.end()) 407 if (it != encoded_frame_sizes_.end())
407 encoded_frame_sizes_.erase(it); 408 encoded_frame_sizes_.erase(it);
408 409
409 VideoFrame reference_copy; 410 VideoFrame reference_copy;
410 VideoFrame render_copy; 411 VideoFrame render_copy;
411 reference_copy.CopyFrame(reference);
412 render_copy.CopyFrame(render);
413 412
414 rtc::CritScope crit(&comparison_lock_); 413 rtc::CritScope crit(&comparison_lock_);
414 if (comparisons_.size() < kMaxComparisons) {
415 reference_copy.CopyFrame(reference);
416 render_copy.CopyFrame(render);
417 } else {
418 // Copy the time to ensure that delay calculations can still be made.
419 reference_copy.set_ntp_time_ms(reference.ntp_time_ms());
420 render_copy.set_ntp_time_ms(render.ntp_time_ms());
421 }
415 comparisons_.push_back(FrameComparison(reference_copy, render_copy, dropped, 422 comparisons_.push_back(FrameComparison(reference_copy, render_copy, dropped,
416 send_time_ms, recv_time_ms, 423 send_time_ms, recv_time_ms,
417 render_time_ms, encoded_size)); 424 render_time_ms, encoded_size));
418 comparison_available_event_.Set(); 425 comparison_available_event_.Set();
419 } 426 }
420 427
421 static bool PollStatsThread(void* obj) { 428 static bool PollStatsThread(void* obj) {
422 return static_cast<VideoAnalyzer*>(obj)->PollStats(); 429 return static_cast<VideoAnalyzer*>(obj)->PollStats();
423 } 430 }
424 431
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 test_label_.c_str(), dropped_frames_before_first_encode_); 546 test_label_.c_str(), dropped_frames_before_first_encode_);
540 printf("RESULT dropped_frames_before_rendering: %s = %d frames\n", 547 printf("RESULT dropped_frames_before_rendering: %s = %d frames\n",
541 test_label_.c_str(), dropped_frames_before_rendering_); 548 test_label_.c_str(), dropped_frames_before_rendering_);
542 549
543 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); 550 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_);
544 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); 551 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_);
545 } 552 }
546 553
547 void PerformFrameComparison(const FrameComparison& comparison) { 554 void PerformFrameComparison(const FrameComparison& comparison) {
548 // Perform expensive psnr and ssim calculations while not holding lock. 555 // Perform expensive psnr and ssim calculations while not holding lock.
549 double psnr = I420PSNR(&comparison.reference, &comparison.render); 556 double psnr = -1.0;
550 double ssim = I420SSIM(&comparison.reference, &comparison.render); 557 double ssim = -1.0;
558 if (!comparison.reference.IsZeroSize()) {
559 psnr = I420PSNR(&comparison.reference, &comparison.render);
560 ssim = I420SSIM(&comparison.reference, &comparison.render);
561 }
551 562
552 int64_t input_time_ms = comparison.reference.ntp_time_ms(); 563 int64_t input_time_ms = comparison.reference.ntp_time_ms();
553 564
554 rtc::CritScope crit(&comparison_lock_); 565 rtc::CritScope crit(&comparison_lock_);
555 if (graph_data_output_file_) { 566 if (graph_data_output_file_) {
556 samples_.push_back( 567 samples_.push_back(
557 Sample(comparison.dropped, input_time_ms, comparison.send_time_ms, 568 Sample(comparison.dropped, input_time_ms, comparison.send_time_ms,
558 comparison.recv_time_ms, comparison.render_time_ms, 569 comparison.recv_time_ms, comparison.render_time_ms,
559 comparison.encoded_frame_size, psnr, ssim)); 570 comparison.encoded_frame_size, psnr, ssim));
560 } 571 }
561 psnr_.AddSample(psnr); 572 if (psnr >= 0.0)
562 ssim_.AddSample(ssim); 573 psnr_.AddSample(psnr);
574 if (ssim >= 0.0)
575 ssim_.AddSample(ssim);
563 576
564 if (comparison.dropped) { 577 if (comparison.dropped) {
565 ++dropped_frames_; 578 ++dropped_frames_;
566 return; 579 return;
567 } 580 }
568 if (last_render_time_ != 0) 581 if (last_render_time_ != 0)
569 rendered_delta_.AddSample(comparison.render_time_ms - last_render_time_); 582 rendered_delta_.AddSample(comparison.render_time_ms - last_render_time_);
570 last_render_time_ = comparison.render_time_ms; 583 last_render_time_ = comparison.render_time_ms;
571 584
572 sender_time_.AddSample(comparison.send_time_ms - input_time_ms); 585 sender_time_.AddSample(comparison.send_time_ms - input_time_ms);
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 video_send_stream_->Stop(); 1169 video_send_stream_->Stop();
1157 receive_stream->Stop(); 1170 receive_stream->Stop();
1158 1171
1159 call->DestroyVideoReceiveStream(receive_stream); 1172 call->DestroyVideoReceiveStream(receive_stream);
1160 call->DestroyVideoSendStream(video_send_stream_); 1173 call->DestroyVideoSendStream(video_send_stream_);
1161 1174
1162 transport.StopSending(); 1175 transport.StopSending();
1163 } 1176 }
1164 1177
1165 } // namespace webrtc 1178 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_quality_test.h ('k') | webrtc/webrtc_perf_tests.isolate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698