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:
@ -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"', {
|
['OS=="ios"', {
|
||||||
'sources!': [
|
'sources!': [
|
||||||
'media/sctp/sctpdataengine_unittest.cc',
|
'media/sctp/sctpdataengine_unittest.cc',
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
'<(DEPTH)/testing/gtest.gyp:gtest',
|
'<(DEPTH)/testing/gtest.gyp:gtest',
|
||||||
'<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
|
'<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
|
||||||
'<(webrtc_root)/test/test.gyp:test_support_main',
|
'<(webrtc_root)/test/test.gyp:test_support_main',
|
||||||
|
'<(webrtc_root)/test/test.gyp:fake_video_frames',
|
||||||
],
|
],
|
||||||
'sources': [
|
'sources': [
|
||||||
'i420_buffer_pool_unittest.cc',
|
'i420_buffer_pool_unittest.cc',
|
||||||
|
@ -243,7 +243,7 @@ TEST(TestVideoFrame, FailToReuseAllocation) {
|
|||||||
|
|
||||||
TEST(TestVideoFrame, TextureInitialValues) {
|
TEST(TestVideoFrame, TextureInitialValues) {
|
||||||
test::FakeNativeHandle* handle = new test::FakeNativeHandle();
|
test::FakeNativeHandle* handle = new test::FakeNativeHandle();
|
||||||
VideoFrame frame = test::CreateFakeNativeHandleFrame(
|
VideoFrame frame = test::FakeNativeHandle::CreateFrame(
|
||||||
handle, 640, 480, 100, 10, webrtc::kVideoRotation_0);
|
handle, 640, 480, 100, 10, webrtc::kVideoRotation_0);
|
||||||
EXPECT_EQ(640, frame.width());
|
EXPECT_EQ(640, frame.width());
|
||||||
EXPECT_EQ(480, frame.height());
|
EXPECT_EQ(480, frame.height());
|
||||||
|
@ -148,7 +148,7 @@
|
|||||||
'<(webrtc_root)/modules/video_coding/codecs/vp8/vp8.gyp:webrtc_vp8',
|
'<(webrtc_root)/modules/video_coding/codecs/vp8/vp8.gyp:webrtc_vp8',
|
||||||
'<(webrtc_root)/modules/video_coding/codecs/vp9/vp9.gyp:webrtc_vp9',
|
'<(webrtc_root)/modules/video_coding/codecs/vp9/vp9.gyp:webrtc_vp9',
|
||||||
'<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
|
'<(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:rtp_test_utils',
|
||||||
'<(webrtc_root)/test/test.gyp:test_support_main',
|
'<(webrtc_root)/test/test.gyp:test_support_main',
|
||||||
'<(webrtc_root)/test/webrtc_test_common.gyp:webrtc_test_common',
|
'<(webrtc_root)/test/webrtc_test_common.gyp:webrtc_test_common',
|
||||||
|
27
webrtc/test/fake_texture_frame.cc
Normal file
27
webrtc/test/fake_texture_frame.cc
Normal 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
|
@ -17,7 +17,15 @@
|
|||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace test {
|
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 {
|
class FakeNativeHandleBuffer : public NativeHandleBuffer {
|
||||||
public:
|
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 test
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
#endif // WEBRTC_TEST_FAKE_TEXTURE_FRAME_H_
|
#endif // WEBRTC_TEST_FAKE_TEXTURE_FRAME_H_
|
||||||
|
@ -59,9 +59,11 @@
|
|||||||
], # conditions.
|
], # conditions.
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'target_name': 'frame_generator',
|
'target_name': 'fake_video_frames',
|
||||||
'type': 'static_library',
|
'type': 'static_library',
|
||||||
'sources': [
|
'sources': [
|
||||||
|
'fake_texture_frame.cc',
|
||||||
|
'fake_texture_frame.h',
|
||||||
'frame_generator.cc',
|
'frame_generator.cc',
|
||||||
'frame_generator.h',
|
'frame_generator.h',
|
||||||
],
|
],
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
'<(webrtc_root)/common.gyp:webrtc_common',
|
'<(webrtc_root)/common.gyp:webrtc_common',
|
||||||
'<(webrtc_root)/modules/modules.gyp:media_file',
|
'<(webrtc_root)/modules/modules.gyp:media_file',
|
||||||
'<(webrtc_root)/modules/modules.gyp:video_render',
|
'<(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:test_support',
|
||||||
'<(webrtc_root)/test/test.gyp:rtp_test_utils',
|
'<(webrtc_root)/test/test.gyp:rtp_test_utils',
|
||||||
'<(webrtc_root)/webrtc.gyp:webrtc',
|
'<(webrtc_root)/webrtc.gyp:webrtc',
|
||||||
@ -132,7 +132,7 @@
|
|||||||
'dependencies': [
|
'dependencies': [
|
||||||
'<(DEPTH)/testing/gtest.gyp:gtest',
|
'<(DEPTH)/testing/gtest.gyp:gtest',
|
||||||
'<(webrtc_root)/modules/modules.gyp:media_file',
|
'<(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',
|
'<(webrtc_root)/test/test.gyp:test_support',
|
||||||
],
|
],
|
||||||
'direct_dependent_settings': {
|
'direct_dependent_settings': {
|
||||||
|
@ -191,7 +191,7 @@ TEST_F(VideoCaptureInputTest, TestTextureFrames) {
|
|||||||
for (int i = 0 ; i < kNumFrame; ++i) {
|
for (int i = 0 ; i < kNumFrame; ++i) {
|
||||||
test::FakeNativeHandle* dummy_handle = new test::FakeNativeHandle();
|
test::FakeNativeHandle* dummy_handle = new test::FakeNativeHandle();
|
||||||
// Add one to |i| so that width/height > 0.
|
// 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)));
|
dummy_handle, i + 1, i + 1, i + 1, i + 1, webrtc::kVideoRotation_0)));
|
||||||
AddInputFrame(input_frames_[i]);
|
AddInputFrame(input_frames_[i]);
|
||||||
WaitOutputFrame();
|
WaitOutputFrame();
|
||||||
@ -220,7 +220,7 @@ TEST_F(VideoCaptureInputTest, TestI420Frames) {
|
|||||||
|
|
||||||
TEST_F(VideoCaptureInputTest, TestI420FrameAfterTextureFrame) {
|
TEST_F(VideoCaptureInputTest, TestI420FrameAfterTextureFrame) {
|
||||||
test::FakeNativeHandle* dummy_handle = new test::FakeNativeHandle();
|
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)));
|
dummy_handle, 1, 1, 1, 1, webrtc::kVideoRotation_0)));
|
||||||
AddInputFrame(input_frames_[0]);
|
AddInputFrame(input_frames_[0]);
|
||||||
WaitOutputFrame();
|
WaitOutputFrame();
|
||||||
@ -239,7 +239,7 @@ TEST_F(VideoCaptureInputTest, TestTextureFrameAfterI420Frame) {
|
|||||||
WaitOutputFrame();
|
WaitOutputFrame();
|
||||||
|
|
||||||
test::FakeNativeHandle* dummy_handle = new test::FakeNativeHandle();
|
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)));
|
dummy_handle, 1, 1, 2, 2, webrtc::kVideoRotation_0)));
|
||||||
AddInputFrame(input_frames_[1]);
|
AddInputFrame(input_frames_[1]);
|
||||||
WaitOutputFrame();
|
WaitOutputFrame();
|
||||||
|
@ -1158,13 +1158,13 @@ TEST_F(VideoSendStreamTest, CapturesTextureAndVideoFrames) {
|
|||||||
test::FakeNativeHandle* handle1 = new test::FakeNativeHandle();
|
test::FakeNativeHandle* handle1 = new test::FakeNativeHandle();
|
||||||
test::FakeNativeHandle* handle2 = new test::FakeNativeHandle();
|
test::FakeNativeHandle* handle2 = new test::FakeNativeHandle();
|
||||||
test::FakeNativeHandle* handle3 = 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));
|
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));
|
handle2, width, height, 2, 2, kVideoRotation_0));
|
||||||
input_frames.push_back(CreateVideoFrame(width, height, 3));
|
input_frames.push_back(CreateVideoFrame(width, height, 3));
|
||||||
input_frames.push_back(CreateVideoFrame(width, height, 4));
|
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));
|
handle3, width, height, 5, 5, kVideoRotation_0));
|
||||||
|
|
||||||
video_send_stream_->Start();
|
video_send_stream_->Start();
|
||||||
|
Reference in New Issue
Block a user