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

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

Issue 1900673002: Delete webrtc::VideoFrame methods buffer and stride. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 8 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/webrtcvideoengine2_unittest.cc ('k') | webrtc/modules/video_capture/video_capture.gypi » ('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 e75ad038c803743d330f07eedeb8cb8e270e63f9..7309f1b8a09cb732c810ee48639e6c2632fdddc8 100644
--- a/webrtc/modules/video_capture/test/video_capture_unittest.cc
+++ b/webrtc/modules/video_capture/test/video_capture_unittest.cc
@@ -23,6 +23,7 @@
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
#include "webrtc/system_wrappers/include/sleep.h"
#include "webrtc/system_wrappers/include/tick_util.h"
+#include "webrtc/test/frame_utils.h"
#include "webrtc/video_frame.h"
using webrtc::CriticalSectionWrapper;
@@ -60,32 +61,6 @@ static const int kTestHeight = 288;
static const int kTestWidth = 352;
static const int kTestFramerate = 30;
-// Compares the content of two video frames.
-static bool CompareFrames(const webrtc::VideoFrame& frame1,
- const webrtc::VideoFrame& frame2) {
- bool result =
- (frame1.stride(webrtc::kYPlane) == frame2.stride(webrtc::kYPlane)) &&
- (frame1.stride(webrtc::kUPlane) == frame2.stride(webrtc::kUPlane)) &&
- (frame1.stride(webrtc::kVPlane) == frame2.stride(webrtc::kVPlane)) &&
- (frame1.width() == frame2.width()) &&
- (frame1.height() == frame2.height());
-
- if (!result)
- return false;
- for (int plane = 0; plane < webrtc::kNumOfPlanes; plane ++) {
- webrtc::PlaneType plane_type = static_cast<webrtc::PlaneType>(plane);
- int allocated_size1 = frame1.allocated_size(plane_type);
- int allocated_size2 = frame2.allocated_size(plane_type);
- if (allocated_size1 != allocated_size2)
- return false;
- const uint8_t* plane_buffer1 = frame1.buffer(plane_type);
- const uint8_t* plane_buffer2 = frame2.buffer(plane_type);
- if (memcmp(plane_buffer1, plane_buffer2, allocated_size1))
- return false;
- }
- return true;
-}
-
class TestVideoCaptureCallback : public VideoCaptureDataCallback {
public:
TestVideoCaptureCallback()
@@ -132,7 +107,7 @@ class TestVideoCaptureCallback : public VideoCaptureDataCallback {
incoming_frames_++;
last_render_time_ms_ = videoFrame.render_time_ms();
- last_frame_.CopyFrame(videoFrame);
+ last_frame_ = videoFrame.video_frame_buffer();
}
virtual void OnCaptureDelayChanged(const int32_t id,
@@ -168,7 +143,8 @@ class TestVideoCaptureCallback : public VideoCaptureDataCallback {
bool CompareLastFrame(const webrtc::VideoFrame& frame) {
CriticalSectionScoped cs(capture_cs_.get());
- return CompareFrames(last_frame_, frame);
+ return webrtc::test::FrameBufsEqual(last_frame_,
+ frame.video_frame_buffer());
}
void SetExpectedCaptureRotation(webrtc::VideoRotation rotation) {
@@ -183,7 +159,7 @@ class TestVideoCaptureCallback : public VideoCaptureDataCallback {
int64_t last_render_time_ms_;
int incoming_frames_;
int timing_warnings_;
- webrtc::VideoFrame last_frame_;
+ rtc::scoped_refptr<webrtc::VideoFrameBuffer> last_frame_;
webrtc::VideoRotation rotate_frame_;
};
@@ -448,10 +424,11 @@ class VideoCaptureExternalTest : public testing::Test {
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_.buffer(webrtc::kYPlane), 127, kTestWidth * kTestHeight);
- memset(test_frame_.buffer(webrtc::kUPlane), 127,
+ 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(test_frame_.buffer(webrtc::kVPlane), 127,
+ memset(test_frame_.video_frame_buffer()->MutableDataV(), 127,
((kTestWidth + 1) / 2) * ((kTestHeight + 1) / 2));
capture_module_->RegisterCaptureDataCallback(capture_callback_);
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2_unittest.cc ('k') | webrtc/modules/video_capture/video_capture.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698