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

Unified Diff: webrtc/modules/video_processing/test/video_processing_unittest.cc

Issue 2448053003: Fix out_frame argument of PreprocessFrameAndVerify. (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_processing/test/video_processing_unittest.cc
diff --git a/webrtc/modules/video_processing/test/video_processing_unittest.cc b/webrtc/modules/video_processing/test/video_processing_unittest.cc
index 259829ad8f8339c5f5cb8174559c5fa884bcbb80..fc5bade9ac7110b2ba24f712ae33f0fae84e7b7c 100644
--- a/webrtc/modules/video_processing/test/video_processing_unittest.cc
+++ b/webrtc/modules/video_processing/test/video_processing_unittest.cc
@@ -34,7 +34,7 @@ static void PreprocessFrameAndVerify(const VideoFrame& source,
int target_width,
int target_height,
VideoProcessing* vpm,
- const VideoFrame* out_frame);
+ const VideoFrame** out_frame);
static rtc::scoped_refptr<VideoFrameBuffer> CropBuffer(
rtc::scoped_refptr<VideoFrameBuffer> source_buffer,
int offset_x,
@@ -98,7 +98,7 @@ TEST_F(VideoProcessingTest, PreprocessorLogic) {
// Disable spatial sampling.
vp_->SetInputFrameResampleMode(kNoRescaling);
EXPECT_EQ(VPM_OK, vp_->SetTargetResolution(resolution, resolution, 30));
- VideoFrame* out_frame = NULL;
+ const VideoFrame* out_frame = NULL;
// Set rescaling => output frame != NULL.
vp_->SetInputFrameResampleMode(kFastRescaling);
@@ -109,7 +109,8 @@ TEST_F(VideoProcessingTest, PreprocessorLogic) {
buffer->InitializeData();
VideoFrame video_frame(buffer, 0, 0, webrtc::kVideoRotation_0);
- PreprocessFrameAndVerify(video_frame, resolution, resolution, vp_, out_frame);
+ PreprocessFrameAndVerify(video_frame, resolution, resolution, vp_,
+ &out_frame);
// No rescaling=> output frame = NULL.
vp_->SetInputFrameResampleMode(kNoRescaling);
EXPECT_TRUE(vp_->PreprocessFrame(video_frame) != nullptr);
@@ -192,23 +193,22 @@ void PreprocessFrameAndVerify(const VideoFrame& source,
int target_width,
int target_height,
VideoProcessing* vpm,
- const VideoFrame* out_frame) {
+ const VideoFrame** out_frame) {
ASSERT_EQ(VPM_OK, vpm->SetTargetResolution(target_width, target_height, 30));
- out_frame = vpm->PreprocessFrame(source);
- EXPECT_TRUE(out_frame != nullptr);
+ *out_frame = vpm->PreprocessFrame(source);
+ EXPECT_TRUE(*out_frame != nullptr);
// If no resizing is needed, expect the original frame.
if (target_width == source.width() && target_height == source.height()) {
- EXPECT_EQ(&source, out_frame);
+ EXPECT_EQ(&source, *out_frame);
return;
}
// Verify the resampled frame.
- EXPECT_TRUE(out_frame != NULL);
- EXPECT_EQ(source.render_time_ms(), (out_frame)->render_time_ms());
- EXPECT_EQ(source.timestamp(), (out_frame)->timestamp());
- EXPECT_EQ(target_width, (out_frame)->width());
- EXPECT_EQ(target_height, (out_frame)->height());
+ EXPECT_EQ(source.render_time_ms(), (*out_frame)->render_time_ms());
+ EXPECT_EQ(source.timestamp(), (*out_frame)->timestamp());
+ EXPECT_EQ(target_width, (*out_frame)->width());
+ EXPECT_EQ(target_height, (*out_frame)->height());
}
rtc::scoped_refptr<VideoFrameBuffer> CropBuffer(
@@ -240,10 +240,10 @@ void TestSize(const VideoFrame& source_frame,
double expected_psnr,
VideoProcessing* vpm) {
// Resample source_frame to out_frame.
- VideoFrame* out_frame = NULL;
+ const VideoFrame* out_frame = NULL;
vpm->SetInputFrameResampleMode(kBox);
PreprocessFrameAndVerify(source_frame, target_width, target_height, vpm,
- out_frame);
+ &out_frame);
if (out_frame == NULL)
return;
WriteProcessedFrameForVisualInspection(source_frame, *out_frame);
@@ -254,7 +254,7 @@ void TestSize(const VideoFrame& source_frame,
// Compute PSNR against the cropped source frame and check expectation.
PreprocessFrameAndVerify(resampled_source_frame,
cropped_source.width(),
- cropped_source.height(), vpm, out_frame);
+ cropped_source.height(), vpm, &out_frame);
WriteProcessedFrameForVisualInspection(resampled_source_frame, *out_frame);
// Compute PSNR against the cropped source frame and check expectation.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698