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

Unified Diff: webrtc/modules/video_capture/test/video_capture_unittest.cc

Issue 2354223002: Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 3 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 | « webrtc/media/engine/webrtcvideoframe.cc ('k') | webrtc/modules/video_capture/video_capture_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_capture/test/video_capture_unittest.cc
diff --git a/webrtc/modules/video_capture/test/video_capture_unittest.cc b/webrtc/modules/video_capture/test/video_capture_unittest.cc
index 10f3a2bed34da2b7ba46bc6f7acc49de9094d9ec..839ab804ad970e05555dbd1181000f5ada736e2a 100644
--- a/webrtc/modules/video_capture/test/video_capture_unittest.cc
+++ b/webrtc/modules/video_capture/test/video_capture_unittest.cc
@@ -420,19 +420,15 @@
capability.maxFPS = kTestFramerate;
capture_callback_.SetExpectedCapability(capability);
- rtc::scoped_refptr<webrtc::I420Buffer> buffer = webrtc::I420Buffer::Create(
- kTestWidth, kTestHeight,
- kTestWidth, ((kTestWidth + 1) / 2), (kTestWidth + 1) / 2);
-
- memset(buffer->MutableDataY(), 127, kTestWidth * kTestHeight);
- memset(buffer->MutableDataU(), 127,
+ test_frame_.CreateEmptyFrame(kTestWidth, kTestHeight, kTestWidth,
+ ((kTestWidth + 1) / 2), (kTestWidth + 1) / 2);
+ SleepMs(1); // Wait 1ms so that two tests can't have the same timestamp.
+ memset(test_frame_.video_frame_buffer()->MutableDataY(), 127,
+ kTestWidth * kTestHeight);
+ memset(test_frame_.video_frame_buffer()->MutableDataU(), 127,
((kTestWidth + 1) / 2) * ((kTestHeight + 1) / 2));
- memset(buffer->MutableDataV(), 127,
+ memset(test_frame_.video_frame_buffer()->MutableDataV(), 127,
((kTestWidth + 1) / 2) * ((kTestHeight + 1) / 2));
- test_frame_.reset(
- new webrtc::VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0));
-
- SleepMs(1); // Wait 1ms so that two tests can't have the same timestamp.
capture_module_->RegisterCaptureDataCallback(capture_callback_);
capture_module_->RegisterCaptureCallback(capture_feedback_);
@@ -447,7 +443,7 @@
webrtc::VideoCaptureExternal* capture_input_interface_;
rtc::scoped_refptr<VideoCaptureModule> capture_module_;
std::unique_ptr<webrtc::ProcessThread> process_module_;
- std::unique_ptr<webrtc::VideoFrame> test_frame_;
+ webrtc::VideoFrame test_frame_;
TestVideoCaptureCallback capture_callback_;
TestVideoCaptureFeedBack capture_feedback_;
};
@@ -455,13 +451,13 @@
// Test input of external video frames.
TEST_F(VideoCaptureExternalTest, TestExternalCapture) {
size_t length = webrtc::CalcBufferSize(webrtc::kI420,
- test_frame_->width(),
- test_frame_->height());
+ test_frame_.width(),
+ test_frame_.height());
std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]);
- webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get());
+ webrtc::ExtractBuffer(test_frame_, length, test_buffer.get());
EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(),
length, capture_callback_.capability(), 0));
- EXPECT_TRUE(capture_callback_.CompareLastFrame(*test_frame_));
+ EXPECT_TRUE(capture_callback_.CompareLastFrame(test_frame_));
}
// Test frame rate and no picture alarm.
@@ -476,14 +472,13 @@
uint64_t startTime = rtc::TimeNanos();
while ((rtc::TimeNanos() - startTime) < testTime) {
- size_t length = webrtc::CalcBufferSize(webrtc::kI420,
- test_frame_->width(),
- test_frame_->height());
- std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]);
- webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get());
- EXPECT_EQ(
- 0, capture_input_interface_->IncomingFrame(
- test_buffer.get(), length, capture_callback_.capability(), 0));
+ size_t length = webrtc::CalcBufferSize(webrtc::kI420,
+ test_frame_.width(),
+ test_frame_.height());
+ std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]);
+ webrtc::ExtractBuffer(test_frame_, length, test_buffer.get());
+ EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(),
+ length, capture_callback_.capability(), 0));
SleepMs(100);
}
EXPECT_TRUE(capture_feedback_.frame_rate() >= 8 &&
@@ -494,10 +489,10 @@
startTime = rtc::TimeNanos();
while ((rtc::TimeNanos() - startTime) < testTime) {
size_t length = webrtc::CalcBufferSize(webrtc::kI420,
- test_frame_->width(),
- test_frame_->height());
+ test_frame_.width(),
+ test_frame_.height());
std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]);
- webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get());
+ webrtc::ExtractBuffer(test_frame_, length, test_buffer.get());
EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(),
length, capture_callback_.capability(), 0));
SleepMs(1000 / 30);
@@ -512,10 +507,10 @@
TEST_F(VideoCaptureExternalTest, Rotation) {
EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_0));
size_t length = webrtc::CalcBufferSize(webrtc::kI420,
- test_frame_->width(),
- test_frame_->height());
+ test_frame_.width(),
+ test_frame_.height());
std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[length]);
- webrtc::ExtractBuffer(*test_frame_, length, test_buffer.get());
+ webrtc::ExtractBuffer(test_frame_, length, test_buffer.get());
EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(),
length, capture_callback_.capability(), 0));
EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_90));
« no previous file with comments | « webrtc/media/engine/webrtcvideoframe.cc ('k') | webrtc/modules/video_capture/video_capture_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698