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

Unified Diff: webrtc/video/video_quality_test.cc

Issue 2541863002: Delete VideoFrame default constructor, and IsZeroSize method. (Closed)
Patch Set: Initialize pixel data in VideoBroadcasterTest.OnFrame test. 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 ce40c5fbb32dbca7d330a6d2b034decb265aa3e0..5f71717a29fc94f15e44ca6338bc9e9fbf27a2ad 100644
--- a/webrtc/video/video_quality_test.cc
+++ b/webrtc/video/video_quality_test.cc
@@ -371,6 +371,7 @@ class VideoAnalyzer : public PacketReceiver,
struct FrameComparison {
FrameComparison()
: dropped(false),
+ input_time_ms(0),
send_time_ms(0),
recv_time_ms(0),
render_time_ms(0),
@@ -379,6 +380,7 @@ class VideoAnalyzer : public PacketReceiver,
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,
@@ -386,14 +388,29 @@ class VideoAnalyzer : public PacketReceiver,
: 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) {}
- VideoFrame reference;
- VideoFrame render;
+ rtc::Optional<VideoFrame> reference;
+ rtc::Optional<VideoFrame> render;
bool dropped;
+ int64_t input_time_ms;
int64_t send_time_ms;
int64_t recv_time_ms;
int64_t render_time_ms;
@@ -476,21 +493,18 @@ class VideoAnalyzer : public PacketReceiver,
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) {
- reference_copy = reference;
- render_copy = render;
+ comparisons_.push_back(FrameComparison(reference, render, dropped,
+ reference.ntp_time_ms(),
+ send_time_ms, recv_time_ms,
+ render_time_ms, encoded_size));
} else {
- // 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(dropped,
+ reference.ntp_time_ms(),
+ send_time_ms, recv_time_ms,
+ render_time_ms, encoded_size));
}
- comparisons_.push_back(FrameComparison(reference_copy, render_copy, dropped,
- send_time_ms, recv_time_ms,
- render_time_ms, encoded_size));
comparison_available_event_.Set();
}
@@ -527,8 +541,6 @@ class VideoAnalyzer : public PacketReceiver,
if (AllFramesRecorded())
return false;
- VideoFrame reference;
- VideoFrame render;
FrameComparison comparison;
if (!PopComparison(&comparison)) {
@@ -624,12 +636,12 @@ class VideoAnalyzer : public PacketReceiver,
// Perform expensive psnr and ssim calculations while not holding lock.
double psnr = -1.0;
double ssim = -1.0;
- if (!comparison.reference.IsZeroSize()) {
- psnr = I420PSNR(&comparison.reference, &comparison.render);
- ssim = I420SSIM(&comparison.reference, &comparison.render);
+ 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();
+ 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