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

Unified Diff: webrtc/video/video_quality_test.cc

Issue 2574123002: Revert of Delete VideoFrame default constructor, and IsZeroSize method. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/test/frame_generator.cc ('k') | webrtc/video/vie_encoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/video_quality_test.cc
diff --git a/webrtc/video/video_quality_test.cc b/webrtc/video/video_quality_test.cc
index 5f71717a29fc94f15e44ca6338bc9e9fbf27a2ad..ce40c5fbb32dbca7d330a6d2b034decb265aa3e0 100644
--- a/webrtc/video/video_quality_test.cc
+++ b/webrtc/video/video_quality_test.cc
@@ -371,7 +371,6 @@
struct FrameComparison {
FrameComparison()
: dropped(false),
- input_time_ms(0),
send_time_ms(0),
recv_time_ms(0),
render_time_ms(0),
@@ -380,7 +379,6 @@
FrameComparison(const VideoFrame& reference,
const VideoFrame& render,
bool dropped,
- int64_t input_time_ms,
int64_t send_time_ms,
int64_t recv_time_ms,
int64_t render_time_ms,
@@ -388,29 +386,14 @@
: reference(reference),
render(render),
dropped(dropped),
- input_time_ms(input_time_ms),
send_time_ms(send_time_ms),
recv_time_ms(recv_time_ms),
render_time_ms(render_time_ms),
encoded_frame_size(encoded_frame_size) {}
- FrameComparison(bool dropped,
- int64_t input_time_ms,
- int64_t send_time_ms,
- int64_t recv_time_ms,
- int64_t render_time_ms,
- size_t encoded_frame_size)
- : dropped(dropped),
- input_time_ms(input_time_ms),
- send_time_ms(send_time_ms),
- recv_time_ms(recv_time_ms),
- render_time_ms(render_time_ms),
- encoded_frame_size(encoded_frame_size) {}
-
- rtc::Optional<VideoFrame> reference;
- rtc::Optional<VideoFrame> render;
+ VideoFrame reference;
+ VideoFrame render;
bool dropped;
- int64_t input_time_ms;
int64_t send_time_ms;
int64_t recv_time_ms;
int64_t render_time_ms;
@@ -493,18 +476,21 @@
if (it != encoded_frame_sizes_.end())
encoded_frame_sizes_.erase(it);
+ VideoFrame reference_copy;
+ VideoFrame render_copy;
+
rtc::CritScope crit(&comparison_lock_);
if (comparisons_.size() < kMaxComparisons) {
- comparisons_.push_back(FrameComparison(reference, render, dropped,
- reference.ntp_time_ms(),
- send_time_ms, recv_time_ms,
- render_time_ms, encoded_size));
+ reference_copy = reference;
+ render_copy = render;
} else {
- comparisons_.push_back(FrameComparison(dropped,
- reference.ntp_time_ms(),
- send_time_ms, recv_time_ms,
- render_time_ms, encoded_size));
- }
+ // Copy the time to ensure that delay calculations can still be made.
+ reference_copy.set_ntp_time_ms(reference.ntp_time_ms());
+ render_copy.set_ntp_time_ms(render.ntp_time_ms());
+ }
+ comparisons_.push_back(FrameComparison(reference_copy, render_copy, dropped,
+ send_time_ms, recv_time_ms,
+ render_time_ms, encoded_size));
comparison_available_event_.Set();
}
@@ -541,6 +527,8 @@
if (AllFramesRecorded())
return false;
+ VideoFrame reference;
+ VideoFrame render;
FrameComparison comparison;
if (!PopComparison(&comparison)) {
@@ -636,12 +624,12 @@
// Perform expensive psnr and ssim calculations while not holding lock.
double psnr = -1.0;
double ssim = -1.0;
- if (comparison.reference) {
- psnr = I420PSNR(&*comparison.reference, &*comparison.render);
- ssim = I420SSIM(&*comparison.reference, &*comparison.render);
- }
-
- int64_t input_time_ms = comparison.reference->ntp_time_ms();
+ if (!comparison.reference.IsZeroSize()) {
+ psnr = I420PSNR(&comparison.reference, &comparison.render);
+ ssim = I420SSIM(&comparison.reference, &comparison.render);
+ }
+
+ int64_t input_time_ms = comparison.reference.ntp_time_ms();
rtc::CritScope crit(&comparison_lock_);
if (graph_data_output_file_) {
« no previous file with comments | « webrtc/test/frame_generator.cc ('k') | webrtc/video/vie_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698