aboutsummaryrefslogtreecommitdiff
path: root/webrtc
diff options
context:
space:
mode:
authorPeter Boström <pbos@webrtc.org>2016-01-04 22:36:38 +0100
committerPeter Boström <pbos@webrtc.org>2016-01-04 21:36:49 +0000
commit13f61dfea59a546e4e0081eb79e38c542ec51cf6 (patch)
treec95ac86d5b13a0b2cdb6a47885b6fe2a8d94e3a8 /webrtc
parent523702136f39cdbf0ac32d7173834ccf06744461 (diff)
downloadwebrtc-13f61dfea59a546e4e0081eb79e38c542ec51cf6.tar.gz
Move fake-handle frame creation into test target.
Renames CreateFakeNativeHandleFrame to FakeNativeHandle::CreateFrame and moves into test.gyp target 'fake_video_frames' which contains previous frame_generator target. Removes unused warnings from includers of webrtc/test/fake_texture_frame.h which did not use the function above. BUG=webrtc:5398 R=kjellander@webrtc.org TBR=stefan@webrtc.org Review URL: https://codereview.webrtc.org/1554223002 . Cr-Commit-Position: refs/heads/master@{#11149}
Diffstat (limited to 'webrtc')
-rw-r--r--webrtc/common_video/common_video_unittests.gyp1
-rw-r--r--webrtc/common_video/i420_video_frame_unittest.cc2
-rw-r--r--webrtc/modules/modules.gyp2
-rw-r--r--webrtc/test/fake_texture_frame.cc27
-rw-r--r--webrtc/test/fake_texture_frame.h20
-rw-r--r--webrtc/test/test.gyp4
-rw-r--r--webrtc/test/webrtc_test_common.gyp4
-rw-r--r--webrtc/video/video_capture_input_unittest.cc6
-rw-r--r--webrtc/video/video_send_stream_tests.cc6
9 files changed, 50 insertions, 22 deletions
diff --git a/webrtc/common_video/common_video_unittests.gyp b/webrtc/common_video/common_video_unittests.gyp
index beeab5ddca..b5e892caf0 100644
--- a/webrtc/common_video/common_video_unittests.gyp
+++ b/webrtc/common_video/common_video_unittests.gyp
@@ -17,6 +17,7 @@
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
'<(webrtc_root)/test/test.gyp:test_support_main',
+ '<(webrtc_root)/test/test.gyp:fake_video_frames',
],
'sources': [
'i420_buffer_pool_unittest.cc',
diff --git a/webrtc/common_video/i420_video_frame_unittest.cc b/webrtc/common_video/i420_video_frame_unittest.cc
index e1b103f118..926a5ee548 100644
--- a/webrtc/common_video/i420_video_frame_unittest.cc
+++ b/webrtc/common_video/i420_video_frame_unittest.cc
@@ -243,7 +243,7 @@ TEST(TestVideoFrame, FailToReuseAllocation) {
TEST(TestVideoFrame, TextureInitialValues) {
test::FakeNativeHandle* handle = new test::FakeNativeHandle();
- VideoFrame frame = test::CreateFakeNativeHandleFrame(
+ VideoFrame frame = test::FakeNativeHandle::CreateFrame(
handle, 640, 480, 100, 10, webrtc::kVideoRotation_0);
EXPECT_EQ(640, frame.width());
EXPECT_EQ(480, frame.height());
diff --git a/webrtc/modules/modules.gyp b/webrtc/modules/modules.gyp
index d1fcebbffc..e3698e26f8 100644
--- a/webrtc/modules/modules.gyp
+++ b/webrtc/modules/modules.gyp
@@ -148,7 +148,7 @@
'<(webrtc_root)/modules/video_coding/codecs/vp8/vp8.gyp:webrtc_vp8',
'<(webrtc_root)/modules/video_coding/codecs/vp9/vp9.gyp:webrtc_vp9',
'<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
- '<(webrtc_root)/test/test.gyp:frame_generator',
+ '<(webrtc_root)/test/test.gyp:fake_video_frames',
'<(webrtc_root)/test/test.gyp:rtp_test_utils',
'<(webrtc_root)/test/test.gyp:test_support_main',
'<(webrtc_root)/test/webrtc_test_common.gyp:webrtc_test_common',
diff --git a/webrtc/test/fake_texture_frame.cc b/webrtc/test/fake_texture_frame.cc
new file mode 100644
index 0000000000..5d46eec4b6
--- /dev/null
+++ b/webrtc/test/fake_texture_frame.cc
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/test/fake_texture_frame.h"
+
+namespace webrtc {
+namespace test {
+
+VideoFrame FakeNativeHandle::CreateFrame(FakeNativeHandle* native_handle,
+ int width,
+ int height,
+ uint32_t timestamp,
+ int64_t render_time_ms,
+ VideoRotation rotation) {
+ return VideoFrame(new rtc::RefCountedObject<FakeNativeHandleBuffer>(
+ native_handle, width, height),
+ timestamp, render_time_ms, rotation);
+}
+} // namespace test
+} // namespace webrtc
diff --git a/webrtc/test/fake_texture_frame.h b/webrtc/test/fake_texture_frame.h
index bc911ccba4..9575fae469 100644
--- a/webrtc/test/fake_texture_frame.h
+++ b/webrtc/test/fake_texture_frame.h
@@ -17,7 +17,15 @@
namespace webrtc {
namespace test {
-class FakeNativeHandle {};
+class FakeNativeHandle {
+ public:
+ static VideoFrame CreateFrame(FakeNativeHandle* native_handle,
+ int width,
+ int height,
+ uint32_t timestamp,
+ int64_t render_time_ms,
+ VideoRotation rotation);
+};
class FakeNativeHandleBuffer : public NativeHandleBuffer {
public:
@@ -41,16 +49,6 @@ class FakeNativeHandleBuffer : public NativeHandleBuffer {
}
};
-static VideoFrame CreateFakeNativeHandleFrame(FakeNativeHandle* native_handle,
- int width,
- int height,
- uint32_t timestamp,
- int64_t render_time_ms,
- VideoRotation rotation) {
- return VideoFrame(new rtc::RefCountedObject<FakeNativeHandleBuffer>(
- native_handle, width, height),
- timestamp, render_time_ms, rotation);
-}
} // namespace test
} // namespace webrtc
#endif // WEBRTC_TEST_FAKE_TEXTURE_FRAME_H_
diff --git a/webrtc/test/test.gyp b/webrtc/test/test.gyp
index f7a5a42c7b..82c8c25f98 100644
--- a/webrtc/test/test.gyp
+++ b/webrtc/test/test.gyp
@@ -59,9 +59,11 @@
], # conditions.
},
{
- 'target_name': 'frame_generator',
+ 'target_name': 'fake_video_frames',
'type': 'static_library',
'sources': [
+ 'fake_texture_frame.cc',
+ 'fake_texture_frame.h',
'frame_generator.cc',
'frame_generator.h',
],
diff --git a/webrtc/test/webrtc_test_common.gyp b/webrtc/test/webrtc_test_common.gyp
index ad2448e1b2..07ea2c9b74 100644
--- a/webrtc/test/webrtc_test_common.gyp
+++ b/webrtc/test/webrtc_test_common.gyp
@@ -67,7 +67,7 @@
'<(webrtc_root)/common.gyp:webrtc_common',
'<(webrtc_root)/modules/modules.gyp:media_file',
'<(webrtc_root)/modules/modules.gyp:video_render',
- '<(webrtc_root)/test/test.gyp:frame_generator',
+ '<(webrtc_root)/test/test.gyp:fake_video_frames',
'<(webrtc_root)/test/test.gyp:test_support',
'<(webrtc_root)/test/test.gyp:rtp_test_utils',
'<(webrtc_root)/webrtc.gyp:webrtc',
@@ -132,7 +132,7 @@
'dependencies': [
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(webrtc_root)/modules/modules.gyp:media_file',
- '<(webrtc_root)/test/test.gyp:frame_generator',
+ '<(webrtc_root)/test/test.gyp:fake_video_frames',
'<(webrtc_root)/test/test.gyp:test_support',
],
'direct_dependent_settings': {
diff --git a/webrtc/video/video_capture_input_unittest.cc b/webrtc/video/video_capture_input_unittest.cc
index ed9c73a288..9d720e2294 100644
--- a/webrtc/video/video_capture_input_unittest.cc
+++ b/webrtc/video/video_capture_input_unittest.cc
@@ -191,7 +191,7 @@ TEST_F(VideoCaptureInputTest, TestTextureFrames) {
for (int i = 0 ; i < kNumFrame; ++i) {
test::FakeNativeHandle* dummy_handle = new test::FakeNativeHandle();
// Add one to |i| so that width/height > 0.
- input_frames_.push_back(new VideoFrame(test::CreateFakeNativeHandleFrame(
+ input_frames_.push_back(new VideoFrame(test::FakeNativeHandle::CreateFrame(
dummy_handle, i + 1, i + 1, i + 1, i + 1, webrtc::kVideoRotation_0)));
AddInputFrame(input_frames_[i]);
WaitOutputFrame();
@@ -220,7 +220,7 @@ TEST_F(VideoCaptureInputTest, TestI420Frames) {
TEST_F(VideoCaptureInputTest, TestI420FrameAfterTextureFrame) {
test::FakeNativeHandle* dummy_handle = new test::FakeNativeHandle();
- input_frames_.push_back(new VideoFrame(test::CreateFakeNativeHandleFrame(
+ input_frames_.push_back(new VideoFrame(test::FakeNativeHandle::CreateFrame(
dummy_handle, 1, 1, 1, 1, webrtc::kVideoRotation_0)));
AddInputFrame(input_frames_[0]);
WaitOutputFrame();
@@ -239,7 +239,7 @@ TEST_F(VideoCaptureInputTest, TestTextureFrameAfterI420Frame) {
WaitOutputFrame();
test::FakeNativeHandle* dummy_handle = new test::FakeNativeHandle();
- input_frames_.push_back(new VideoFrame(test::CreateFakeNativeHandleFrame(
+ input_frames_.push_back(new VideoFrame(test::FakeNativeHandle::CreateFrame(
dummy_handle, 1, 1, 2, 2, webrtc::kVideoRotation_0)));
AddInputFrame(input_frames_[1]);
WaitOutputFrame();
diff --git a/webrtc/video/video_send_stream_tests.cc b/webrtc/video/video_send_stream_tests.cc
index 14230e540b..db7ca41a73 100644
--- a/webrtc/video/video_send_stream_tests.cc
+++ b/webrtc/video/video_send_stream_tests.cc
@@ -1158,13 +1158,13 @@ TEST_F(VideoSendStreamTest, CapturesTextureAndVideoFrames) {
test::FakeNativeHandle* handle1 = new test::FakeNativeHandle();
test::FakeNativeHandle* handle2 = new test::FakeNativeHandle();
test::FakeNativeHandle* handle3 = new test::FakeNativeHandle();
- input_frames.push_back(test::CreateFakeNativeHandleFrame(
+ input_frames.push_back(test::FakeNativeHandle::CreateFrame(
handle1, width, height, 1, 1, kVideoRotation_0));
- input_frames.push_back(test::CreateFakeNativeHandleFrame(
+ input_frames.push_back(test::FakeNativeHandle::CreateFrame(
handle2, width, height, 2, 2, kVideoRotation_0));
input_frames.push_back(CreateVideoFrame(width, height, 3));
input_frames.push_back(CreateVideoFrame(width, height, 4));
- input_frames.push_back(test::CreateFakeNativeHandleFrame(
+ input_frames.push_back(test::FakeNativeHandle::CreateFrame(
handle3, width, height, 5, 5, kVideoRotation_0));
video_send_stream_->Start();