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}
This commit is contained in:
Peter Boström
2016-01-04 22:36:38 +01:00
parent 523702136f
commit 13f61dfea5
10 changed files with 50 additions and 32 deletions

View File

@ -139,16 +139,6 @@
},
},
},],
['clang==1', {
# Disabled due to failing when compiled with -Wall, see
# https://bugs.chromium.org/p/webrtc/issues/detail?id=5398
'cflags': [
'-Wno-unused-function',
],
'xcode_settings': {
'WARNING_CFLAGS': ['-Wno-unused-function'],
},
},],
['OS=="ios"', {
'sources!': [
'media/sctp/sctpdataengine_unittest.cc',

View File

@ -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',

View File

@ -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());

View File

@ -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',

View File

@ -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

View File

@ -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_

View File

@ -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',
],

View File

@ -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': {

View File

@ -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();

View File

@ -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();